From c11dbefedc2ba8a6999704e2916f3c086e4cbcb4 Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Thu, 11 Jan 2024 12:24:15 -0600 Subject: [PATCH] docs[patch]: Fix bad headers in output parser docs (#15778) Currently looks like this: Screenshot 2024-01-09 at 1 08 53 PM CC @efriis @baskaryan --- .../modules/model_io/output_parsers/index.mdx | 29 ++++++++++--------- .../model_io/output_parsers/quick_start.ipynb | 2 +- .../output_parsers/types/_category_.yml | 1 + 3 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 docs/docs/modules/model_io/output_parsers/types/_category_.yml diff --git a/docs/docs/modules/model_io/output_parsers/index.mdx b/docs/docs/modules/model_io/output_parsers/index.mdx index 865037e841..ac479f6918 100644 --- a/docs/docs/modules/model_io/output_parsers/index.mdx +++ b/docs/docs/modules/model_io/output_parsers/index.mdx @@ -1,5 +1,6 @@ --- sidebar_position: 4 +hide_table_of_contents: true --- # Output Parsers @@ -29,17 +30,17 @@ LangChain has lots of different types of output parsers. This is a list of outpu **Description**: Our commentary on this output parser and when to use it. -| Name | Supports Streaming | Has Format Instructions | Calls LLM | Input Type | Output Type | Description | | | -|-----------------|--------------------|-------------------------------|-----------|----------------------------------|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|---| -| [OpenAIFunctions](./types/openai_functions) | ✅ | (Passes `functions` to model) | | `Message` (with `function_call`) | JSON object | Uses OpenAI function calling to structure the return output. If you are using a model that supports function calling, this is generally the most reliable method. | | | -| [JSON](./types/json) | ✅ | ✅ | | `str \| Message` | JSON object | Returns a JSON object as specified. You can specify a Pydantic model and it will return JSON for that model. Probably the most reliable output parser for getting structured data that does NOT use function calling. | | | -| [XML](./types/xml) | ✅ | ✅ | | `str \| Message` | `dict` | Returns a dictionary of tags. Use when XML output is needed. Use with models that are good at writing XML (like Anthropic's). | | | -| [CSV](./types/csv) | ✅ | ✅ | | `str \| Message` | `List[str]` | Returns a list of comma separated values. | | | -| [OutputFixing](./types/output_fixing) | | | ✅ | `str \| Message` | | Wraps another output parser. If that output parser errors, then this will pass the error message and the bad output to an LLM and ask it to fix the output. | | | -| [RetryWithError](./types/retry) | | | ✅ | `str \| Message` | | Wraps another output parser. If that output parser errors, then this will pass the original inputs, the bad output, and the error message to an LLM and ask it to fix it. Compared to OutputFixingParser, this one also sends the original instructions. | | | -| [Pydantic](./types/pydantic) | | ✅ | | `str \| Message` | `pydantic.BaseModel` | Takes a user defined Pydantic model and returns data in that format. | | | -| [YAML](./types/yaml) | | ✅ | | `str \| Message` | `pydantic.BaseModel` | Takes a user defined Pydantic model and returns data in that format. Uses YAML to encode it. | | | -| [PandasDataFrame](./types/pandas_dataframe) | | ✅ | | `str \| Message` | `dict` | Useful for doing operations with pandas DataFrames. | | | -| [Enum](./types/enum) | | ✅ | | `str \| Message` | `Enum` | Parses response into one of the provided enum values. | | | -| [Datetime](./types/datetime) | | ✅ | | `str \| Message` | `datetime.datetime` | Parses response into a datetime string. | | | -| [Structured](./types/structured) | | ✅ | | `str \| Message` | `Dict[str, str]` | An output parser that returns structured information. It is less powerful than other output parsers since it only allows for fields to be strings. This can be useful when you are working with smaller LLMs. | | | +| Name | Supports Streaming | Has Format Instructions | Calls LLM | Input Type | Output Type | Description | +|-----------------|--------------------|-------------------------------|-----------|----------------------------------|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [OpenAIFunctions](./types/openai_functions) | ✅ | (Passes `functions` to model) | | `Message` (with `function_call`) | JSON object | Uses OpenAI function calling to structure the return output. If you are using a model that supports function calling, this is generally the most reliable method. | +| [JSON](./types/json) | ✅ | ✅ | | `str \| Message` | JSON object | Returns a JSON object as specified. You can specify a Pydantic model and it will return JSON for that model. Probably the most reliable output parser for getting structured data that does NOT use function calling. | +| [XML](./types/xml) | ✅ | ✅ | | `str \| Message` | `dict` | Returns a dictionary of tags. Use when XML output is needed. Use with models that are good at writing XML (like Anthropic's). | +| [CSV](./types/csv) | ✅ | ✅ | | `str \| Message` | `List[str]` | Returns a list of comma separated values. | +| [OutputFixing](./types/output_fixing) | | | ✅ | `str \| Message` | | Wraps another output parser. If that output parser errors, then this will pass the error message and the bad output to an LLM and ask it to fix the output. | +| [RetryWithError](./types/retry) | | | ✅ | `str \| Message` | | Wraps another output parser. If that output parser errors, then this will pass the original inputs, the bad output, and the error message to an LLM and ask it to fix it. Compared to OutputFixingParser, this one also sends the original instructions. | +| [Pydantic](./types/pydantic) | | ✅ | | `str \| Message` | `pydantic.BaseModel` | Takes a user defined Pydantic model and returns data in that format. | +| [YAML](./types/yaml) | | ✅ | | `str \| Message` | `pydantic.BaseModel` | Takes a user defined Pydantic model and returns data in that format. Uses YAML to encode it. | +| [PandasDataFrame](./types/pandas_dataframe) | | ✅ | | `str \| Message` | `dict` | Useful for doing operations with pandas DataFrames. | +| [Enum](./types/enum) | | ✅ | | `str \| Message` | `Enum` | Parses response into one of the provided enum values. | +| [Datetime](./types/datetime) | | ✅ | | `str \| Message` | `datetime.datetime` | Parses response into a datetime string. | +| [Structured](./types/structured) | | ✅ | | `str \| Message` | `Dict[str, str]` | An output parser that returns structured information. It is less powerful than other output parsers since it only allows for fields to be strings. This can be useful when you are working with smaller LLMs. | diff --git a/docs/docs/modules/model_io/output_parsers/quick_start.ipynb b/docs/docs/modules/model_io/output_parsers/quick_start.ipynb index 55e4cc16c6..5a4effdaee 100644 --- a/docs/docs/modules/model_io/output_parsers/quick_start.ipynb +++ b/docs/docs/modules/model_io/output_parsers/quick_start.ipynb @@ -7,7 +7,7 @@ "source": [ "---\n", "sidebar_position: 3\n", - "title: Output parsers\n", + "title: Quickstart\n", "---" ] }, diff --git a/docs/docs/modules/model_io/output_parsers/types/_category_.yml b/docs/docs/modules/model_io/output_parsers/types/_category_.yml new file mode 100644 index 0000000000..8638cc3b00 --- /dev/null +++ b/docs/docs/modules/model_io/output_parsers/types/_category_.yml @@ -0,0 +1 @@ +label: 'Types' \ No newline at end of file