随着理解的加深,后续会回来优化。1 输出封装
content=‘’ additional_kwargs={‘tool_calls’: [{‘id’: ‘call_ek805JD7PATXCZ6yjNErBgpL’, ‘function’: {‘arguments’: ‘{“numbers”:[13,49837,3489,23423]}’, ‘name’: ‘sum’}, ‘type’: ‘function’}]} response_metadata={‘token_usage’: {‘completion_tokens’: 22, ‘prompt_tokens’: 68, ‘total_tokens’: 90}, ‘model_name’: ‘gpt-3.5-turbo’, ‘system_fingerprint’: ‘fp_c2295e73ad’, ‘finish_reason’: ‘tool_calls’, ‘logprobs’: None} id=‘run-ba534c13-9a3d-4e77-a056-37465fd58549-0’ tool_calls=[{‘name’: ‘sum’, ‘args’: {‘numbers’: [13, 49837, 3489, 23423]}, ‘id’: ‘call_ek805JD7PATXCZ6yjNErBgpL’}]1.2 langchain中的输出封装
—解析后结果—
[{‘args’: {‘numbers’: [13, 49837, 3489, 23423]}, ‘type’: ‘sum’}]
| 输出类型 | 类名称 | 备注 |
| boolean | BooleanOutputParser | 返回True或False |
| combining | CombiningOutputParser | 同时将多个输出解析成同一个格式 |
| datetime | DatetimeOutputParser | 将日期转化成特定格式 |
| enum | EnumOutputParser | 将LLM模型输出解析成enum |
| fix | OutputFixingParser | 可以自动修复异常并重新解析 |
| pandas_dataframe | PandasDataFrameOutputParser | 使用pandas.dataframe的format对LLM进行解析 |
| regex | RegexParser | 使用正则表达式对LLM模型返回进行解析 |
| regex_dict | RegexDictParser | 功能同上 |
| retry | RetryOutputParser、RetryWithErrorOutputParser | 可以自动修复异常并重新解析 |
| structured | StructuredOutputParser | 将LLM模型输出进行结构化解析 |
| yaml | YamlOutputParser | 提取LLM模型输出中的YAML部分 |
0001-01-01T00:00:00.000000Z2 PydanticOutputParser
{参考文献
“item”: [“apple”, “banana”, “orange”, “strawberry”, “grape”, “watermelon”, “kiwi”, “pineapple”, “mango”, “pear”]
}
ToyotaFordChevroletHondaVolkswagenBMWMercedes-BenzAudiNissan
- Hyundai
item=[‘Toyota’, ‘Ford’, ‘Chevrolet’, ‘Honda’, ‘Volkswagen’, ‘BMW’, ‘Mercedes-Benz’, ‘Audi’, ‘Nissan’, ‘Hyundai’]
| 欢迎光临 AI创想 (https://www.llms-ai.com/) | Powered by Discuz! X3.4 |