id
stringlengths
14
15
text
stringlengths
44
2.47k
source
stringlengths
61
181
f4202b77ede8-0
langchain_experimental API Reference¶ langchain_experimental.autonomous_agents¶ Classes¶ autonomous_agents.autogpt.agent.AutoGPT(...) Agent class for interacting with Auto-GPT. autonomous_agents.autogpt.memory.AutoGPTMemory Memory for AutoGPT. autonomous_agents.autogpt.output_parser.AutoGPTAction(...) Action returned b...
https://api.python.langchain.com/en/latest/experimental_api_reference.html
f4202b77ede8-1
autonomous_agents.hugginggpt.task_planner.Plan(steps) autonomous_agents.hugginggpt.task_planner.PlanningOutputParser Create a new model by parsing and validating input data from keyword arguments. autonomous_agents.hugginggpt.task_planner.Step(...) autonomous_agents.hugginggpt.task_planner.TaskPlaningChain Chain to exe...
https://api.python.langchain.com/en/latest/experimental_api_reference.html
f4202b77ede8-2
comprehend_moderation.base_moderation_config.ModerationToxicityConfig Create a new model by parsing and validating input data from keyword arguments. comprehend_moderation.base_moderation_exceptions.ModerationIntentionError([...]) Exception raised if Intention entities are detected. comprehend_moderation.base_moderatio...
https://api.python.langchain.com/en/latest/experimental_api_reference.html
f4202b77ede8-3
Classes¶ fallacy_removal.base.FallacyChain Chain for applying logical fallacy evaluations, modeled after Constitutional AI and in same format, but applying logical fallacies as generalized rules to remove in output fallacy_removal.models.LogicalFallacy Class for a logical fallacy. langchain_experimental.generat...
https://api.python.langchain.com/en/latest/experimental_api_reference.html
f4202b77ede8-4
Lazily import rellm. langchain_experimental.pal_chain¶ Implements Program-Aided Language Models. As in https://arxiv.org/pdf/2211.10435.pdf. This is vulnerable to arbitrary code execution: https://github.com/hwchase17/langchain/issues/5872 Classes¶ pal_chain.base.PALChain Implements Program-Aided Language Models (PAL)....
https://api.python.langchain.com/en/latest/experimental_api_reference.html
f4202b77ede8-5
Functions¶ langchain_experimental.retrievers¶ Classes¶ retrievers.vector_sql_database.VectorSQLDatabaseChainRetriever Retriever that uses SQLDatabase as Retriever langchain_experimental.smart_llm¶ Generalized implementation of SmartGPT (origin: https://youtu.be/wVzuvf9D9BU) Classes¶ smart_llm.base.SmartLLMChain General...
https://api.python.langchain.com/en/latest/experimental_api_reference.html
f4202b77ede8-6
tot.memory.ToTDFSMemory([stack]) Memory for the Tree of Thought (ToT) chain. tot.prompts.CheckerOutputParser Create a new model by parsing and validating input data from keyword arguments. tot.prompts.JSONListOutputParser Class to parse the output of a PROPOSE_PROMPT response. tot.thought.Thought Create a new model by ...
https://api.python.langchain.com/en/latest/experimental_api_reference.html
60fb9d8c4b1f-0
langchain.output_parsers.json.SimpleJsonOutputParser¶ class langchain.output_parsers.json.SimpleJsonOutputParser[source]¶ Bases: BaseCumulativeTransformOutputParser[Any] Parse the output of an LLM call to a JSON object. When used in streaming mode, it will yield partial JSON objects containing all the keys that have be...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.SimpleJsonOutputParser.html
60fb9d8c4b1f-1
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 to be parsed. The Generations are assumed to be different candidate outputs for ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.SimpleJsonOutputParser.html
60fb9d8c4b1f-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 of batch, which calls invoke N times. Subclasses should override this method if they can ba...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.SimpleJsonOutputParser.html
60fb9d8c4b1f-3
get_format_instructions() → str¶ Instructions on how the LLM output should be formatted. 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”, “openai”] invoke(input: Union[str, BaseMe...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.SimpleJsonOutputParser.html
60fb9d8c4b1f-4
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.SimpleJsonOutputParser.html
60fb9d8c4b1f-5
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[Union[str, BaseMessage]], config: Optional[Ru...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.SimpleJsonOutputParser.html
60fb9d8c4b1f-6
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: Type[pydantic.main.BaseModel]¶
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.SimpleJsonOutputParser.html
9074c8536556-0
langchain.output_parsers.retry.RetryWithErrorOutputParser¶ class langchain.output_parsers.retry.RetryWithErrorOutputParser[source]¶ Bases: BaseOutputParser[T] Wraps a parser and tries to fix parsing errors. Does this by passing the original prompt, the completion, AND the error that was raised to another language model...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.retry.RetryWithErrorOutputParser.html
9074c8536556-1
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 to be parsed. The Generations are assumed to be different candidate outputs for ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.retry.RetryWithErrorOutputParser.html
9074c8536556-2
Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can start producing output while input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.retry.RetryWithErrorOutputParser.html
9074c8536556-3
dict(**kwargs: Any) → Dict¶ Return dictionary representation of output parser. classmethod from_llm(llm: BaseLanguageModel, parser: BaseOutputParser[T], prompt: BasePromptTemplate = PromptTemplate(input_variables=['completion', 'error', 'prompt'], template='Prompt:\n{prompt}\nCompletion:\n{completion}\n\nAbove, the Com...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.retry.RetryWithErrorOutputParser.html
9074c8536556-4
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.retry.RetryWithErrorOutputParser.html
9074c8536556-5
parse_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 the highest-likelihood Generation. Parameters result – A list of Generations to be pars...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.retry.RetryWithErrorOutputParser.html
9074c8536556-6
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.retry.RetryWithErrorOutputParser.html
a87ff723af19-0
langchain.output_parsers.openai_functions.PydanticAttrOutputFunctionsParser¶ class langchain.output_parsers.openai_functions.PydanticAttrOutputFunctionsParser[source]¶ Bases: PydanticOutputFunctionsParser Parse an output as an attribute of a pydantic object. Create a new model by parsing and validating input data from ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.PydanticAttrOutputFunctionsParser.html
a87ff723af19-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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.PydanticAttrOutputFunctionsParser.html
a87ff723af19-2
Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can batch more efficiently. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Mode...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.PydanticAttrOutputFunctionsParser.html
a87ff723af19-3
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ 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 [“l...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.PydanticAttrOutputFunctionsParser.html
a87ff723af19-4
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ parse_result(result: List[Generation], *, partial: bool = False) → Any[source]¶ Parse a list of candidate model G...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.PydanticAttrOutputFunctionsParser.html
a87ff723af19-5
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.base.Runnable[~langchain.schema.runnable.utils.Input, ~langchain.schema.runnable.utils.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,)) →...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.PydanticAttrOutputFunctionsParser.html
8d5a2006ff02-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. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data c...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
8d5a2006ff02-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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
8d5a2006ff02-2
Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can batch more efficiently. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Mode...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
8d5a2006ff02-3
namespace is [“langchain”, “llms”, “openai”] invoke(input: Union[str, BaseMessage], config: Optional[RunnableConfig] = None) → T¶ classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
8d5a2006ff02-4
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ parse_result(result: List[Generation], *, partial: bool = False) → T¶ Parse a list of candidate model Generations...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
8d5a2006ff02-5
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
8d5a2006ff02-6
For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.boolean.BooleanOutputParser.html
2880e7c4a53c-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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.parse_and_check_json_markdown.html
b34889447182-0
langchain.output_parsers.fix.OutputFixingParser¶ class langchain.output_parsers.fix.OutputFixingParser[source]¶ Bases: BaseOutputParser[T] Wraps a parser and tries to fix parsing errors. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be pa...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.fix.OutputFixingParser.html
b34889447182-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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.fix.OutputFixingParser.html
b34889447182-2
Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can batch more efficiently. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Mode...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.fix.OutputFixingParser.html
b34889447182-3
dict(**kwargs: Any) → Dict¶ Return dictionary representation of output parser. classmethod from_llm(llm: BaseLanguageModel, parser: BaseOutputParser[T], prompt: BasePromptTemplate = PromptTemplate(input_variables=['completion', 'error', 'instructions'], template='Instructions:\n--------------\n{instructions}\n---------...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.fix.OutputFixingParser.html
b34889447182-4
classmethod is_lc_serializable() → bool[source]¶ 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, excl...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.fix.OutputFixingParser.html
b34889447182-5
parse_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 the highest-likelihood Generation. Parameters result – A list of Generations to be pars...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.fix.OutputFixingParser.html
b34889447182-6
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.fix.OutputFixingParser.html
384dbe653e4d-0
langchain.output_parsers.json.parse_partial_json¶ langchain.output_parsers.json.parse_partial_json(s: str, *, strict: bool = False) → Any[source]¶
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.parse_partial_json.html
7b35fcd2084e-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. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationEr...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
7b35fcd2084e-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, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
7b35fcd2084e-2
Bind arguments to a Runnable, returning a new Runnable. 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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
7b35fcd2084e-3
classmethod is_lc_serializable() → bool[source]¶ 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, excl...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
7b35fcd2084e-4
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 to be parsed. The Generations are assumed to be different candidate outputs for ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
7b35fcd2084e-5
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 Runnable, returning a new Runna...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.CommaSeparatedListOutputParser.html
994131573a2d-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
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.loading.load_output_parser.html
c733f00d07da-0
langchain.output_parsers.xml.XMLOutputParser¶ class langchain.output_parsers.xml.XMLOutputParser[source]¶ Bases: BaseOutputParser Parse an output using xml format. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a valid mo...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.xml.XMLOutputParser.html
c733f00d07da-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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.xml.XMLOutputParser.html
c733f00d07da-2
Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can batch more efficiently. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Mode...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.xml.XMLOutputParser.html
c733f00d07da-3
namespace is [“langchain”, “llms”, “openai”] invoke(input: Union[str, BaseMessage], config: Optional[RunnableConfig] = None) → T¶ classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.xml.XMLOutputParser.html
c733f00d07da-4
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ parse_result(result: List[Generation], *, partial: bool = False) → T¶ Parse a list of candidate model Generations...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.xml.XMLOutputParser.html
c733f00d07da-5
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.xml.XMLOutputParser.html
c733f00d07da-6
For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.xml.XMLOutputParser.html
808a1f536a97-0
langchain.output_parsers.json.parse_json_markdown¶ langchain.output_parsers.json.parse_json_markdown(json_string: str, *, parser: ~typing.Callable[[str], ~typing.Any] = <function loads>) → dict[source]¶ Parse a JSON string from a Markdown string. Parameters json_string – The Markdown string. Returns The parsed JSON obj...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.json.parse_json_markdown.html
3306a4810bcf-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. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be p...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
3306a4810bcf-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, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
3306a4810bcf-2
Bind arguments to a Runnable, returning a new Runnable. 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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
3306a4810bcf-3
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
3306a4810bcf-4
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 to be parsed. The Generations are assumed to be different candidate outputs for ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
3306a4810bcf-5
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 Runnable, returning a new Runna...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.list.ListOutputParser.html
a8cf767b740b-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. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
a8cf767b740b-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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
a8cf767b740b-2
Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can batch more efficiently. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Mode...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
a8cf767b740b-3
StructuredOutputParser, ResponseSchema ) response_schemas = [ ResponseSchema(name=”foo”, description=”a list of strings”, type=”List[string]” ), ResponseSchema(name=”bar”, description=”a string”, type=”string” ), ] parser = StructuredOutputParser.from_response_schemas(response_schemas) print(parser.get_format_instructi...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
a8cf767b740b-4
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 ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
a8cf767b740b-5
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
a8cf767b740b-6
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.base.Runnable[~langchain.schema.runnable.utils.Input, ~langchain.schema.runnable.utils.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,)) →...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.structured.StructuredOutputParser.html
77db55cc3f72-0
langchain.output_parsers.openai_functions.JsonKeyOutputFunctionsParser¶ class langchain.output_parsers.openai_functions.JsonKeyOutputFunctionsParser[source]¶ Bases: JsonOutputFunctionsParser Parse an output as the element of the Json object. Create a new model by parsing and validating input data from keyword arguments...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonKeyOutputFunctionsParser.html
77db55cc3f72-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 ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonKeyOutputFunctionsParser.html
77db55cc3f72-2
Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can start producing output while input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonKeyOutputFunctionsParser.html
77db55cc3f72-3
Return dictionary representation of output parser. classmethod from_orm(obj: Any) → Model¶ get_format_instructions() → str¶ Instructions on how the LLM output should be formatted. classmethod get_lc_namespace() → List[str]¶ Get the namespace of the langchain object. For example, if the class is langchain.llms.openai.Op...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonKeyOutputFunctionsParser.html
77db55cc3f72-4
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonKeyOutputFunctionsParser.html
77db55cc3f72-5
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[Union[str, BaseMessage]], config: Optional[Ru...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonKeyOutputFunctionsParser.html
77db55cc3f72-6
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: Type[pydantic.main.BaseModel]¶ Examples using JsonKeyOutputFunctionsParser¶ MultiVector Retriever prompt_...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonKeyOutputFunctionsParser.html
833b246acd8f-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. Create a new model by parsing and validating input data from keyword arguments. Rais...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
833b246acd8f-1
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 to be parsed. The Generations are assumed to be different candidate outputs for ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
833b246acd8f-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 of batch, which calls invoke N times. Subclasses should override this method if they can ba...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
833b246acd8f-3
get_format_instructions() → str¶ Instructions on how the LLM output should be formatted. 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”, “openai”] invoke(input: Union[str, BaseMe...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
833b246acd8f-4
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
833b246acd8f-5
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[Union[str, BaseMessage]], config: Optional[Ru...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
833b246acd8f-6
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: Type[pydantic.main.BaseModel]¶ Examples using JsonOutputFunctionsParser¶ prompt_llm_parser.md
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.openai_functions.JsonOutputFunctionsParser.html
6c1f755078db-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. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
6c1f755078db-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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
6c1f755078db-2
Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can batch more efficiently. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Mode...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
6c1f755078db-3
namespace is [“langchain”, “llms”, “openai”] invoke(input: Union[str, BaseMessage], config: Optional[RunnableConfig] = None) → T¶ classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
6c1f755078db-4
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ parse_result(result: List[Generation], *, partial: bool = False) → T¶ Parse a list of candidate model Generations...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
6c1f755078db-5
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
6c1f755078db-6
For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶ Examples using EnumOutputParser¶ Enum parser
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.enum.EnumOutputParser.html
bb7280933709-0
langchain.output_parsers.rail_parser.GuardrailsOutputParser¶ class langchain.output_parsers.rail_parser.GuardrailsOutputParser[source]¶ Bases: BaseOutputParser Parse the output of an LLM call using Guardrails. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.rail_parser.GuardrailsOutputParser.html
bb7280933709-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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.rail_parser.GuardrailsOutputParser.html
bb7280933709-2
Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can batch more efficiently. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Mode...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.rail_parser.GuardrailsOutputParser.html
bb7280933709-3
classmethod from_rail(rail_file: str, num_reasks: int = 1, api: Optional[Callable] = None, *args: Any, **kwargs: Any) → GuardrailsOutputParser[source]¶ Create a GuardrailsOutputParser from a rail file. Parameters rail_file – a rail file. num_reasks – number of times to re-ask the question. api – the API to use for the ...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.rail_parser.GuardrailsOutputParser.html
bb7280933709-4
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.rail_parser.GuardrailsOutputParser.html
bb7280933709-5
parse_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 the highest-likelihood Generation. Parameters result – A list of Generations to be pars...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.rail_parser.GuardrailsOutputParser.html
bb7280933709-6
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...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.rail_parser.GuardrailsOutputParser.html
130b2af82c32-0
langchain.output_parsers.regex_dict.RegexDictParser¶ class langchain.output_parsers.regex_dict.RegexDictParser[source]¶ Bases: BaseOutputParser Parse the output of an LLM call into a Dictionary using a regex. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the i...
https://api.python.langchain.com/en/latest/output_parsers/langchain.output_parsers.regex_dict.RegexDictParser.html