Selection
Output parsers.
BaseOutputParser #
Bases: DispatcherSpanMixin, ABC
Output parser class.
Source code in 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 | |
parse
abstractmethod
#
parse(output: str) -> Any
Parse, validate, and correct errors programmatically.
Source code in llama_index/core/types.py
46 47 48 | |
format #
format(query: str) -> str
Format a query with structured output formatting instructions.
Source code in llama_index/core/types.py
50 51 52 | |
format_messages #
format_messages(messages: List[ChatMessage]) -> List[ChatMessage]
Format a list of messages with structured output formatting instructions.
Source code in llama_index/core/types.py
76 77 78 79 80 81 82 83 84 85 86 87 | |
LangchainOutputParser #
Bases: BaseOutputParser
Langchain output parser.
Source code in 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 #
parse(output: str) -> Any
Parse, validate, and correct errors programmatically.
Source code in llama_index/core/output_parsers/langchain.py
25 26 27 28 29 | |
format #
format(query: str) -> str
Format a query with structured output formatting instructions.
Source code in llama_index/core/output_parsers/langchain.py
31 32 33 34 35 36 37 38 39 40 41 42 | |
PydanticOutputParser #
Bases: BaseOutputParser, Generic[Model]
Pydantic Output Parser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_cls
|
BaseModel
|
Pydantic output class. |
required |
Source code in 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
Format string.
Source code in llama_index/core/output_parsers/pydantic.py
47 48 49 50 51 52 53 54 55 56 57 58 | |
parse #
parse(text: str) -> Any
Parse, validate, and correct errors programmatically.
Source code in llama_index/core/output_parsers/pydantic.py
60 61 62 63 | |
format #
format(query: str) -> str
Format a query with structured output formatting instructions.
Source code in llama_index/core/output_parsers/pydantic.py
65 66 67 | |
SelectionOutputParser #
Bases: BaseOutputParser
Source code in 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 | |
options: members: - SelectionOutputParser