Pydantic
输出解析器。
基础输出解析器 #
Bases: DispatcherSpanMixin, ABC
输出解析器类。
workflows/handler.py 中的源代码llama_index/core/types.py
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 | |
解析
abstractmethod
#
parse(output: str) -> Any
以编程方式解析、验证并纠正错误。
workflows/handler.py 中的源代码llama_index/core/types.py
46 47 48 | |
format #
format(query: str) -> str
使用结构化输出格式指令格式化查询。
workflows/handler.py 中的源代码llama_index/core/types.py
50 51 52 | |
format_messages #
format_messages(messages: List[ChatMessage]) -> List[ChatMessage]
使用结构化输出格式指令格式化消息列表。
workflows/handler.py 中的源代码llama_index/core/types.py
76 77 78 79 80 81 82 83 84 85 86 87 | |
Langchain输出解析器 #
基类:EventBaseOutputParser
Langchain 输出解析器。
workflows/handler.py 中的源代码llama_index/core/output_parsers/langchain.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 | |
解析 #
parse(output: str) -> Any
以编程方式解析、验证并纠正错误。
workflows/handler.py 中的源代码llama_index/core/output_parsers/langchain.py
25 26 27 28 29 | |
format #
format(query: str) -> str
使用结构化输出格式指令格式化查询。
workflows/handler.py 中的源代码llama_index/core/output_parsers/langchain.py
31 32 33 34 35 36 37 38 39 40 41 42 | |
Pydantic输出解析器 #
Bases: BaseOutputParser, Generic[Model]
Pydantic 输出解析器。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
output_cls
|
BaseModel
|
Pydantic 输出类。 |
required |
workflows/handler.py 中的源代码llama_index/core/output_parsers/pydantic.py
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 | |
get_format_string #
get_format_string(escape_json: bool = True) -> str
格式化字符串。
workflows/handler.py 中的源代码llama_index/core/output_parsers/pydantic.py
47 48 49 50 51 52 53 54 55 56 57 58 | |
解析 #
parse(text: str) -> Any
以编程方式解析、验证并纠正错误。
workflows/handler.py 中的源代码llama_index/core/output_parsers/pydantic.py
60 61 62 63 | |
format #
format(query: str) -> str
使用结构化输出格式指令格式化查询。
workflows/handler.py 中的源代码llama_index/core/output_parsers/pydantic.py
65 66 67 | |
选择输出解析器 #
基类:EventBaseOutputParser
workflows/handler.py 中的源代码llama_index/core/output_parsers/selection.py
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 | |
选项: 成员:- PydanticOutputParser