id
stringlengths
14
15
text
stringlengths
13
2.7k
source
stringlengths
60
181
866315fa3bb4-2
metadata – Optional metadata associated with the chain. Defaults to None include_run_info – Whether to include run info in the response. Defaults to False. Returns A dict of named outputs. Should contain all outputs specified inChain.output_keys. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, ...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-3
these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be passed in addition to tags passed to the chain during construction, but only these runtime tags will propagate to calls to other objects. metadata – Optional metadata associated with the ...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-4
Call the chain on all inputs in the list. async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶ Convenience method for executing chain. The main difference between this ...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-5
# -> "The temperature in Boise is..." 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 streaming output. async astream_log(input: Any, conf...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-6
exclude_types – Exclude logs with these types. exclude_tags – Exclude logs with these tags. 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 sho...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-7
Returns A pydantic model that can be used to validate config. configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', prefix_keys: bool = False, **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶ configurable_fields(**kwar...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-8
**kwargs – Keyword arguments passed to default pydantic.BaseModel.dict method. Returns A dictionary representation of the chain. Example chain.dict(exclude_unset=True) # -> {"_type": "foo", "verbose": False, ...} evaluate_string_pairs(*, prediction: str, prediction_b: str, reference: Optional[str] = None, input: Option...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-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...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-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 ...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-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:...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-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...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-13
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...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-14
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...
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
866315fa3bb4-15
List[str] property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model. property requires_input: bool¶ Whether this evaluator requires an input string. property requires_reference: bool¶ Whether this evaluator requires a reference label.
https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain.html
d942d101cc1e-0
langchain_experimental.tabular_synthetic_data.base.SyntheticDataGenerator¶ class langchain_experimental.tabular_synthetic_data.base.SyntheticDataGenerator[source]¶ Bases: BaseModel Generates synthetic data using the given LLM and few-shot template. Utilizes the provided LLM to produce synthetic data based on the few-sh...
https://api.python.langchain.com/en/latest/tabular_synthetic_data/langchain_experimental.tabular_synthetic_data.base.SyntheticDataGenerator.html
d942d101cc1e-1
the “extra” keyword argument. Parameters subject (str) – The subject the synthetic data will be about. runs (int) – Number of times to generate the data asynchronously. extra (str) – Extra instructions for steerability in data generation. Returns List of generated synthetic data for the given subject. Return type List[...
https://api.python.langchain.com/en/latest/tabular_synthetic_data/langchain_experimental.tabular_synthetic_data.base.SyntheticDataGenerator.html
d942d101cc1e-2
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...
https://api.python.langchain.com/en/latest/tabular_synthetic_data/langchain_experimental.tabular_synthetic_data.base.SyntheticDataGenerator.html
d942d101cc1e-3
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 parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol...
https://api.python.langchain.com/en/latest/tabular_synthetic_data/langchain_experimental.tabular_synthetic_data.base.SyntheticDataGenerator.html
9174be419cbd-0
langchain_experimental.tabular_synthetic_data.openai.create_openai_data_generator¶ langchain_experimental.tabular_synthetic_data.openai.create_openai_data_generator(output_schema: Union[Dict[str, Any], Type[BaseModel]], llm: ChatOpenAI, prompt: BasePromptTemplate, output_parser: Optional[BaseLLMOutputParser] = None, **...
https://api.python.langchain.com/en/latest/tabular_synthetic_data/langchain_experimental.tabular_synthetic_data.openai.create_openai_data_generator.html
b24a7f9a2d9e-0
langchain.agents.structured_chat.base.StructuredChatAgent¶ class langchain.agents.structured_chat.base.StructuredChatAgent[source]¶ Bases: Agent Structured Chat Agent. 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 vali...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.base.StructuredChatAgent.html
b24a7f9a2d9e-1
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.base.StructuredChatAgent.html
b24a7f9a2d9e-2
deep – set to True to make a deep copy of the model Returns new model instance classmethod create_prompt(tools: Sequence[BaseTool], prefix: str = 'Respond to the human as helpfully and accurately as possible. You have access to the following tools:', suffix: str = 'Begin! Reminder to ALWAYS respond with a valid json bl...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.base.StructuredChatAgent.html
b24a7f9a2d9e-3
dict(**kwargs: Any) → Dict¶ Return dictionary representation of agent. classmethod from_llm_and_tools(llm: BaseLanguageModel, tools: Sequence[BaseTool], callback_manager: Optional[BaseCallbackManager] = None, output_parser: Optional[AgentOutputParser] = None, prefix: str = 'Respond to the human as helpfully and accurat...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.base.StructuredChatAgent.html
b24a7f9a2d9e-4
Construct an agent from an LLM and tools. classmethod from_orm(obj: Any) → Model¶ get_allowed_tools() → Optional[List[str]]¶ get_full_inputs(intermediate_steps: List[Tuple[AgentAction, str]], **kwargs: Any) → Dict[str, Any]¶ Create the full inputs for the LLMChain from intermediate steps. json(*, include: Optional[Unio...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.base.StructuredChatAgent.html
b24a7f9a2d9e-5
Parameters intermediate_steps – Steps the LLM has taken to date, along with observations callbacks – Callbacks to run. **kwargs – User inputs. Returns Action specifying what tool to use. return_stopped_response(early_stopping_method: str, intermediate_steps: List[Tuple[AgentAction, str]], **kwargs: Any) → AgentFinish¶ ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.base.StructuredChatAgent.html
1f329e515e42-0
langchain.agents.react.output_parser.ReActOutputParser¶ class langchain.agents.react.output_parser.ReActOutputParser[source]¶ Bases: AgentOutputParser Output parser for the ReAct agent. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = F...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
1f329e515e42-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/agents/langchain.agents.react.output_parser.ReActOutputParser.html
1f329e515e42-2
exclude_names – Exclude logs with these names. exclude_types – Exclude logs with these types. exclude_tags – Exclude logs with these tags. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of atransform, which ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
1f329e515e42-3
configurable_fields(**kwargs: Union[ConfigurableField, ConfigurableFieldSingleOption, ConfigurableFieldMultiOption]) → RunnableSerializable[Input, Output]¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-vali...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
1f329e515e42-4
methods will have a dynamic input schema that depends on which configuration the runnable is invoked with. This method allows to get an input 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 input. classmethod get_...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
1f329e515e42-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
1f329e515e42-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
1f329e515e42-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
1f329e515e42-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
1f329e515e42-9
property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model.
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
2230ada3b63a-0
langchain.agents.conversational_chat.base.ConversationalChatAgent¶ class langchain.agents.conversational_chat.base.ConversationalChatAgent[source]¶ Bases: Agent An agent designed to hold a conversation in addition to using tools. Create a new model by parsing and validating input data from keyword arguments. Raises Val...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational_chat.base.ConversationalChatAgent.html
2230ada3b63a-1
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational_chat.base.ConversationalChatAgent.html
2230ada3b63a-2
deep – set to True to make a deep copy of the model Returns new model instance classmethod create_prompt(tools: Sequence[BaseTool], system_message: str = 'Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to p...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational_chat.base.ConversationalChatAgent.html
2230ada3b63a-3
Create a prompt for this class. dict(**kwargs: Any) → Dict¶ Return dictionary representation of agent.
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational_chat.base.ConversationalChatAgent.html
2230ada3b63a-4
classmethod from_llm_and_tools(llm: BaseLanguageModel, tools: Sequence[BaseTool], callback_manager: Optional[BaseCallbackManager] = None, output_parser: Optional[AgentOutputParser] = None, system_message: str = 'Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational_chat.base.ConversationalChatAgent.html
2230ada3b63a-5
Construct an agent from an LLM and tools. classmethod from_orm(obj: Any) → Model¶ get_allowed_tools() → Optional[List[str]]¶ get_full_inputs(intermediate_steps: List[Tuple[AgentAction, str]], **kwargs: Any) → Dict[str, Any]¶ Create the full inputs for the LLMChain from intermediate steps. json(*, include: Optional[Unio...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational_chat.base.ConversationalChatAgent.html
2230ada3b63a-6
Parameters intermediate_steps – Steps the LLM has taken to date, along with observations callbacks – Callbacks to run. **kwargs – User inputs. Returns Action specifying what tool to use. return_stopped_response(early_stopping_method: str, intermediate_steps: List[Tuple[AgentAction, str]], **kwargs: Any) → AgentFinish¶ ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational_chat.base.ConversationalChatAgent.html
dc6763873ca0-0
langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries¶ class langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries[source]¶ Bases: AgentOutputParser Output parser with retries for the structured chat agent. param base_parser: langchain.agents.agent.AgentOutp...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
dc6763873ca0-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/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
dc6763873ca0-2
with_streamed_output_list – Whether to yield the streamed_output list. include_names – Only include logs with these names. include_types – Only include logs with these types. include_tags – Only include logs with these tags. exclude_names – Exclude logs with these names. exclude_types – Exclude logs with these types. e...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
dc6763873ca0-3
Returns A pydantic model that can be used to validate config. configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', prefix_keys: bool = False, **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶ configurable_fields(**kwar...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
dc6763873ca0-4
dict(**kwargs: Any) → Dict¶ Return dictionary representation of output parser. classmethod from_llm(llm: Optional[BaseLanguageModel] = None, base_parser: Optional[StructuredChatOutputParser] = None) → StructuredChatOutputParserWithRetries[source]¶ classmethod from_orm(obj: Any) → Model¶ get_format_instructions() → str[...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
dc6763873ca0-5
Returns A pydantic model that can be used to validate output. invoke(input: Union[str, BaseMessage], config: Optional[RunnableConfig] = None) → T¶ 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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
dc6763873ca0-6
parse(text: str) → Union[AgentAction, AgentFinish][source]¶ Parse text into agent action/finish. 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 p...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
dc6763873ca0-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
dc6763873ca0-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
dc6763873ca0-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
5be1e515e2f6-0
langchain_core.agents.AgentFinish¶ class langchain_core.agents.AgentFinish[source]¶ Bases: Serializable The final return value of an ActionAgent. Override init to support instantiation by position for backward compat. param log: str [Required]¶ Additional information to log about the return value. This is used to pass ...
https://api.python.langchain.com/en/latest/agents/langchain_core.agents.AgentFinish.html
5be1e515e2f6-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...
https://api.python.langchain.com/en/latest/agents/langchain_core.agents.AgentFinish.html
5be1e515e2f6-2
The unique identifier is a list of strings that describes the path to the object. 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: Uni...
https://api.python.langchain.com/en/latest/agents/langchain_core.agents.AgentFinish.html
5be1e515e2f6-3
Custom multi-action agent Running Agent as an Iterator Custom agent Custom agent with tool retrieval
https://api.python.langchain.com/en/latest/agents/langchain_core.agents.AgentFinish.html
499009e4873b-0
langchain.agents.agent.ExceptionTool¶ class langchain.agents.agent.ExceptionTool[source]¶ Bases: BaseTool Tool that just returns the query. 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 model. param args_schema: ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
499009e4873b-1
param verbose: bool = False¶ Whether to log the tool’s progress. __call__(tool_input: str, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → str¶ Make tool callable. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_excep...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
499009e4873b-2
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
499009e4873b-3
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/agents/langchain.agents.agent.ExceptionTool.html
499009e4873b-4
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
499009e4873b-5
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
499009e4873b-6
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/agents/langchain.agents.agent.ExceptionTool.html
499009e4873b-7
stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ 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_implem...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
499009e4873b-8
Bind lifecycle listeners to a Runnable, returning a new Runnable. 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 ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
499009e4873b-9
property input_schema: Type[pydantic.main.BaseModel]¶ The type of input this runnable accepts specified as a pydantic model. property is_single_input: bool¶ Whether the tool only accepts a single input. property lc_attributes: Dict¶ List of attribute names that should be included in the serialized kwargs. These attribu...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
a4230ed3d583-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.
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.openai_tools.parse_ai_message_to_openai_tool_action.html
1c0708aa2523-0
langchain.agents.format_scratchpad.openai_functions.format_to_openai_function_messages¶ langchain.agents.format_scratchpad.openai_functions.format_to_openai_function_messages(intermediate_steps: Sequence[Tuple[AgentAction, str]]) → List[BaseMessage][source]¶ Convert (AgentAction, tool output) tuples into FunctionMessag...
https://api.python.langchain.com/en/latest/agents/langchain.agents.format_scratchpad.openai_functions.format_to_openai_function_messages.html
1cffafb0004a-0
langchain.agents.agent.RunnableMultiActionAgent¶ class langchain.agents.agent.RunnableMultiActionAgent[source]¶ Bases: BaseMultiActionAgent Agent powered by runnables. 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 vali...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.RunnableMultiActionAgent.html
1cffafb0004a-1
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.RunnableMultiActionAgent.html
1cffafb0004a-2
plan(intermediate_steps: List[Tuple[AgentAction, str]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Union[List[AgentAction], AgentFinish][source]¶ Given input, decided what to do. Parameters intermediate_steps – Steps the LLM has taken to date, along with the obse...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.RunnableMultiActionAgent.html
d98bed8ef4a1-0
langchain.agents.agent_toolkits.vectorstore.base.create_vectorstore_router_agent¶ langchain.agents.agent_toolkits.vectorstore.base.create_vectorstore_router_agent(llm: BaseLanguageModel, toolkit: VectorStoreRouterToolkit, callback_manager: Optional[BaseCallbackManager] = None, prefix: str = 'You are an agent designed t...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.vectorstore.base.create_vectorstore_router_agent.html
4a3715b61d60-0
langchain_experimental.agents.agent_toolkits.spark.base.create_spark_dataframe_agent¶ langchain_experimental.agents.agent_toolkits.spark.base.create_spark_dataframe_agent(llm: BaseLLM, df: Any, callback_manager: Optional[BaseCallbackManager] = None, prefix: str = '\nYou are working with a spark dataframe in Python. The...
https://api.python.langchain.com/en/latest/agents/langchain_experimental.agents.agent_toolkits.spark.base.create_spark_dataframe_agent.html
61a29e333554-0
langchain.agents.structured_chat.output_parser.StructuredChatOutputParser¶ class langchain.agents.structured_chat.output_parser.StructuredChatOutputParser[source]¶ Bases: AgentOutputParser Output parser for the structured chat agent. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[Runnable...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
61a29e333554-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/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
61a29e333554-2
exclude_names – Exclude logs with these names. exclude_types – Exclude logs with these types. exclude_tags – Exclude logs with these tags. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of atransform, which ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
61a29e333554-3
configurable_fields(**kwargs: Union[ConfigurableField, ConfigurableFieldSingleOption, ConfigurableFieldMultiOption]) → RunnableSerializable[Input, Output]¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-vali...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
61a29e333554-4
methods will have a dynamic input schema that depends on which configuration the runnable is invoked with. This method allows to get an input 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 input. classmethod get_...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
61a29e333554-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
61a29e333554-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
61a29e333554-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
61a29e333554-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
61a29e333554-9
property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model.
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
024ec6bc2657-0
langchain.agents.load_tools.load_tools¶ langchain.agents.load_tools.load_tools(tool_names: List[str], llm: Optional[BaseLanguageModel] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → List[BaseTool][source]¶ Load tools based on their name. Tools allow agents to...
https://api.python.langchain.com/en/latest/agents/langchain.agents.load_tools.load_tools.html
024ec6bc2657-1
ClearML Google Search Log, Trace, and Monitor Portkey Google Drive tool Bittensor Amazon API Gateway Debugging LangSmith Walkthrough Agents Agent Debates with Tools Multiple callback handlers Defining Custom Tools Human-in-the-loop Tool Validation Access intermediate steps Timeouts for agents Streaming final agent outp...
https://api.python.langchain.com/en/latest/agents/langchain.agents.load_tools.load_tools.html
7096c65b162c-0
langchain.agents.load_tools.get_all_tool_names¶ langchain.agents.load_tools.get_all_tool_names() → List[str][source]¶ Get a list of all possible tool names.
https://api.python.langchain.com/en/latest/agents/langchain.agents.load_tools.get_all_tool_names.html
66036e4033a3-0
langchain.agents.chat.base.ChatAgent¶ class langchain.agents.chat.base.ChatAgent[source]¶ Bases: Agent Chat Agent. 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 model. param allowed_tools: Optional[List[str]] = N...
https://api.python.langchain.com/en/latest/agents/langchain.agents.chat.base.ChatAgent.html
66036e4033a3-1
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.chat.base.ChatAgent.html
66036e4033a3-2
deep – set to True to make a deep copy of the model Returns new model instance classmethod create_prompt(tools: Sequence[BaseTool], system_message_prefix: str = 'Answer the following questions as best you can. You have access to the following tools:', system_message_suffix: str = 'Begin! Reminder to always use the exac...
https://api.python.langchain.com/en/latest/agents/langchain.agents.chat.base.ChatAgent.html
66036e4033a3-3
dict(**kwargs: Any) → Dict¶ Return dictionary representation of agent. classmethod from_llm_and_tools(llm: BaseLanguageModel, tools: Sequence[BaseTool], callback_manager: Optional[BaseCallbackManager] = None, output_parser: Optional[AgentOutputParser] = None, system_message_prefix: str = 'Answer the following questions...
https://api.python.langchain.com/en/latest/agents/langchain.agents.chat.base.ChatAgent.html
66036e4033a3-4
Construct an agent from an LLM and tools. classmethod from_orm(obj: Any) → Model¶ get_allowed_tools() → Optional[List[str]]¶ get_full_inputs(intermediate_steps: List[Tuple[AgentAction, str]], **kwargs: Any) → Dict[str, Any]¶ Create the full inputs for the LLMChain from intermediate steps. json(*, include: Optional[Unio...
https://api.python.langchain.com/en/latest/agents/langchain.agents.chat.base.ChatAgent.html
66036e4033a3-5
Parameters intermediate_steps – Steps the LLM has taken to date, along with observations callbacks – Callbacks to run. **kwargs – User inputs. Returns Action specifying what tool to use. return_stopped_response(early_stopping_method: str, intermediate_steps: List[Tuple[AgentAction, str]], **kwargs: Any) → AgentFinish¶ ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.chat.base.ChatAgent.html
94819dd95581-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
94819dd95581-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/agents/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
94819dd95581-2
Parameters input – The input to the runnable. config – The config to use for the runnable. diff – Whether to yield diffs between each step, or the current state. with_streamed_output_list – Whether to yield the streamed_output list. include_names – Only include logs with these names. include_types – Only include logs w...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
94819dd95581-3
Parameters include – A list of fields to include in the config schema. Returns A pydantic model that can be used to validate config. configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', prefix_keys: bool = False, **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Outpu...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
94819dd95581-4
classmethod from_orm(obj: Any) → Model¶ get_format_instructions() → str¶ 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_...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
94819dd95581-5
The config supports standard keys like ‘tags’, ‘metadata’ for tracing 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?...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
94819dd95581-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.json.JSONAgentOutputParser.html
94819dd95581-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.json.JSONAgentOutputParser.html