types.ConversationStore
types.ConversationStore()Storage interface for chat conversation history.
Conversations are partitioned by ConversationPartition. Implement the four abstract methods to plug any backend into Chat.enable_history().
Methods
| Name | Description |
|---|---|
| delete | Remove a conversation. Missing ids are a no-op. |
| get | Full record, or None if missing. |
| list | All conversations in partition, newest-first (by updated_at). |
| put | Upsert. Rename = mutate record.title and put(). |
| total_size | Total bytes used by all conversations in partition. |
delete
types.ConversationStore.delete(partition, conv_id)Remove a conversation. Missing ids are a no-op.
get
types.ConversationStore.get(partition, conv_id)Full record, or None if missing.
list
types.ConversationStore.list(partition)All conversations in partition, newest-first (by updated_at).
put
types.ConversationStore.put(partition, record)Upsert. Rename = mutate record.title and put().
total_size
types.ConversationStore.total_size(partition)Total bytes used by all conversations in partition.
Derived from list()’s per-record size_bytes — backends don’t need to override this unless they have a cheaper way to compute it.