id
stringlengths
14
15
text
stringlengths
44
2.47k
source
stringlengths
61
181
7a947c6d9114-10
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, they can be passed in directly as keyword arguments. Returns The chain output. Example # Suppose we have a single-input chain that takes a 'que...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
7a947c6d9114-11
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
39c6b575ef83-0
langchain.agents.agent_toolkits.spark_sql.base.create_spark_sql_agent¶
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.spark_sql.base.create_spark_sql_agent.html
39c6b575ef83-1
langchain.agents.agent_toolkits.spark_sql.base.create_spark_sql_agent(llm: BaseLanguageModel, toolkit: SparkSQLToolkit, callback_manager: Optional[BaseCallbackManager] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, prefix: str = 'You are an agent designed to interact with Spa...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.spark_sql.base.create_spark_sql_agent.html
39c6b575ef83-2
Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can repeat N times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question', input_variables: Optional[List[str]] = None, top_k: int = 10, max_iterations...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.spark_sql.base.create_spark_sql_agent.html
39c6b575ef83-3
Construct a Spark SQL agent from an LLM and tools. Examples using create_spark_sql_agent¶ Spark SQL
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.spark_sql.base.create_spark_sql_agent.html
c20e7bdcbce3-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.spec.reduce_openapi_spec.html
7c761d819517-0
langchain.agents.agent_toolkits.nla.toolkit.NLAToolkit¶ class langchain.agents.agent_toolkits.nla.toolkit.NLAToolkit[source]¶ Bases: BaseToolkit Natural Language API Toolkit. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.nla.toolkit.NLAToolkit.html
7c761d819517-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.agents.agent_toolkits.nla.toolkit.NLAToolkit.html
7c761d819517-2
Get the tools for all the API operations. 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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.nla.toolkit.NLAToolkit.html
b33d391963c8-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
b33d391963c8-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
b33d391963c8-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
b33d391963c8-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]¶
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
b33d391963c8-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
b33d391963c8-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
b33d391963c8-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
b33d391963c8-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
b33d391963c8-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¶ ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.base.ConversationalAgent.html
c7dcd30d6c73-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
c7dcd30d6c73-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
c7dcd30d6c73-2
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
c7dcd30d6c73-3
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
c7dcd30d6c73-4
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 = False, encoder: Optional[Cal...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
c7dcd30d6c73-5
Run the tool. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
c7dcd30d6c73-6
property InputType: Type[langchain.schema.runnable.utils.Input]¶ property OutputType: Type[langchain.schema.runnable.utils.Output]¶ property args: dict¶ property input_schema: Type[pydantic.main.BaseModel]¶ The tool’s input schema. property is_single_input: bool¶ Whether the tool only accepts a single input. property o...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.ExceptionTool.html
c2438d10bc12-0
langchain.agents.agent_toolkits.sql.base.create_sql_agent¶
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.sql.base.create_sql_agent.html
c2438d10bc12-1
langchain.agents.agent_toolkits.sql.base.create_sql_agent(llm: BaseLanguageModel, toolkit: SQLDatabaseToolkit, agent_type: AgentType = AgentType.ZERO_SHOT_REACT_DESCRIPTION, callback_manager: Optional[BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with a SQL database.\nGiven an input ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.sql.base.create_sql_agent.html
c2438d10bc12-2
I now know the final answer\nFinal Answer: the final answer to the original input question', input_variables: Optional[List[str]] = None, top_k: int = 10, max_iterations: Optional[int] = 15, max_execution_time: Optional[float] = None, early_stopping_method: str = 'force', verbose: bool = False, agent_executor_kwargs: O...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.sql.base.create_sql_agent.html
c2438d10bc12-3
Construct an SQL agent from an LLM and tools. Examples using create_sql_agent¶ CnosDB SQL Database Set env var OPENAI_API_KEY or load from a .env file SQL
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.sql.base.create_sql_agent.html
ca3fa8448587-0
langchain.agents.agent_toolkits.openapi.planner.create_openapi_agent¶ langchain.agents.agent_toolkits.openapi.planner.create_openapi_agent(api_spec: ReducedOpenAPISpec, requests_wrapper: TextRequestsWrapper, llm: BaseLanguageModel, shared_memory: Optional[ReadOnlySharedMemory] = None, callback_manager: Optional[BaseCal...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.planner.create_openapi_agent.html
f1524b766eb4-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
f1524b766eb4-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
f1524b766eb4-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
f1524b766eb4-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
f1524b766eb4-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
f1524b766eb4-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
adaa93b87cd8-0
langchain.agents.agent_toolkits.python.base.create_python_agent¶ langchain.agents.agent_toolkits.python.base.create_python_agent(llm: BaseLanguageModel, tool: PythonREPLTool, agent_type: AgentType = AgentType.ZERO_SHOT_REACT_DESCRIPTION, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = False, pre...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.python.base.create_python_agent.html
0fd02aefe4e6-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
0fd02aefe4e6-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
0fd02aefe4e6-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
0fd02aefe4e6-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
0fd02aefe4e6-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
0fd02aefe4e6-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
19f7deebc63d-0
langchain.agents.agent_toolkits.openapi.spec.ReducedOpenAPISpec¶ class langchain.agents.agent_toolkits.openapi.spec.ReducedOpenAPISpec(servers: List[dict], description: str, endpoints: List[Tuple[str, str, dict]])[source]¶ A reduced OpenAPI spec. This is a quick and dirty representation for OpenAPI specs. servers¶ The ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.spec.ReducedOpenAPISpec.html
e472a39608e0-0
langchain.agents.loading.load_agent¶ langchain.agents.loading.load_agent(path: Union[str, Path], **kwargs: Any) → Union[BaseSingleActionAgent, BaseMultiActionAgent][source]¶ Unified method for loading an agent from LangChainHub or local fs. Parameters path – Path to the agent file. **kwargs – Additional key word argume...
https://api.python.langchain.com/en/latest/agents/langchain.agents.loading.load_agent.html
71105f501384-0
langchain.agents.agent_iterator.BaseAgentExecutorIterator¶ class langchain.agents.agent_iterator.BaseAgentExecutorIterator[source]¶ Base class for AgentExecutorIterator. Methods __init__() build_callback_manager() __init__()¶ abstract build_callback_manager() → None[source]¶
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_iterator.BaseAgentExecutorIterator.html
cd7bdec84ed5-0
langchain.agents.openai_functions_agent.agent_token_buffer_memory.AgentTokenBufferMemory¶ class langchain.agents.openai_functions_agent.agent_token_buffer_memory.AgentTokenBufferMemory[source]¶ Bases: BaseChatMemory Memory used to save agent output AND intermediate steps. Create a new model by parsing and validating in...
https://api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.agent_token_buffer_memory.AgentTokenBufferMemory.html
cd7bdec84ed5-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.agent_token_buffer_memory.AgentTokenBufferMemory.html
cd7bdec84ed5-2
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.openai_functions_agent.agent_token_buffer_memory.AgentTokenBufferMemory.html
cd7bdec84ed5-3
String buffer of memory. 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”} ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.agent_token_buffer_memory.AgentTokenBufferMemory.html
074f4cd8beb0-0
langchain.agents.react.output_parser.ReActOutputParser¶ class langchain.agents.react.output_parser.ReActOutputParser[source]¶ Bases: AgentOutputParser Output parser for the ReAct agent. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be par...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
074f4cd8beb0-1
Default implementation of astream, which calls ainvoke. Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
074f4cd8beb0-2
Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
074f4cd8beb0-3
classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.output_parser.ReActOutputParser.html
074f4cd8beb0-4
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
074f4cd8beb0-5
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
0375b6e51e7f-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
0375b6e51e7f-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
0375b6e51e7f-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
0375b6e51e7f-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
0375b6e51e7f-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
0375b6e51e7f-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
0375b6e51e7f-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
2e568774e36e-0
langchain.agents.conversational.output_parser.ConvoOutputParser¶ class langchain.agents.conversational.output_parser.ConvoOutputParser[source]¶ Bases: AgentOutputParser Output parser for the conversational agent. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if t...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.output_parser.ConvoOutputParser.html
2e568774e36e-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.conversational.output_parser.ConvoOutputParser.html
2e568774e36e-2
Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can batch more efficiently. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Mode...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.output_parser.ConvoOutputParser.html
2e568774e36e-3
namespace is [“langchain”, “llms”, “openai”] invoke(input: Union[str, BaseMessage], config: Optional[RunnableConfig] = None) → T¶ classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.output_parser.ConvoOutputParser.html
2e568774e36e-4
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ parse_result(result: List[Generation], *, partial: bool = False) → T¶ Parse a list of candidate model Generations...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.output_parser.ConvoOutputParser.html
2e568774e36e-5
to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.output_parser.ConvoOutputParser.html
2e568774e36e-6
For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational.output_parser.ConvoOutputParser.html
a8d9b23a98d2-0
langchain.agents.agent_toolkits.json.toolkit.JsonToolkit¶ class langchain.agents.agent_toolkits.json.toolkit.JsonToolkit[source]¶ Bases: BaseToolkit Toolkit for interacting with a JSON spec. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot b...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.toolkit.JsonToolkit.html
a8d9b23a98d2-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.agents.agent_toolkits.json.toolkit.JsonToolkit.html
a8d9b23a98d2-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.toolkit.JsonToolkit.html
19f00347e1bf-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
19f00347e1bf-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.react_single_input.ReActSingleInputOutputParser.html
19f00347e1bf-2
Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can start producing output while input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
19f00347e1bf-3
Return dictionary representation of output parser. classmethod from_orm(obj: Any) → Model¶ get_format_instructions() → str[source]¶ Instructions on how the LLM output should be formatted. classmethod get_lc_namespace() → List[str]¶ Get the namespace of the langchain object. For example, if the class is langchain.llms.o...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
19f00347e1bf-4
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 parse_raw(b: Union[str, bytes], *, content_type: unicode = No...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
19f00347e1bf-5
Default implementation of stream, which calls invoke. Subclasses should override this method if they support streaming output. to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = No...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
19f00347e1bf-6
These attributes must be accepted by the constructor. property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html
873bd7c3d3ce-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
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_iterator.rebuild_callback_manager_on_set.html
f62fb80c9072-0
langchain.agents.format_scratchpad.log.format_log_to_str¶ langchain.agents.format_scratchpad.log.format_log_to_str(intermediate_steps: List[Tuple[AgentAction, str]], observation_prefix: str = 'Observation: ', llm_prefix: str = 'Thought: ') → str[source]¶ Construct the scratchpad that lets the agent continue its thought...
https://api.python.langchain.com/en/latest/agents/langchain.agents.format_scratchpad.log.format_log_to_str.html
cef383f0a6c7-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-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]...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-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 langchain....
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-3
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, **kwargs: Optional[Any]) → List[Output]¶ Default implementation of abatch, whic...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-4
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 ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = N...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-5
these runtime tags will propagate to calls to other objects. **kwargs – If the chain expects multiple inputs, they can be passed in directly as keyword arguments. Returns The chain output. Example # Suppose we have a single-input chain that takes a 'question' string: await chain.arun("What's the temperature in Boise, I...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-6
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-7
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(**kwargs: Any) → Dict¶ Dictionary representation of chain. Expects Chain._chain_type property to be implemented and for memory to benull. Parameters **kwargs – Keyword arguments passed to defaul...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-8
Enables iteration over steps taken to reach final output. 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 ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-9
Validate and prepare chain inputs, including adding inputs from memory. Parameters inputs – Dictionary of raw inputs, or single input if chain expects only one param. Should contain all inputs specified in Chain.input_keys except for inputs that will be set by the chain’s memory. Returns A dictionary of all inputs, inc...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-10
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, they can be passed in directly as keyword arguments. Returns The chain output. Example # Suppose we have a single-input chain that takes a 'que...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
cef383f0a6c7-11
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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain.html
aabc91ab499f-0
langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreInfo¶ class langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreInfo[source]¶ Bases: BaseModel Information about a VectorStore. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input da...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreInfo.html
aabc91ab499f-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.agents.agent_toolkits.vectorstore.toolkit.VectorStoreInfo.html
aabc91ab499f-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¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreInfo.html
9352da846865-0
langchain.agents.self_ask_with_search.base.SelfAskWithSearchAgent¶ class langchain.agents.self_ask_with_search.base.SelfAskWithSearchAgent[source]¶ Bases: Agent Agent for the self-ask-with-search paper. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input d...
https://api.python.langchain.com/en/latest/agents/langchain.agents.self_ask_with_search.base.SelfAskWithSearchAgent.html
9352da846865-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.self_ask_with_search.base.SelfAskWithSearchAgent.html