Thanks to visit codestin.com
Credit goes to github.com

Skip to content

.NET: Python: suggestion - add clear_messages() method to ChatMessageStoreProtocol #1712

Description

@anguzo

Explnation:

The ChatMessageStoreProtocol currently defines methods for adding and listing messages, but lacks a method to clear/delete all messages. This is needed for common use cases like:

  • User-initiated conversation resets
  • Cleaning up test data
  • Implementing privacy/data retention policies
  • Starting fresh conversations in chat applications

Proposed Solution:

Add the following method to ChatMessageStoreProtocol:

async def clear_messages(self) -> None:
    """
    Clear all messages from the message store.
    
    This method should remove all persisted messages, allowing
    the conversation to start fresh.
    """
    ...

Workaround:

Currently using an extended protocol in my codebase:

@runtime_checkable
class ExtendedChatMessageStoreProtocol(ChatMessageStoreProtocol, Protocol):
    async def clear_messages(self) -> None: ...

Metadata

Metadata

Labels

.NETUsage: [Issues, PRs], Target: .NetmemoryUsage: [Issues, PRs], Target: memory related featurespythonUsage: [Issues, PRs], Target: Python

Type

Fields

No fields configured for Task.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions