feat: add async support to BaseChatStore and BaseChatStoreMemory (#1483)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Aman Rao
2024-11-15 03:15:50 +05:30
committed by GitHub
parent ee20c44d9b
commit c69605f406
3 changed files with 11 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@llamaindex/core": patch
---
feat: add async support to BaseChatStore and BaseChatStoreMemory
+3 -3
View File
@@ -71,15 +71,15 @@ export abstract class BaseChatStoreMemory<
return this.chatStore.getMessages(this.chatStoreKey);
}
put(messages: ChatMessage<AdditionalMessageOptions>) {
put(messages: ChatMessage<AdditionalMessageOptions>): void | Promise<void> {
this.chatStore.addMessage(this.chatStoreKey, messages);
}
set(messages: ChatMessage<AdditionalMessageOptions>[]) {
set(messages: ChatMessage<AdditionalMessageOptions>[]): void | Promise<void> {
this.chatStore.setMessages(this.chatStoreKey, messages);
}
reset() {
reset(): void | Promise<void> {
this.chatStore.deleteMessages(this.chatStoreKey);
}
}
@@ -19,5 +19,7 @@ export abstract class BaseChatStore<
): void;
abstract deleteMessages(key: string): void;
abstract deleteMessage(key: string, idx: number): void;
abstract getKeys(): IterableIterator<string>;
abstract getKeys():
| IterableIterator<string>
| Promise<IterableIterator<string>>;
}