索引
基础记忆 #
基类:EventBaseComponent
所有内存类型的基类。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
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 | |
class_name
classmethod
#
class_name() -> str
获取类名。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
17 18 19 20 | |
from_defaults
abstractmethod
classmethod
#
from_defaults(**kwargs: Any) -> BaseMemory
从默认设置创建聊天记忆。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
22 23 24 25 26 27 28 | |
获取
abstractmethod
#
get(input: Optional[str] = None, **kwargs: Any) -> List[ChatMessage]
获取聊天历史记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
30 31 32 | |
智能体
async
#
aget(input: Optional[str] = None, **kwargs: Any) -> List[ChatMessage]
获取聊天历史记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
34 35 36 37 38 | |
get_all
abstractmethod
#
get_all() -> List[ChatMessage]
获取所有聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
40 41 42 | |
aget_all
async
#
aget_all() -> List[ChatMessage]
获取所有聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
44 45 46 | |
放置
abstractmethod
#
put(message: ChatMessage) -> None
放置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
48 49 50 | |
输出
async
#
aput(message: ChatMessage) -> None
放置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
52 53 54 | |
put_messages #
put_messages(messages: List[ChatMessage]) -> None
放置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
56 57 58 59 | |
aput_messages
async
#
aput_messages(messages: List[ChatMessage]) -> None
放置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
61 62 63 | |
设置
abstractmethod
#
set(messages: List[ChatMessage]) -> None
设置聊天历史记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
65 66 67 | |
资产集
async
#
aset(messages: List[ChatMessage]) -> None
设置聊天历史记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
69 70 71 | |
重置
abstractmethod
#
reset() -> None
重置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
73 74 75 | |
重置
async
#
areset() -> None
重置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
77 78 79 | |
基础聊天存储记忆 #
基类:EventBaseMemory
用于存储多租户聊天记录的基础类。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
chat_store
|
BaseChatStore
|
简易聊天存储。此类中的异步方法提供与同步方法相同的功能。 |
<dynamic>
|
chat_store_key
|
str
|
|
'chat_history'
|
workflows/handler.py 中的源代码llama_index/core/memory/types.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
class_name
classmethod
#
class_name() -> str
获取类名。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
94 95 96 97 | |
from_defaults
abstractmethod
classmethod
#
from_defaults(chat_history: Optional[List[ChatMessage]] = None, llm: Optional[大语言模型] = None, **kwargs: Any) -> BaseChatStoreMemory
从默认设置创建聊天记忆。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
99 100 101 102 103 104 105 106 107 | |
get_all #
get_all() -> List[ChatMessage]
获取所有聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
109 110 111 | |
aget_all
async
#
aget_all() -> List[ChatMessage]
获取所有聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
113 114 115 | |
获取 #
get(input: Optional[str] = None, **kwargs: Any) -> List[ChatMessage]
获取聊天历史记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
117 118 119 | |
智能体
async
#
aget(input: Optional[str] = None, **kwargs: Any) -> List[ChatMessage]
获取聊天历史记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
121 122 123 124 125 | |
放置 #
put(message: ChatMessage) -> None
放置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
127 128 129 130 | |
输出
async
#
aput(message: ChatMessage) -> None
放置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
132 133 134 135 | |
设置 #
set(messages: List[ChatMessage]) -> None
设置聊天历史记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
137 138 139 | |
集合
async
#
aset(messages: List[ChatMessage]) -> None
设置聊天历史记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
141 142 143 144 | |
重置 #
reset() -> None
重置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
146 147 148 | |
重置
async
#
areset() -> None
重置聊天记录。
workflows/handler.py 中的源代码llama_index/core/memory/types.py
150 151 152 | |