Llama 调试
Llama调试处理器 #
基类:EventPythonicallyPrintingBaseHandler
用于跟踪调试信息的回调处理器。
注意:这是一个测试版功能。我们代码库中的使用方式和接口可能会发生变化。
该处理器仅跟踪按事件类型分隔的事件开始/结束。 您可以使用此回调处理器来跟踪和调试事件。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
event_starts_to_ignore
|
Optional[List[CBEventType]]
|
跟踪事件开始时忽略的事件类型列表。 |
None
|
event_ends_to_ignore
|
Optional[List[CBEventType]]
|
跟踪事件结束时忽略的事件类型列表。 |
None
|
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
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 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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
on_event_start #
on_event_start(event_type: CBEventType, payload: Optional[Dict[str, Any]] = None, event_id: str = '', parent_id: str = '', **kwargs: Any) -> str
按事件类型存储事件开始数据。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
event_type
|
CBEventType
|
要存储的事件类型。 |
required |
payload
|
Optional[Dict[str, Any]]
|
要存储的有效载荷。 |
None
|
event_id
|
str
|
要存储的事件ID。 |
''
|
parent_id
|
str
|
父事件ID。 |
''
|
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
on_event_end #
on_event_end(event_type: CBEventType, payload: Optional[Dict[str, Any]] = None, event_id: str = '', **kwargs: Any) -> None
按事件类型存储事件结束数据。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
event_type
|
CBEventType
|
要存储的事件类型。 |
required |
payload
|
Optional[Dict[str, Any]]
|
要存储的有效载荷。 |
None
|
event_id
|
str
|
要存储的事件ID。 |
''
|
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
get_events #
get_events(event_type: Optional[CBEventType] = None) -> List[CBEvent]
获取特定事件类型的所有事件。
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
105 106 107 108 109 110 | |
get_event_pairs #
get_event_pairs(event_type: Optional[CBEventType] = None) -> List[List[CBEvent]]
按ID配对事件,可以是所有事件或特定类型的事件。
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
139 140 141 142 143 144 145 146 | |
get_llm_inputs_outputs #
get_llm_inputs_outputs() -> List[List[CBEvent]]
获取精确的LLM输入和输出。
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
148 149 150 | |
flush_event_logs #
flush_event_logs() -> None
从内存中清除所有事件。
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
158 159 160 161 162 | |
start_trace #
start_trace(trace_id: Optional[str] = None) -> None
启动一个追踪。
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
164 165 166 167 | |
end_trace #
end_trace(trace_id: Optional[str] = None, trace_map: Optional[Dict[str, List[str]]] = None) -> None
关闭当前追踪。
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
169 170 171 172 173 174 175 176 177 | |
print_trace_map #
print_trace_map() -> None
在终端打印简单的追踪地图,用于调试最近的追踪记录。
workflows/handler.py 中的源代码llama_index/core/callbacks/llama_debug.py
193 194 195 196 197 198 | |
选项: 成员:- LlamaDebugHandler