事件类型
BaseEvent #
基类:BaseModel
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
timestamp
|
datetime
|
|
datetime.datetime(2025, 5, 8, 23, 24, 0, 25386)
|
id_
|
str
|
|
'5c64e991-6bf0-4200-b20a-d40be0b9ce17'
|
tags
|
Dict[str, Any]
|
|
{}
|
源代码位于 llama-index-core/llama_index/core/instrumentation/events/base.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
class_name classmethod
#
class_name() -> str
返回类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/base.py
19 20 21 22 |
|
dict #
dict(**kwargs: Any) -> Dict[str, Any]
保留以保证向后兼容性。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/base.py
24 25 26 |
|
AgentChatWithStepEndEvent #
基类:BaseEvent
AgentChatWithStepEndEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
response
|
Optional[AGENT_CHAT_RESPONSE_TYPE]
|
Agent 聊天响应。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
69 70 71 72 73 74 75 76 77 78 79 80 81 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 |
|
validate_response classmethod
#
validate_response(values: Any) -> Any
验证响应。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
validate_response_type classmethod
#
validate_response_type(response: Any) -> Any
验证响应类型。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
110 111 112 113 |
|
AgentChatWithStepStartEvent #
基类:BaseEvent
AgentChatWithStepStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
user_msg
|
str
|
用户输入消息。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
63 64 65 66 |
|
AgentRunStepEndEvent #
基类:BaseEvent
AgentRunStepEndEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
step_output
|
TaskStepOutput
|
任务步骤输出。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
46 47 48 49 |
|
AgentRunStepStartEvent #
基类:BaseEvent
AgentRunStepStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
task_id
|
str
|
任务 ID。 |
必需 |
step
|
Optional[TaskStep]
|
任务步骤。 |
必需 |
input
|
Optional[str]
|
可选输入。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
29 30 31 32 |
|
AgentToolCallEvent #
基类:BaseEvent
AgentToolCallEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
arguments
|
str
|
参数。 |
必需 |
tool
|
ToolMetadata
|
工具元数据。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/agent.py
129 130 131 132 |
|
StreamChatDeltaReceivedEvent #
基类:BaseEvent
StreamChatDeltaReceivedEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
delta
|
str
|
从流式聊天接收到的 Delta。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/chat_engine.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/chat_engine.py
60 61 62 63 |
|
StreamChatEndEvent #
基类:BaseEvent
StreamChatEndEvent。
在写入流式聊天引擎队列结束时触发。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/chat_engine.py
17 18 19 20 21 22 23 24 25 26 27 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/chat_engine.py
24 25 26 27 |
|
StreamChatErrorEvent #
基类:BaseEvent
StreamChatErrorEvent。
在流式聊天引擎操作期间抛出异常时触发。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
exception
|
Exception
|
流式聊天操作期间抛出的异常。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/chat_engine.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/chat_engine.py
43 44 45 46 |
|
StreamChatStartEvent #
基类:BaseEvent
StreamChatStartEvent。
在写入流式聊天引擎队列开始时触发。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/chat_engine.py
4 5 6 7 8 9 10 11 12 13 14 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/chat_engine.py
11 12 13 14 |
|
EmbeddingEndEvent #
基类:BaseEvent
EmbeddingEndEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
chunks
|
List[str]
|
文本块列表。 |
必需 |
embeddings
|
List[List[float]]
|
嵌入列表。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/embedding.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/embedding.py
38 39 40 41 |
|
EmbeddingStartEvent #
基类:BaseEvent
EmbeddingStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
model_dict
|
dict #
|
包含嵌入模型详细信息的模型字典。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/embedding.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/embedding.py
19 20 21 22 |
|
LLMChatEndEvent #
基类:BaseEvent
LLMChatEndEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
消息
|
List[ChatMessage]
|
聊天消息列表。 |
必需 |
response
|
Optional[ChatResponse]
|
上次聊天响应。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
219 220 221 222 |
|
LLMChatStartEvent #
基类:BaseEvent
LLMChatStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
消息
|
List[ChatMessage]
|
聊天消息列表。 |
必需 |
additional_kwargs
|
dict #
|
附加关键词参数。 |
必需 |
model_dict
|
dict #
|
模型字典。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
181 182 183 184 |
|
LLMCompletionEndEvent #
基类:BaseEvent
LLMCompletionEndEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
prompt
|
str
|
要完成的提示。 |
必需 |
response
|
CompletionResponse
|
完成响应。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
159 160 161 162 |
|
LLMCompletionStartEvent #
基类:BaseEvent
LLMCompletionStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
prompt
|
str
|
要完成的提示。 |
必需 |
additional_kwargs
|
dict #
|
附加关键词参数。 |
必需 |
model_dict
|
dict #
|
模型字典。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
121 122 123 124 |
|
LLMPredictEndEvent #
基类:BaseEvent
LLMPredictEndEvent。
llm.predict() 调用的结果。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
output
|
str
|
输出。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
44 45 46 47 |
|
LLMPredictStartEvent #
基类:BaseEvent
LLMPredictStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
template
|
BasePromptTemplate
|
提示模板。 |
必需 |
template_args
|
Optional[dict]
|
提示模板参数。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/llm.py
25 26 27 28 |
|
QueryEndEvent #
基类:BaseEvent
QueryEndEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
query
|
QueryType
|
查询字符串或查询捆绑包。 |
必需 |
response
|
RESPONSE_TYPE
|
响应。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/query.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/query.py
36 37 38 39 |
|
QueryStartEvent #
基类:BaseEvent
QueryStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
query
|
QueryType
|
查询字符串或查询捆绑包。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/query.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/query.py
17 18 19 20 |
|
RetrievalEndEvent #
基类:BaseEvent
RetrievalEndEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
str_or_query_bundle
|
QueryType
|
查询捆绑包。 |
必需 |
nodes
|
List[NodeWithScore]
|
带分数的节点列表。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/retrieval.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/retrieval.py
36 37 38 39 |
|
RetrievalStartEvent #
基类:BaseEvent
RetrievalStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
str_or_query_bundle
|
QueryType
|
查询捆绑包。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/retrieval.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/retrieval.py
17 18 19 20 |
|
GetResponseEndEvent #
基类:BaseEvent
GetResponseEndEvent。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/synthesis.py
63 64 65 66 67 68 69 70 71 72 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/synthesis.py
69 70 71 72 |
|
GetResponseStartEvent #
基类:BaseEvent
GetResponseStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
query_str
|
str
|
查询字符串。 |
必需 |
text_chunks
|
List[str]
|
文本块列表。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/synthesis.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/synthesis.py
57 58 59 60 |
|
SynthesizeEndEvent #
基类:BaseEvent
SynthesizeEndEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
query
|
QueryType
|
查询字符串或查询捆绑包。 |
必需 |
response
|
RESPONSE_TYPE
|
响应。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/synthesis.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/synthesis.py
38 39 40 41 |
|
SynthesizeStartEvent #
基类:BaseEvent
SynthesizeStartEvent。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
query
|
QueryType
|
查询字符串或查询捆绑包。 |
必需 |
源代码位于 llama-index-core/llama_index/core/instrumentation/events/synthesis.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
class_name classmethod
#
class_name() -> str
类名。
源代码位于 llama-index-core/llama_index/core/instrumentation/events/synthesis.py
19 20 21 22 |
|