id
stringlengths
14
15
text
stringlengths
44
2.47k
source
stringlengths
61
181
2b486410a692-0
langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit¶ class langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit[source]¶ Bases: BaseToolkit Toolkit for interacting with SQL databases. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit.html
2b486410a692-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.sql.toolkit.SQLDatabaseToolkit.html
2b486410a692-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.sql.toolkit.SQLDatabaseToolkit.html
ef1f7aaa77c0-0
langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser¶ class langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser[source]¶ Bases: AgentOutputParser Parses ReAct-style LLM calls that have a single tool input in json format. Expects output to be in on...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
ef1f7aaa77c0-1
Default implementation of ainvoke, which calls invoke in a thread pool. Subclasses should override this method if they can run asynchronously. async aparse(text: str) → T¶ Parse a single string model output into some structure. Parameters text – String output of a language model. Returns Structured output. async aparse...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
ef1f7aaa77c0-2
step, and the final state of the run. The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of atransform, which buffers input and calls astream. Subcla...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
ef1f7aaa77c0-3
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¶ Return dictionary representation of output parser. classmethod from_orm(obj: Any) → Model¶ get_format_instructions() → str[source]¶ Instructions on how the LLM output shou...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
ef1f7aaa77c0-4
Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. 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: ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
ef1f7aaa77c0-5
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.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
ef1f7aaa77c0-6
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.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html
395f5e502b28-0
langchain.agents.agent_toolkits.json.base.create_json_agent¶
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.base.create_json_agent.html
395f5e502b28-1
langchain.agents.agent_toolkits.json.base.create_json_agent(llm: BaseLanguageModel, toolkit: JsonToolkit, callback_manager: Optional[BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with JSON.\nYour goal is to return a final answer by interacting with the JSON.\nYou have access to the f...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.base.create_json_agent.html
395f5e502b28-2
to see what keys exist at that path.\nDo not simply refer the user to the JSON or a section of the JSON, as this is not a valid answer. Keep digging until you find the answer and explicitly return it.\n', suffix: str = 'Begin!"\n\nQuestion: {input}\nThought: I should look at the keys that exist in data to see what I ha...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.base.create_json_agent.html
395f5e502b28-3
Construct a json agent from an LLM and tools. Examples using create_json_agent¶ JSON
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.json.base.create_json_agent.html
c66dc25aac77-0
langchain.agents.agent_toolkits.conversational_retrieval.openai_functions.create_conversational_retrieval_agent¶ langchain.agents.agent_toolkits.conversational_retrieval.openai_functions.create_conversational_retrieval_agent(llm: BaseLanguageModel, tools: List[BaseTool], remember_intermediate_steps: bool = True, memory...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.conversational_retrieval.openai_functions.create_conversational_retrieval_agent.html
b38602824960-0
langchain.agents.agent_toolkits.openapi.planner.RequestsGetToolWithParsing¶ class langchain.agents.agent_toolkits.openapi.planner.RequestsGetToolWithParsing[source]¶ Bases: BaseRequestsTool, BaseTool Requests GET tool with LLM-instructed extraction of truncated responses. Create a new model by parsing and validating in...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.planner.RequestsGetToolWithParsing.html
b38602824960-1
Optional metadata associated with the tool. Defaults to None This metadata will be associated with each call to this tool, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a tool with its use case. param name: str = 'requests_get'¶ Tool name. param re...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.planner.RequestsGetToolWithParsing.html
b38602824960-2
Subclasses should override this method if they can run asynchronously. async arun(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.planner.RequestsGetToolWithParsing.html
b38602824960-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_toolkits.openapi.planner.RequestsGetToolWithParsing.html
b38602824960-4
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.openapi.planner.RequestsGetToolWithParsing.html
b38602824960-5
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¶ run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Op...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.planner.RequestsGetToolWithParsing.html
b38602824960-6
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.base.Runnable[~langchain.schema.runnable.utils.Input, ~langchain.schema.runnable.utils.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,)) →...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.openapi.planner.RequestsGetToolWithParsing.html
f7b318a7efab-0
langchain.agents.agent.BaseMultiActionAgent¶ class langchain.agents.agent.BaseMultiActionAgent[source]¶ Bases: BaseModel Base Multi Action Agent class. 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. abstrac...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.BaseMultiActionAgent.html
f7b318a7efab-1
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[source]¶ Return dictionary representation of agent. classmethod from_orm(obj: Any) → Model¶ get_allowed_tools() → Optional[List[str]][source]¶ json(*, include: Optional[Uni...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.BaseMultiActionAgent.html
f7b318a7efab-2
Parameters intermediate_steps – Steps the LLM has taken to date, along with the observations. callbacks – Callbacks to run. **kwargs – User inputs. Returns Actions specifying what tool to use. return_stopped_response(early_stopping_method: str, intermediate_steps: List[Tuple[AgentAction, str]], **kwargs: Any) → AgentFi...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.BaseMultiActionAgent.html
87a18a68a61c-0
langchain.agents.agent_types.AgentType¶ class langchain.agents.agent_types.AgentType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶ Enumerator with the Agent types. ZERO_SHOT_REACT_DESCRIPTION = 'zero-shot-react-description'¶ REACT_DOCSTORE = 'react-docstore'¶ SELF_ASK_WIT...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_types.AgentType.html
87a18a68a61c-1
Gitlab Bittensor Amazon API Gateway Debugging LangSmith Walkthrough Hugging Face Prompt Injection Identification Comparing Chain Outputs Agent Trajectory Agents Multi-modal outputs: Image & Text Agent Debates with Tools Set env var OPENAI_API_KEY or load from a .env file SQL Multiple callback handlers Multi-Input Tools...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_types.AgentType.html
7bba62c48fea-0
langchain.agents.format_scratchpad.xml.format_xml¶ langchain.agents.format_scratchpad.xml.format_xml(intermediate_steps: List[Tuple[AgentAction, str]]) → str[source]¶
https://api.python.langchain.com/en/latest/agents/langchain.agents.format_scratchpad.xml.format_xml.html
09738d18c4a1-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. Create a new model by parsing and validating input data from keyword arguments. Raises...
https://api.python.langchain.com/en/latest/agents/langchain.agents.structured_chat.output_parser.StructuredChatOutputParser.html
09738d18c4a1-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.structured_chat.output_parser.StructuredChatOutputParser.html
09738d18c4a1-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.structured_chat.output_parser.StructuredChatOutputParser.html
09738d18c4a1-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.structured_chat.output_parser.StructuredChatOutputParser.html
09738d18c4a1-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.structured_chat.output_parser.StructuredChatOutputParser.html
09738d18c4a1-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.structured_chat.output_parser.StructuredChatOutputParser.html
73f0e875d7e7-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_iterator.AgentExecutorIterator.html
73f0e875d7e7-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_iterator.AgentExecutorIterator.html
625858e5118e-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
a5688957ea1a-0
langchain.agents.conversational_chat.output_parser.ConvoOutputParser¶ class langchain.agents.conversational_chat.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 Validation...
https://api.python.langchain.com/en/latest/agents/langchain.agents.conversational_chat.output_parser.ConvoOutputParser.html
a5688957ea1a-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.conversational_chat.output_parser.ConvoOutputParser.html
a5688957ea1a-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.conversational_chat.output_parser.ConvoOutputParser.html
a5688957ea1a-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.conversational_chat.output_parser.ConvoOutputParser.html
a5688957ea1a-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.conversational_chat.output_parser.ConvoOutputParser.html
a5688957ea1a-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.conversational_chat.output_parser.ConvoOutputParser.html
06966e28c4ca-0
langchain.agents.format_scratchpad.openai_functions.format_to_openai_functions¶ langchain.agents.format_scratchpad.openai_functions.format_to_openai_functions(intermediate_steps: Sequence[Tuple[AgentAction, str]]) → List[BaseMessage][source]¶ Format intermediate steps. :param intermediate_steps: Steps the LLM has taken...
https://api.python.langchain.com/en/latest/agents/langchain.agents.format_scratchpad.openai_functions.format_to_openai_functions.html
acd20818061b-0
langchain.agents.agent_toolkits.xorbits.base.create_xorbits_agent¶ langchain.agents.agent_toolkits.xorbits.base.create_xorbits_agent(llm: BaseLLM, data: Any, callback_manager: Optional[BaseCallbackManager] = None, prefix: str = '', suffix: str = '', input_variables: Optional[List[str]] = None, verbose: bool = False, re...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.xorbits.base.create_xorbits_agent.html
b138226deb0d-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.format_scratchpad.log_to_messages.format_log_to_messages.html
b8f010bc45dc-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.loading.load_agent_from_config.html
924d645025b7-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 ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent.html
924d645025b7-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent.html
924d645025b7-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent.html
924d645025b7-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent.html
a64c9d8dd117-0
langchain.agents.agent_toolkits.gitlab.toolkit.GitLabToolkit¶ class langchain.agents.agent_toolkits.gitlab.toolkit.GitLabToolkit[source]¶ Bases: BaseToolkit GitLab 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 a...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.gitlab.toolkit.GitLabToolkit.html
a64c9d8dd117-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.gitlab.toolkit.GitLabToolkit.html
a64c9d8dd117-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.gitlab.toolkit.GitLabToolkit.html
b1f57de9c416-0
langchain.agents.agent_toolkits.spark.base.create_spark_dataframe_agent¶ langchain.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 name of the dataframe is ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.spark.base.create_spark_dataframe_agent.html
305702afdf27-0
langchain.agents.react.base.ReActTextWorldAgent¶ class langchain.agents.react.base.ReActTextWorldAgent[source]¶ Bases: ReActDocstoreAgent Agent for the ReAct TextWorld chain. 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.react.base.ReActTextWorldAgent.html
305702afdf27-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.react.base.ReActTextWorldAgent.html
305702afdf27-2
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 = None, encoding: unicode = 'utf8', proto...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActTextWorldAgent.html
305702afdf27-3
classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ property llm_prefix: str¶ Prefix to append the LLM call with. property observation_prefix: str¶ Prefix to append the observation with. property...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActTextWorldAgent.html
7ffbcaa5cff7-0
langchain.agents.agent.BaseSingleActionAgent¶ class langchain.agents.agent.BaseSingleActionAgent[source]¶ Bases: BaseModel Base Single Action Agent class. 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. abst...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.BaseSingleActionAgent.html
7ffbcaa5cff7-1
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[source]¶ Return dictionary representation of agent. classmethod from_llm_and_tools(llm: BaseLanguageModel, tools: Sequence[BaseTool], callback_manager: Optional[BaseCallbac...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.BaseSingleActionAgent.html
7ffbcaa5cff7-2
abstract plan(intermediate_steps: List[Tuple[AgentAction, str]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Union[AgentAction, AgentFinish][source]¶ Given input, decided what to do. Parameters intermediate_steps – Steps the LLM has taken to date, along with obser...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.BaseSingleActionAgent.html
bc816386332d-0
langchain.agents.schema.AgentScratchPadChatPromptTemplate¶ class langchain.agents.schema.AgentScratchPadChatPromptTemplate[source]¶ Bases: ChatPromptTemplate Chat prompt template for the agent scratchpad. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input...
https://api.python.langchain.com/en/latest/agents/langchain.agents.schema.AgentScratchPadChatPromptTemplate.html
bc816386332d-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.schema.AgentScratchPadChatPromptTemplate.html
bc816386332d-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.schema.AgentScratchPadChatPromptTemplate.html
bc816386332d-3
Format the chat template into a list of finalized messages. Parameters **kwargs – keyword arguments to use for filling in template variables in all the template messages in this chat template. Returns list of formatted messages format_prompt(**kwargs: Any) → PromptValue¶ Format prompt. Should return a PromptValue. :par...
https://api.python.langchain.com/en/latest/agents/langchain.agents.schema.AgentScratchPadChatPromptTemplate.html
bc816386332d-4
classmethod from_role_strings(string_messages: List[Tuple[str, str]]) → ChatPromptTemplate¶ [Deprecated] Create a chat prompt template from a list of (role, template) tuples. Parameters string_messages – list of (role, template) tuples. string_messages – list of (role, template) tuples. Returns a chat prompt template[...
https://api.python.langchain.com/en/latest/agents/langchain.agents.schema.AgentScratchPadChatPromptTemplate.html
bc816386332d-5
namespace is [“langchain”, “llms”, “openai”] invoke(input: Dict, config: langchain.schema.runnable.config.RunnableConfig | None = None) → PromptValue¶ classmethod is_lc_serializable() → bool¶ Return whether this class is serializable. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude...
https://api.python.langchain.com/en/latest/agents/langchain.agents.schema.AgentScratchPadChatPromptTemplate.html
bc816386332d-6
partial(**kwargs: Union[str, Callable[[], str]]) → ChatPromptTemplate¶ Get a new ChatPromptTemplate with some input variables already filled in. Parameters **kwargs – keyword arguments to use for filling in template variables. Ought to be a subset of the input variables. Returns A new ChatPromptTemplate. Example from l...
https://api.python.langchain.com/en/latest/agents/langchain.agents.schema.AgentScratchPadChatPromptTemplate.html
bc816386332d-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.schema.AgentScratchPadChatPromptTemplate.html
03f2a07d53f9-0
langchain.agents.agent.AgentOutputParser¶ class langchain.agents.agent.AgentOutputParser[source]¶ Bases: BaseOutputParser Base class for parsing agent output into agent action/finish. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parse...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentOutputParser.html
03f2a07d53f9-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.agent.AgentOutputParser.html
03f2a07d53f9-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.agent.AgentOutputParser.html
03f2a07d53f9-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.agent.AgentOutputParser.html
03f2a07d53f9-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.agent.AgentOutputParser.html
03f2a07d53f9-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.agent.AgentOutputParser.html
703f704021e6-0
langchain.agents.agent.AgentExecutor¶ class langchain.agents.agent.AgentExecutor[source]¶ Bases: Chain Agent that is using tools. 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 agent: Union[BaseSingle...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-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.agent.AgentExecutor.html
703f704021e6-12
Examples using AgentExecutor¶ Metaphor Search LLMonitor Jina PowerBI Dataset SQL Database JSON Bittensor Conversational Retrieval Agent Agents BabyAGI with Tools Plug-and-Plai Wikibase Agent SalesGPT - Your Context-Aware AI Sales Assistant With Knowledge Base Custom Agent with PlugIn Retrieval Set env var OPENAI_API_KE...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent.AgentExecutor.html
32e6072409d1-0
langchain.agents.agent_toolkits.pandas.base.create_pandas_dataframe_agent¶ langchain.agents.agent_toolkits.pandas.base.create_pandas_dataframe_agent(llm: BaseLanguageModel, df: Any, agent_type: AgentType = AgentType.ZERO_SHOT_REACT_DESCRIPTION, callback_manager: Optional[BaseCallbackManager] = None, prefix: Optional[st...
https://api.python.langchain.com/en/latest/agents/langchain.agents.agent_toolkits.pandas.base.create_pandas_dataframe_agent.html
7a947c6d9114-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 ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
7a947c6d9114-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...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
7a947c6d9114-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 langchain.verbose value. __call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallba...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
7a947c6d9114-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 of abatch, which calls ai...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
7a947c6d9114-4
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] = None, **kwargs: Any) → Dict[str, Any]¶ Default implementation of ainvoke, ...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
7a947c6d9114-5
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, Idaho?") # -> "The temperature in Boise is..." # Suppose we have a multi-input chain that takes a 'question' string # and 'context' s...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
7a947c6d9114-6
The jsonpatch ops can be applied in order to construct state. async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶ Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if th...
https://api.python.langchain.com/en/latest/agents/langchain.agents.react.base.ReActChain.html
7a947c6d9114-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.react.base.ReActChain.html
7a947c6d9114-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.react.base.ReActChain.html
7a947c6d9114-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.react.base.ReActChain.html