id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
1a5dc8f333a1-8
The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.output_parser.T]¶ The type of output this runnable produces specified as a type annotation. property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶ List configurable fields for ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational_chat.output_parser.ConvoOutputParser.html
0dd0302800ae-0
langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent¶ class langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent[source]¶ Bases: BaseSingleActionAgent An Agent driven by OpenAIs function powered API. Parameters llm – This should be an instance of ChatOpenAI, specifically a model that supports ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent.html
0dd0302800ae-1
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent.html
0dd0302800ae-2
Construct an agent from an LLM and tools. classmethod from_orm(obj: Any) → Model¶ get_allowed_tools() → List[str][source]¶ Get allowed tools. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_d...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent.html
0dd0302800ae-3
**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[source]¶ Return response when agent has been stopped due to max iterations. save(file_path: Union[Path, str]) → None¶ Sa...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent.html
002ed64dfe06-0
langchain.agents.agent.AgentOutputParser¶ class langchain.agents.agent.AgentOutputParser[source]¶ Bases: BaseOutputParser[Union[AgentAction, AgentFinish]] Base class for parsing agent output into agent action/finish. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None,...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
002ed64dfe06-1
to be different candidate outputs for a single model input. Returns Structured output. async astream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of astream, which calls ainvoke. Subclasses should override this method if they support str...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
002ed64dfe06-2
Default implementation runs invoke in parallel using a thread pool executor. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → R...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
002ed64dfe06-3
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
002ed64dfe06-4
methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate output. invoke(input:...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
002ed64dfe06-5
The unique identifier is a list of strings that describes the path to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. abstract parse(text: str) → Union[AgentAction, AgentFinish][source]¶ Parse text into ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
002ed64dfe06-6
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of stream, which calls invoke. Subclasses should override t...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
002ed64dfe06-7
fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶ Bind lifecycle listeners to a Runnable, returning a new Runnable. on_start: Called before the runnable starts running, with the Run ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
002ed64dfe06-8
The type of output this runnable produces specified as a type annotation. property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶ List configurable fields for this runnable. property input_schema: Type[pydantic.main.BaseModel]¶ The type of input this runnable accepts specified as a pydantic ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
bf9827ebddb1-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...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
bf9827ebddb1-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/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
bf9827ebddb1-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/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
bf9827ebddb1-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/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
bf9827ebddb1-4
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”, “openai”] get_output_schema(config: Optional[RunnableConfig] = None) ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
bf9827ebddb1-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/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
bf9827ebddb1-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/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
bf9827ebddb1-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/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
bf9827ebddb1-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/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
bf9827ebddb1-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/langchain.agents.structured_chat.output_parser.StructuredChatOutputParserWithRetries.html
89c47c511e23-0
langchain.agents.agent_iterator.AgentExecutorIterator¶ class langchain.agents.agent_iterator.AgentExecutorIterator(agent_executor: AgentExecutor, inputs: Any, callbacks: Callbacks = None, *, tags: Optional[list[str]] = None, include_run_info: bool = False, async_: bool = False)[source]¶ Iterator for AgentExecutor. Init...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_iterator.AgentExecutorIterator.html
89c47c511e23-1
raise_stopiteration(output: Any) → NoReturn[source]¶ Raise a StopIteration exception with the given output. reset() → None[source]¶ Reset the iterator to its initial state, clearing intermediate steps, iterations, and time elapsed. update_iterations() → None[source]¶ Increment the number of iterations and update the ti...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_iterator.AgentExecutorIterator.html
b225848ea780-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...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.vectorstore.base.create_vectorstore_router_agent.html
1289cf2f5ad1-0
langchain.agents.mrkl.base.ChainConfig¶ class langchain.agents.mrkl.base.ChainConfig(action_name: str, action: Callable, action_description: str)[source]¶ Configuration for chain to use in MRKL system. Parameters action_name – Name of the action. action – Action function to call. action_description – Description of the...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.mrkl.base.ChainConfig.html
a1c5cb58c55c-0
langchain.agents.agent_toolkits.openapi.toolkit.RequestsToolkit¶ class langchain.agents.agent_toolkits.openapi.toolkit.RequestsToolkit[source]¶ Bases: BaseToolkit Toolkit for making REST requests. Security Note: This toolkit contains tools to make GET, POST, PATCH, PUT,and DELETE requests to an API. Exercise care in wh...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.toolkit.RequestsToolkit.html
a1c5cb58c55c-1
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.toolkit.RequestsToolkit.html
a1c5cb58c55c-2
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¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.toolkit.RequestsToolkit.html
131e8842afa5-0
langchain.agents.agent_toolkits.amadeus.toolkit.AmadeusToolkit¶ class langchain.agents.agent_toolkits.amadeus.toolkit.AmadeusToolkit[source]¶ Bases: BaseToolkit Toolkit for interacting with Amadeus which offers APIs for travel search. Create a new model by parsing and validating input data from keyword arguments. Raise...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.amadeus.toolkit.AmadeusToolkit.html
131e8842afa5-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/agents/langchain.agents.agent_toolkits.amadeus.toolkit.AmadeusToolkit.html
131e8842afa5-2
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¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.amadeus.toolkit.AmadeusToolkit.html
ace7ce8b66bf-0
langchain.agents.react.base.ReActChain¶ class langchain.agents.react.base.ReActChain[source]¶ Bases: AgentExecutor [Deprecated] Chain that implements the ReAct paper. Initialize with the LLM and a docstore. param agent: Union[BaseSingleActionAgent, BaseMultiActionAgent] [Required]¶ The agent to run for creating a plan ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-1
param max_execution_time: Optional[float] = None¶ The maximum amount of wall clock time to spend in the execution loop. param max_iterations: Optional[int] = 15¶ The maximum number of steps to take before ending the execution loop. Setting to ‘None’ could lead to an infinite loop. param memory: Optional[BaseMemory] = N...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-2
param verbose: bool [Optional]¶ Whether or not run in verbose mode. In verbose mode, some intermediate logs will be printed to the console. Defaults to the global verbose value, accessible via langchain.globals.get_verbose(). __call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Opt...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-3
Returns A dict of named outputs. Should contain all outputs specified inChain.output_keys. async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶ Default implementation runs ainvoke in parallel ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-4
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 chain. Defaults to None include_run_info – Whether to include run info in the response. Defaults to False. Returns A dict of named outputs. Sho...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-5
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. **kwargs – If the chain expects multiple inputs, ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-6
Stream all output from a runnable, as reported to the callback system. 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...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-7
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/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-8
method. Returns A dictionary representation of the chain. Example chain.dict(exclude_unset=True) # -> {"_type": "foo", "verbose": False, ...} classmethod from_agent_and_tools(agent: Union[BaseSingleActionAgent, BaseMultiActionAgent], tools: Sequence[BaseTool], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCa...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-9
Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate output. invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Dict[str, Any]¶ Transform a single input into an output. Override to implement. Parameters input – The inp...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-10
A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. lookup_tool(name: str) → BaseTool¶ Lookup tool by name. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-11
Returns A dict of the final chain outputs. run(*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 method...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-12
save(file_path: Union[Path, str]) → None¶ Raise error - saving not supported for Agent Executors. save_agent(file_path: Union[Path, str]) → None¶ Save the underlying agent. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-13
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/langchain.agents.react.base.ReActChain.html
ace7ce8b66bf-14
Bind input and output types to a Runnable, returning a new Runnable. property InputType: Type[langchain.schema.runnable.utils.Input]¶ The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.runnable.utils.Output]¶ The type of output this runnable produces speci...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
cd74e287046f-0
langchain.agents.loading.load_agent_from_config¶ langchain.agents.loading.load_agent_from_config(config: dict, llm: Optional[BaseLanguageModel] = None, tools: Optional[List[Tool]] = None, **kwargs: Any) → Union[BaseSingleActionAgent, BaseMultiActionAgent][source]¶ Load agent from Config Dict. Parameters config – Config...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.loading.load_agent_from_config.html
ed7a7a610d24-0
langchain.agents.conversational.base.ConversationalAgent¶ class langchain.agents.conversational.base.ConversationalAgent[source]¶ Bases: Agent An agent that holds a conversation in addition to using tools. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the inpu...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
ed7a7a610d24-1
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
ed7a7a610d24-2
classmethod create_prompt(tools: Sequence[BaseTool], prefix: 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 providing in-depth explanations and discussions on a wide range of topics. As a language...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
ed7a7a610d24-3
say to the Human, or if you do not need to use a tool, you MUST use the format:\n\n```\nThought: Do I need to use a tool? No\n{ai_prefix}: [your response here]\n```', ai_prefix: str = 'AI', human_prefix: str = 'Human', input_variables: Optional[List[str]] = None) → PromptTemplate[source]¶
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
ed7a7a610d24-4
Create prompt in the style of the zero-shot agent. Parameters tools – List of tools the agent will have access to, used to format the prompt. prefix – String to put before the list of tools. suffix – String to put after the list of tools. ai_prefix – String to use before AI output. human_prefix – String to use before h...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
ed7a7a610d24-5
classmethod from_llm_and_tools(llm: BaseLanguageModel, tools: Sequence[BaseTool], callback_manager: Optional[BaseCallbackManager] = None, output_parser: Optional[AgentOutputParser] = None, prefix: str = 'Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide ran...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
ed7a7a610d24-6
Input: the input to the action\nObservation: the result of the action\n```\n\nWhen you have a response to say to the Human, or if you do not need to use a tool, you MUST use the format:\n\n```\nThought: Do I need to use a tool? No\n{ai_prefix}: [your response here]\n```', ai_prefix: str = 'AI', human_prefix: str = 'Hum...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
ed7a7a610d24-7
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...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
ed7a7a610d24-8
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¶ ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
c1537e294c64-0
langchain.agents.format_scratchpad.log_to_messages.format_log_to_messages¶ langchain.agents.format_scratchpad.log_to_messages.format_log_to_messages(intermediate_steps: List[Tuple[AgentAction, str]], template_tool_response: str = '{observation}') → List[BaseMessage][source]¶ Construct the scratchpad that lets the agent...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.format_scratchpad.log_to_messages.format_log_to_messages.html
ee82e16ebdb0-0
langchain.agents.agent.RunnableAgent¶ class langchain.agents.agent.RunnableAgent[source]¶ Bases: BaseSingleActionAgent 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 valid model. param runnab...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.RunnableAgent.html
ee82e16ebdb0-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...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.RunnableAgent.html
ee82e16ebdb0-2
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¶ plan(intermediate_steps: List[Tuple[AgentAction, str]], callbacks: Optional[Union[List[BaseCallbackHandler], Base...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.RunnableAgent.html
ee82e16ebdb0-3
property input_keys: List[str]¶ Return the input keys. Returns List of input keys. property return_values: List[str]¶ Return values of the agent.
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.RunnableAgent.html
b99c98e51a5b-0
langchain.agents.agent_toolkits.gmail.toolkit.GmailToolkit¶ class langchain.agents.agent_toolkits.gmail.toolkit.GmailToolkit[source]¶ Bases: BaseToolkit Toolkit for interacting with Gmail. Security Note: This toolkit contains tools that can read and modifythe state of a service; e.g., by reading, creating, updating, de...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.gmail.toolkit.GmailToolkit.html
b99c98e51a5b-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/agents/langchain.agents.agent_toolkits.gmail.toolkit.GmailToolkit.html
b99c98e51a5b-2
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¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.gmail.toolkit.GmailToolkit.html
1214e23a0687-0
langchain.agents.agent_toolkits.openapi.spec.reduce_openapi_spec¶ langchain.agents.agent_toolkits.openapi.spec.reduce_openapi_spec(spec: dict, dereference: bool = True) → ReducedOpenAPISpec[source]¶ Simplify/distill/minify a spec somehow. I want a smaller target for retrieval and (more importantly) I want smaller resul...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.spec.reduce_openapi_spec.html
a5c16fdcf8dd-0
langchain.agents.agent_toolkits.base.BaseToolkit¶ class langchain.agents.agent_toolkits.base.BaseToolkit[source]¶ Bases: BaseModel, ABC Base Toolkit representing a collection of related tools. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.base.BaseToolkit.html
a5c16fdcf8dd-1
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ abstract get_tools() → List[BaseTool][source]¶ Get the tools in the toolkit. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optiona...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.base.BaseToolkit.html
a5c16fdcf8dd-2
Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.base.BaseToolkit.html
acebb795810e-0
langchain.agents.agent_iterator.rebuild_callback_manager_on_set¶ langchain.agents.agent_iterator.rebuild_callback_manager_on_set(setter_method: Callable[[...], None]) → Callable[[...], None][source]¶ Decorator to force setters to rebuild callback mgr
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_iterator.rebuild_callback_manager_on_set.html
2c8d4fc63d80-0
langchain.agents.agent_toolkits.playwright.toolkit.PlayWrightBrowserToolkit¶ class langchain.agents.agent_toolkits.playwright.toolkit.PlayWrightBrowserToolkit[source]¶ Bases: BaseToolkit Toolkit for PlayWright browser tools. Security Note: This toolkit provides code to control a web-browser. Careful if exposing this to...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.playwright.toolkit.PlayWrightBrowserToolkit.html
2c8d4fc63d80-1
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.playwright.toolkit.PlayWrightBrowserToolkit.html
2c8d4fc63d80-2
Get the tools in the toolkit. 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_defaults: bool = False, exclude_none: bool ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.playwright.toolkit.PlayWrightBrowserToolkit.html
a0be5d393eb2-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...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.format_scratchpad.openai_functions.format_to_openai_function_messages.html
95de9e9c498d-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: ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
95de9e9c498d-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...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
95de9e9c498d-2
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
95de9e9c498d-3
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
95de9e9c498d-4
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
95de9e9c498d-5
Returns A pydantic model that can be used to validate output. invoke(input: Union[str, Dict], config: Optional[RunnableConfig] = None, **kwargs: Any) → Any¶ 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. ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
95de9e9c498d-6
by calling invoke() with each input. 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[str, bytes], *, content_type: unicode = No...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
95de9e9c498d-7
Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated. classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and lo...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
95de9e9c498d-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/langchain.agents.agent.ExceptionTool.html
95de9e9c498d-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/langchain.agents.agent.ExceptionTool.html
183b16db1561-0
langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain¶ class langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain[source]¶ Bases: AgentExecutor [Deprecated] Chain that does self-ask with search. Initialize only with an LLM and a search chain. param agent: Union[BaseSingleActionAgent, BaseMultiA...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-1
If a callable function, the function will be called with the exception as an argument, and the result of that function will be passed to the agentas an observation. param max_execution_time: Optional[float] = None¶ The maximum amount of wall clock time to spend in the execution loop. param max_iterations: Optional[int]...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-2
The valid tools the agent can call. param trim_intermediate_steps: Union[int, Callable[[List[Tuple[AgentAction, str]]], List[Tuple[AgentAction, str]]]] = -1¶ param verbose: bool [Optional]¶ Whether or not run in verbose mode. In verbose mode, some intermediate logs will be printed to the console. Defaults to the global...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-3
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, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwar...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-4
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 chain. Defaults to None include_run_info – Whether to include run ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-5
addition to callbacks passed to the chain during construction, but only 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 c...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-6
Stream all output from a runnable, as reported to the callback system. 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...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-7
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/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-8
method. Returns A dictionary representation of the chain. Example chain.dict(exclude_unset=True) # -> {"_type": "foo", "verbose": False, ...} classmethod from_agent_and_tools(agent: Union[BaseSingleActionAgent, BaseMultiActionAgent], tools: Sequence[BaseTool], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCa...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-9
Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate output. invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Dict[str, Any]¶ Transform a single input into an output. Override to implement. Parameters input – The inp...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-10
A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. lookup_tool(name: str) → BaseTool¶ Lookup tool by name. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-11
Returns A dict of the final chain outputs. run(*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 method...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-12
save(file_path: Union[Path, str]) → None¶ Raise error - saving not supported for Agent Executors. save_agent(file_path: Union[Path, str]) → None¶ Save the underlying agent. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool ...
lang/api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
183b16db1561-13
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/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html