id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
6bfcced260ee-9
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/rl_chain/langchain_experimental.rl_chain.base.RLChain.html
6bfcced260ee-10
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/rl_chain/langchain_experimental.rl_chain.base.RLChain.html
6bfcced260ee-11
memory. outputs – Dictionary of initial chain outputs. return_only_outputs – Whether to only return the chain outputs. If False, inputs are also added to the final outputs. Returns A dict of the final chain outputs. run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags:...
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.RLChain.html
6bfcced260ee-12
context = "Weather report for Boise, Idaho on 07/03/23..." chain.run(question=question, context=context) # -> "The temperature in Boise is..." save(file_path: Union[Path, str]) → None¶ Save the chain. Expects Chain._chain_type property to be implemented and for memory to benull. Parameters file_path – Path to file to s...
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.RLChain.html
6bfcced260ee-13
Updates the learned policy with the score provided. Will raise an error if selection_scorer is set, and force_score=True was not provided during the method call classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a Runna...
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.RLChain.html
6bfcced260ee-14
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/rl_chain/langchain_experimental.rl_chain.base.RLChain.html
6bfcced260ee-15
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/rl_chain/langchain_experimental.rl_chain.base.RLChain.html
1b186a0339cb-0
langchain_experimental.rl_chain.base.EmbedAndKeep¶ langchain_experimental.rl_chain.base.EmbedAndKeep(anything: Any) → Any[source]¶
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.EmbedAndKeep.html
1d5ca4a23516-0
langchain_experimental.rl_chain.base.embed¶ langchain_experimental.rl_chain.base.embed(to_embed: Union[str, _Embed, Dict, List[Union[str, _Embed]], List[Dict]], model: Any, namespace: Optional[str] = None) → List[Dict[str, Union[str, List[str]]]][source]¶ Embeds the actions or context using the SentenceTransformer mode...
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.embed.html
04257fc99cad-0
langchain_experimental.rl_chain.base.Event¶ class langchain_experimental.rl_chain.base.Event(inputs: Dict[str, Any], selected: Optional[TSelected] = None)[source]¶ Attributes inputs selected Methods __init__(inputs[, selected]) __init__(inputs: Dict[str, Any], selected: Optional[TSelected] = None)[source]¶
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.Event.html
11ad6015ca22-0
langchain_experimental.rl_chain.base.embed_string_type¶ langchain_experimental.rl_chain.base.embed_string_type(item: Union[str, _Embed], model: Any, namespace: Optional[str] = None) → Dict[str, Union[str, List[str]]][source]¶ Helper function to embed a string or an _Embed object.
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.embed_string_type.html
a79f4e0f21c0-0
langchain_experimental.rl_chain.base.SelectionScorer¶ class langchain_experimental.rl_chain.base.SelectionScorer[source]¶ Bases: Generic[TEvent], ABC, BaseModel Abstract method to grade the chosen selection or the response of the llm Create a new model by parsing and validating input data from keyword arguments. Raises...
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.SelectionScorer.html
a79f4e0f21c0-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, 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, ex...
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.SelectionScorer.html
a79f4e0f21c0-2
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¶ abstract score_response(inputs: Dict[str, Any], llm_response: str, event: TEvent) → ...
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.SelectionScorer.html
1f857a3736a1-0
langchain_experimental.rl_chain.base.Embedder¶ class langchain_experimental.rl_chain.base.Embedder(*args: Any, **kwargs: Any)[source]¶ Methods __init__(*args, **kwargs) format(event) __init__(*args: Any, **kwargs: Any)[source]¶ abstract format(event: TEvent) → str[source]¶
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.Embedder.html
2ee58f334796-0
langchain_experimental.rl_chain.pick_best_chain.PickBestEvent¶ class langchain_experimental.rl_chain.pick_best_chain.PickBestEvent(inputs: Dict[str, Any], to_select_from: Dict[str, Any], based_on: Dict[str, Any], selected: Optional[PickBestSelected] = None)[source]¶ Attributes Methods __init__(inputs, to_select_from, b...
lang/api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBestEvent.html
8f43f39ee656-0
langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier¶ class langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier[source]¶ Bases: BaseTool Tool that uses deberta-v3-base-injection to detect prompt injection attacks....
lang/api.python.langchain.com/en/latest/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
8f43f39ee656-1
param return_direct: bool = False¶ Whether to return the tool’s output directly. Setting this to True means that after the tool is called, the AgentExecutor will stop looping. param tags: Optional[List[str]] = None¶ Optional list of tags associated with the tool. Defaults to None These tags will be associated with each...
lang/api.python.langchain.com/en/latest/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
8f43f39ee656-2
Subclasses should override this method if they can run asynchronously. async arun(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[...
lang/api.python.langchain.com/en/latest/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
8f43f39ee656-3
The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if th...
lang/api.python.langchain.com/en/latest/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
8f43f39ee656-4
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/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
8f43f39ee656-5
Get the namespace of the langchain object. 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 th...
lang/api.python.langchain.com/en/latest/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
8f43f39ee656-6
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/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
8f43f39ee656-7
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[st...
lang/api.python.langchain.com/en/latest/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
8f43f39ee656-8
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'Exception'>,)) → RunnableWithFallbacksT[Input, Output]¶ Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A se...
lang/api.python.langchain.com/en/latest/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
8f43f39ee656-9
between retries stop_after_attempt – The maximum number of attempts to make before giving up Returns A new Runnable that retries the original runnable on exceptions. with_types(*, input_type: Optional[Type[Input]] = None, output_type: Optional[Type[Output]] = None) → Runnable[Input, Output]¶ Bind input and output types...
lang/api.python.langchain.com/en/latest/prompt_injection_identifier/langchain_experimental.prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier.html
d735943224a0-0
langchain.agents.output_parsers.self_ask.SelfAskOutputParser¶ class langchain.agents.output_parsers.self_ask.SelfAskOutputParser[source]¶ Bases: AgentOutputParser Parses self-ask style LLM calls. Expects output to be in one of two formats. If the output signals that an action should be taken, should be in the below for...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
d735943224a0-1
Subclasses should override this method if they can run asynchronously. async aparse(text: str) → T¶ Parse a single string model output into some structure. Parameters text – String output of a language model. Returns Structured output. async aparse_result(result: List[Generation], *, partial: bool = False) → T¶ Parse a...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
d735943224a0-2
step, and the final state of the run. The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of atransform, which buffers input and calls astream. Subcla...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
d735943224a0-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/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
d735943224a0-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/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
d735943224a0-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/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
d735943224a0-6
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...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
d735943224a0-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/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
d735943224a0-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/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
d735943224a0-9
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/agents.output_parsers/langchain.agents.output_parsers.self_ask.SelfAskOutputParser.html
6afc2b6322b9-0
langchain.agents.output_parsers.openai_tools.OpenAIToolAgentAction¶ class langchain.agents.output_parsers.openai_tools.OpenAIToolAgentAction[source]¶ Bases: AgentActionMessageLog Override init to support instantiation by position for backward compat. param log: str [Required]¶ Additional information to log about the ac...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolAgentAction.html
6afc2b6322b9-1
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 copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolAgentAction.html
6afc2b6322b9-2
classmethod is_lc_serializable() → bool¶ Return whether or not the class is 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 ...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolAgentAction.html
6afc2b6322b9-3
to_json_not_implemented() → SerializedNotImplemented¶ 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¶ property lc_attributes: Dict¶ List of attribute names that should be included in the seri...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolAgentAction.html
40559f6609f4-0
langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser¶ class langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser[source]¶ Bases: AgentOutputParser Parses a message into agent action/finish. Is meant to be used with OpenAI models, as it relies on the specific fun...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser.html
40559f6609f4-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 ...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser.html
40559f6609f4-2
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, **kwargs: Optional[Any]) → List[Output]¶ Default implementation runs invoke...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser.html
40559f6609f4-3
Default values are respected, but no other validation is performed. 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...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser.html
40559f6609f4-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/agents.output_parsers/langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser.html
40559f6609f4-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/agents.output_parsers/langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser.html
40559f6609f4-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/agents.output_parsers/langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser.html
40559f6609f4-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/agents.output_parsers/langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser.html
40559f6609f4-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/agents.output_parsers/langchain.agents.output_parsers.openai_functions.OpenAIFunctionsAgentOutputParser.html
f1f08eb2c0c8-0
langchain.agents.output_parsers.json.JSONAgentOutputParser¶ class langchain.agents.output_parsers.json.JSONAgentOutputParser[source]¶ Bases: AgentOutputParser Parses tool invocations and final answers in JSON format. Expects output to be in one of two formats. If the output signals that an action should be taken, shoul...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f1f08eb2c0c8-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/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f1f08eb2c0c8-2
The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if th...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f1f08eb2c0c8-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/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f1f08eb2c0c8-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/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f1f08eb2c0c8-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/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f1f08eb2c0c8-6
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...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f1f08eb2c0c8-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/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f1f08eb2c0c8-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/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f1f08eb2c0c8-9
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/agents.output_parsers/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
f3ad796ad9ca-0
langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser¶ class langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser[source]¶ Bases: AgentOutputParser Parses ReAct-style LLM calls that have a single tool input. Expects output to be in one of two formats. If the output s...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
f3ad796ad9ca-1
Parse a single string model output into some structure. 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 th...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
f3ad796ad9ca-2
The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if th...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
f3ad796ad9ca-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/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
f3ad796ad9ca-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/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
f3ad796ad9ca-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/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
f3ad796ad9ca-6
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...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
f3ad796ad9ca-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/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
f3ad796ad9ca-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/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
f3ad796ad9ca-9
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/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
3339f048648b-0
langchain.agents.output_parsers.openai_tools.parse_ai_message_to_openai_tool_action¶ langchain.agents.output_parsers.openai_tools.parse_ai_message_to_openai_tool_action(message: BaseMessage) → Union[List[AgentAction], AgentFinish][source]¶ Parse an AI message potentially containing tool_calls.
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_tools.parse_ai_message_to_openai_tool_action.html
fed50b40666d-0
langchain.agents.output_parsers.xml.XMLAgentOutputParser¶ class langchain.agents.output_parsers.xml.XMLAgentOutputParser[source]¶ Bases: AgentOutputParser Parses tool invocations and final answers in XML format. Expects output to be in one of two formats. If the output signals that an action should be taken, should be ...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
fed50b40666d-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/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
fed50b40666d-2
The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if th...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
fed50b40666d-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/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
fed50b40666d-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/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
fed50b40666d-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/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
fed50b40666d-6
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...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
fed50b40666d-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/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
fed50b40666d-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/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
fed50b40666d-9
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/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html
db4536a520c5-0
langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser¶ class langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser[source]¶ Bases: MultiActionAgentOutputParser Parses a message into agent actions/finish. Is meant to be used with OpenAI models, as it relies on the specific tool_ca...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html
db4536a520c5-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 ...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html
db4536a520c5-2
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, **kwargs: Optional[Any]) → List[Output]¶ Default implementation runs invoke...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html
db4536a520c5-3
Default values are respected, but no other validation is performed. 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...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html
db4536a520c5-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/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html
db4536a520c5-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/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html
db4536a520c5-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/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html
db4536a520c5-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/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html
db4536a520c5-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/agents.output_parsers/langchain.agents.output_parsers.openai_tools.OpenAIToolsAgentOutputParser.html
b318815982c0-0
langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser¶ class langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser[source]¶ Bases: AgentOutputParser Parses ReAct-style LLM calls that have a single tool input in json format. Expects output to be in on...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
b318815982c0-1
Default implementation of ainvoke, calls invoke from a thread. The default implementation allows usage of async code even if the runnable did not implement a native async version of invoke. Subclasses should override this method if they can run asynchronously. async aparse(text: str) → T¶ Parse a single string model ou...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
b318815982c0-2
This includes all inner runs of LLMs, Retrievers, Tools, etc. Output is streamed as Log objects, which include a list of jsonpatch ops that describe how the state of the run has changed in each step, and the final state of the run. The jsonpatch ops can be applied in order to construct state. async atransform(input: As...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
b318815982c0-3
Returns A pydantic model that can be used to validate config. configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶ configurable_fields(**kwargs: Union[ConfigurableField, C...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
b318815982c0-4
Instructions on how the LLM output should be formatted. get_input_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to validate input to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic input sc...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
b318815982c0-5
purposes, ‘max_concurrency’ for controlling how much work to do in parallel, and other keys. Please refer to the RunnableConfig for more details. Returns The output of the runnable. classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]]...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
b318815982c0-6
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...
lang/api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
b318815982c0-7
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/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
b318815982c0-8
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/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
b318815982c0-9
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/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
d77c10d6ec3d-0
langchain.schema.callbacks.manager.trace_as_chain_group¶ langchain.schema.callbacks.manager.trace_as_chain_group(group_name: str, callback_manager: Optional[CallbackManager] = None, *, inputs: Optional[Dict[str, Any]] = None, project_name: Optional[str] = None, example_id: Optional[Union[str, UUID]] = None, run_id: Opt...
lang/api.python.langchain.com/en/latest/schema/langchain.schema.callbacks.manager.trace_as_chain_group.html