Simple
SimpleChatStore #
Bases: BaseChatStore
简单的聊天存储。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
class_name
classmethod
#
class_name() -> str
获取类名。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
16 17 18 19 |
|
set_messages #
set_messages(key: str, messages: List[ChatMessage]) -> None
为一个键设置消息。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
21 22 23 |
|
get_messages #
get_messages(key: str) -> List[ChatMessage]
获取特定键的消息。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
25 26 27 |
|
add_message #
add_message(
key: str,
message: ChatMessage,
idx: Optional[int] = None,
) -> None
为键添加一条消息。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
29 30 31 32 33 34 35 36 |
|
delete_messages #
delete_messages(key: str) -> Optional[List[ChatMessage]]
删除指定键的消息。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
38 39 40 41 42 |
|
delete_message #
delete_message(key: str, idx: int) -> Optional[ChatMessage]
删除特定键的消息。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
44 45 46 47 48 49 50 |
|
delete_last_message #
delete_last_message(key: str) -> Optional[ChatMessage]
删除指定键的最后一条消息。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
52 53 54 55 56 |
|
get_keys #
get_keys() -> List[str]
获取所有的键。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
58 59 60 |
|
persist #
persist(
persist_path: str = "chat_store.json",
fs: Optional[AbstractFileSystem] = None,
) -> None
将文档存储持久化到文件中。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
from_persist_path
classmethod
#
from_persist_path(
persist_path: str = "chat_store.json",
fs: Optional[AbstractFileSystem] = None,
) -> SimpleChatStore
从持久路径创建一个SimpleChatStore。
Source code in llama_index/core/storage/chat_store/simple_chat_store.py
76 77 78 79 80 81 82 83 84 85 86 87 88 |
|