id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
104988625f00-9
The type of input this runnable accepts specified as a pydantic model. property lc_attributes: Dict¶ List of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor. property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.rail_parser.GuardrailsOutputParser.html
e6be45590e47-0
langchain.output_parsers.json.parse_and_check_json_markdown¶ langchain.output_parsers.json.parse_and_check_json_markdown(text: str, expected_keys: List[str]) → dict[source]¶ Parse a JSON string from a Markdown string and check that it contains the expected keys. Parameters text – The Markdown string. expected_keys – Th...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.parse_and_check_json_markdown.html
23515396a2ea-0
langchain.output_parsers.pydantic.PydanticOutputParser¶ class langchain.output_parsers.pydantic.PydanticOutputParser[source]¶ Bases: BaseOutputParser[T] Parse an output using a pydantic model. param pydantic_object: Type[langchain.output_parsers.pydantic.T] [Required]¶ The pydantic model to parse. async abatch(inputs: ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.pydantic.PydanticOutputParser.html
23515396a2ea-1
Parameters result – A list of Generations to be parsed. The Generations are assumed to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astr...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.pydantic.PydanticOutputParser.html
23515396a2ea-2
input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch w...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.pydantic.PydanticOutputParser.html
23515396a2ea-3
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.pydantic.PydanticOutputParser.html
23515396a2ea-4
For example, if the class is langchain.llms.openai.OpenAI, then the namespace is [“langchain”, “llms”, “openai”] get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and con...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.pydantic.PydanticOutputParser.html
23515396a2ea-5
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.pydantic.PydanticOutputParser.html
23515396a2ea-6
The prompt is largely provided in the event the OutputParser wants to retry or fix the output in some way, and needs information from the prompt to do so. Parameters completion – String output of a language model. prompt – Input PromptValue. Returns Structured output classmethod schema(by_alias: bool = True, ref_templa...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.pydantic.PydanticOutputParser.html
23515396a2ea-7
Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A sequence of runnables to try if the original runnable fails. exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_liste...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.pydantic.PydanticOutputParser.html
23515396a2ea-8
Bind input and output types to a Runnable, returning a new Runnable. property InputType: Any¶ The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.output_parser.T]¶ The type of output this runnable produces specified as a type annotation. property config_spe...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.pydantic.PydanticOutputParser.html
35749263f552-0
langchain.output_parsers.enum.EnumOutputParser¶ class langchain.output_parsers.enum.EnumOutputParser[source]¶ Bases: BaseOutputParser Parse an output that is one of a set of values. param enum: Type[enum.Enum] [Required]¶ The enum to parse. Its values must be strings. async abatch(inputs: List[Input], config: Optional[...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
35749263f552-1
to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astream, which calls ainvoke. Subclasses should override this method if they support str...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
35749263f552-2
Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → R...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
35749263f552-3
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
35749263f552-4
methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate output. invoke(input:...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
35749263f552-5
The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. parse(response: str) → Any[source]¶ Parse a single string model output into some stru...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
35749263f552-6
prompt – Input PromptValue. Returns Structured output classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: O...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
35749263f552-7
exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
35749263f552-8
The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.output_parser.T]¶ The type of output this runnable produces specified as a type annotation. property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶ List configurable fields for ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
e9ed495f1ca1-0
langchain.output_parsers.loading.load_output_parser¶ langchain.output_parsers.loading.load_output_parser(config: dict) → dict[source]¶ Load an output parser. Parameters config – config dict Returns config dict with output parser loaded
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.loading.load_output_parser.html
e287d251a365-0
langchain.output_parsers.regex.RegexParser¶ class langchain.output_parsers.regex.RegexParser[source]¶ Bases: BaseOutputParser Parse the output of an LLM call using a regex. param default_output_key: Optional[str] = None¶ The default key to use for the output. param output_keys: List[str] [Required]¶ The keys to use for...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex.RegexParser.html
e287d251a365-1
Parameters result – A list of Generations to be parsed. The Generations are assumed to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astr...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex.RegexParser.html
e287d251a365-2
input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch w...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex.RegexParser.html
e287d251a365-3
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex.RegexParser.html
e287d251a365-4
namespace is [“langchain”, “llms”, “openai”] get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema tha...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex.RegexParser.html
e287d251a365-5
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex.RegexParser.html
e287d251a365-6
to retry or fix the output in some way, and needs information from the prompt to do so. Parameters completion – String output of a language model. prompt – Input PromptValue. Returns Structured output classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod sc...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex.RegexParser.html
e287d251a365-7
Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A sequence of runnables to try if the original runnable fails. exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_liste...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex.RegexParser.html
e287d251a365-8
Bind input and output types to a Runnable, returning a new Runnable. property InputType: Any¶ The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.output_parser.T]¶ The type of output this runnable produces specified as a type annotation. property config_spe...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex.RegexParser.html
7cbd933f3991-0
langchain.output_parsers.openai_tools.PydanticToolsParser¶ class langchain.output_parsers.openai_tools.PydanticToolsParser[source]¶ Bases: JsonOutputToolsParser Parse tools from OpenAI response. param tools: List[Type[pydantic.main.BaseModel]] [Required]¶ async abatch(inputs: List[Input], config: Optional[Union[Runnabl...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.PydanticToolsParser.html
7cbd933f3991-1
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.PydanticToolsParser.html
7cbd933f3991-2
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.PydanticToolsParser.html
7cbd933f3991-3
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.PydanticToolsParser.html
7cbd933f3991-4
Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific co...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.PydanticToolsParser.html
7cbd933f3991-5
A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. classmethod parse_file...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.PydanticToolsParser.html
7cbd933f3991-6
to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.PydanticToolsParser.html
7cbd933f3991-7
The Run object contains information about the run, including its id, type, input, output, error, start_time, end_time, and any tags or metadata added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_af...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.PydanticToolsParser.html
7cbd933f3991-8
A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model.
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.PydanticToolsParser.html
75d19dbfaa6f-0
langchain.output_parsers.json.parse_partial_json¶ langchain.output_parsers.json.parse_partial_json(s: str, *, strict: bool = False) → Any[source]¶ Parse a JSON string that may be missing closing braces. Parameters s – The JSON string to parse. strict – Whether to use strict parsing. Defaults to False. Returns The parse...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.parse_partial_json.html
944cf3b025ef-0
langchain.output_parsers.openai_functions.JsonOutputFunctionsParser¶ class langchain.output_parsers.openai_functions.JsonOutputFunctionsParser[source]¶ Bases: BaseCumulativeTransformOutputParser[Any] Parse an output as the Json object. param args_only: bool = True¶ Whether to only return the arguments to the function c...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
944cf3b025ef-1
Parameters text – String output of a language model. Returns Structured output. async aparse_result(result: List[Generation], *, partial: bool = False) → T¶ Parse a list of candidate model Generations into a specific format. The return value is parsed from only the first Generation in the result, whichis assumed to be ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
944cf3b025ef-2
The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Union[str, BaseMessage]], config: Optional[RunnableConfig] = None, **kwargs: Any) → AsyncIterator[T]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
944cf3b025ef-3
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
944cf3b025ef-4
Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate input. classmethod get_lc_namespace() → List[str]¶ Get the namespace of the langchain object. For example, if the class is langchain.llms.openai.OpenAI, then the namespace is [“langchain”, “llms”, “open...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
944cf3b025ef-5
classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
944cf3b025ef-6
parse_result(result: List[Generation], *, partial: bool = False) → Any[source]¶ Parse a list of candidate model Generations into a specific format. The return value is parsed from only the first Generation in the result, whichis assumed to be the highest-likelihood Generation. Parameters result – A list of Generations ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
944cf3b025ef-7
input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
944cf3b025ef-8
added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶ Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exc...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
944cf3b025ef-9
property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model. Examples using JsonOutputFunctionsParser¶ prompt_llm_parser.md
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
8c7acb79a31b-0
langchain.output_parsers.structured.StructuredOutputParser¶ class langchain.output_parsers.structured.StructuredOutputParser[source]¶ Bases: BaseOutputParser Parse the output of an LLM call to a structured output. param response_schemas: List[langchain.output_parsers.structured.ResponseSchema] [Required]¶ The schemas f...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
8c7acb79a31b-1
Parameters result – A list of Generations to be parsed. The Generations are assumed to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astr...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
8c7acb79a31b-2
input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch w...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
8c7acb79a31b-3
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
8c7acb79a31b-4
# # `json # { #     "foo": List[string]  // a list of strings #     "bar": string  // a string # } # ` Parameters only_json (bool) – If True, only the json in the Markdown code snippet will be returned, without the introducing text. Defaults to False. get_input_schema(config: Optional[RunnableConfig] = None) → Type[Bas...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
8c7acb79a31b-5
Transform a single input into an output. Override to implement. Parameters input – The input to the runnable. config – A config to use when invoking the runnable. The config supports standard keys like ‘tags’, ‘metadata’ for tracing purposes, ‘max_concurrency’ for controlling how much work to do in parallel, and other ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
8c7acb79a31b-6
Parameters text – String output of a language model. Returns Structured output. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
8c7acb79a31b-7
Default implementation of stream, which calls invoke. Subclasses should override this method if they support streaming output. to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = No...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
8c7acb79a31b-8
on_start: Called before the runnable starts running, with the Run object. on_end: Called after the runnable finishes running, with the Run object. on_error: Called if the runnable throws an error, with the Run object. The Run object contains information about the run, including its id, type, input, output, error, start...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
8c7acb79a31b-9
property lc_attributes: Dict¶ List of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor. property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: T...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
62e348c79a1d-0
langchain.output_parsers.list.ListOutputParser¶ class langchain.output_parsers.list.ListOutputParser[source]¶ Bases: BaseOutputParser[List[str]] Parse the output of an LLM call to a list. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool =...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
62e348c79a1d-1
to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astream, which calls ainvoke. Subclasses should override this method if they support str...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
62e348c79a1d-2
Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → R...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
62e348c79a1d-3
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
62e348c79a1d-4
methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate output. invoke(input:...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
62e348c79a1d-5
The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. abstract parse(text: str) → List[str][source]¶ Parse the output of an LLM call. class...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
62e348c79a1d-6
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of stream, which calls invoke. Subclasses should override t...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
62e348c79a1d-7
fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶ Bind lifecycle listeners to a Runnable, returning a new Runnable. on_start: Called before the runnable starts running, with the Run ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
62e348c79a1d-8
The type of output this runnable produces specified as a type annotation. property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶ List configurable fields for this runnable. property input_schema: Type[pydantic.main.BaseModel]¶ The type of input this runnable accepts specified as a pydantic ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
b5187fddc725-0
langchain.output_parsers.list.CommaSeparatedListOutputParser¶ class langchain.output_parsers.list.CommaSeparatedListOutputParser[source]¶ Bases: ListOutputParser Parse the output of an LLM call to a comma-separated list. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = N...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
b5187fddc725-1
to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astream, which calls ainvoke. Subclasses should override this method if they support str...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
b5187fddc725-2
Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → R...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
b5187fddc725-3
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
b5187fddc725-4
methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate output. invoke(input:...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
b5187fddc725-5
The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. parse(text: str) → List[str][source]¶ Parse the output of an LLM call. classmethod pa...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
b5187fddc725-6
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of stream, which calls invoke. Subclasses should override t...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
b5187fddc725-7
fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶ Bind lifecycle listeners to a Runnable, returning a new Runnable. on_start: Called before the runnable starts running, with the Run ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
b5187fddc725-8
The type of output this runnable produces specified as a type annotation. property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶ List configurable fields for this runnable. property input_schema: Type[pydantic.main.BaseModel]¶ The type of input this runnable accepts specified as a pydantic ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
ab2d4905d623-0
langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser¶ class langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser[source]¶ Bases: JsonOutputToolsParser Parse tools from OpenAI response. param key_name: str [Required]¶ The type of tools to return. async abatch(inputs: List[Input], config: Optional[Uni...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser.html
ab2d4905d623-1
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser.html
ab2d4905d623-2
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser.html
ab2d4905d623-3
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser.html
ab2d4905d623-4
Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific co...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser.html
ab2d4905d623-5
A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. classmethod parse_file...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser.html
ab2d4905d623-6
to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser.html
ab2d4905d623-7
The Run object contains information about the run, including its id, type, input, output, error, start_time, end_time, and any tags or metadata added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_af...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser.html
ab2d4905d623-8
A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model.
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_tools.JsonOutputKeyToolsParser.html
075cf0e57b05-0
langchain.output_parsers.boolean.BooleanOutputParser¶ class langchain.output_parsers.boolean.BooleanOutputParser[source]¶ Bases: BaseOutputParser[bool] Parse the output of an LLM call to a boolean. param false_val: str = 'NO'¶ The string value that should be parsed as False. param true_val: str = 'YES'¶ The string valu...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
075cf0e57b05-1
Parameters result – A list of Generations to be parsed. The Generations are assumed to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astr...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
075cf0e57b05-2
input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch w...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
075cf0e57b05-3
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
075cf0e57b05-4
namespace is [“langchain”, “llms”, “openai”] get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema tha...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
075cf0e57b05-5
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
075cf0e57b05-6
The prompt is largely provided in the event the OutputParser wants to retry or fix the output in some way, and needs information from the prompt to do so. Parameters completion – String output of a language model. prompt – Input PromptValue. Returns Structured output classmethod schema(by_alias: bool = True, ref_templa...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
075cf0e57b05-7
Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A sequence of runnables to try if the original runnable fails. exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_liste...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
075cf0e57b05-8
Bind input and output types to a Runnable, returning a new Runnable. property InputType: Any¶ The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.output_parser.T]¶ The type of output this runnable produces specified as a type annotation. property config_spe...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
968b24ddce8f-0
langchain.output_parsers.list.NumberedListOutputParser¶ class langchain.output_parsers.list.NumberedListOutputParser[source]¶ Bases: ListOutputParser Parse a numbered list. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwarg...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.NumberedListOutputParser.html
968b24ddce8f-1
Default implementation of astream, which calls ainvoke. Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, incl...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.NumberedListOutputParser.html
968b24ddce8f-2
Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[Bas...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.NumberedListOutputParser.html
968b24ddce8f-3
Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep co...
lang/api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.NumberedListOutputParser.html