param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Use this when you want to PUT to a website.\n    Input should be a json string with two keys: "url" and "data".\n    The value of "url" should be a string, and the value of "data" should be a dictionary of \n    key-value pairs you want to PUT to the url.\n    Be careful to always use double quotes for strings in the json string.\n    The output will be the text response of the PUT request.\n    '¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'requests_put'¶
The unique name of the tool that clearly communicates its purpose.
param requests_wrapper: langchain.requests.TextRequestsWrapper [Required]¶
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.


Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.sql_database.tool.InfoSQLDatabaseTool¶
class langchain.tools.sql_database.tool.InfoSQLDatabaseTool(*, name: str = 'sql_db_schema', description: str = '\n    Input to this tool is a comma-separated list of tables, output is the schema and sample rows for those tables.    \n\n    Example Input: "table1, table2, table3"\n    ', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, db: SQLDatabase)[source]¶
Bases: BaseSQLDatabaseTool, BaseTool
Tool for getting metadata about a SQL database.
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param db: langchain.sql_database.SQLDatabase [Required]¶
param description: str = '\n    Input to this tool is a comma-separated list of tables, output is the schema and sample rows for those tables.    \n\n    Example Input: "table1, table2, table3"\n    '¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.


You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'sql_db_schema'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: Config
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.gmail.get_message.GmailGetMessage¶
class langchain.tools.gmail.get_message.GmailGetMessage(*, name: str = 'get_gmail_message', description: str = 'Use this tool to fetch an email by message ID. Returns the thread ID, snipet, body, subject, and sender.', args_schema: ~typing.Type[~langchain.tools.gmail.get_message.SearchArgsSchema] = <class 'langchain.tools.gmail.get_message.SearchArgsSchema'>, return_direct: bool = False, verbose: bool = False, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, handle_tool_error: ~typing.Optional[~typing.Union[bool, str, ~typing.Callable[[~langchain.tools.base.ToolException], str]]] = False, api_resource: Resource = None)[source]¶
Bases: GmailBaseTool
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 api_resource: Resource [Optional]¶
param args_schema: Type[langchain.tools.gmail.get_message.SearchArgsSchema] = <class 'langchain.tools.gmail.get_message.SearchArgsSchema'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Use this tool to fetch an email by message ID. Returns the thread ID, snipet, body, subject, and sender.'¶


Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'get_gmail_message'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
classmethod from_api_resource(api_resource: Resource) → GmailBaseTool¶
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object


Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.file_management.delete.FileDeleteInput¶
class langchain.tools.file_management.delete.FileDeleteInput(*, file_path: str)[source]¶
Bases: BaseModel
Input for DeleteFileTool.
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 file_path: str [Required]¶
Path of the file to delete


langchain.tools.graphql.tool.BaseGraphQLTool¶
class langchain.tools.graphql.tool.BaseGraphQLTool(*, name: str = 'query_graphql', description: str = "    Input to this tool is a detailed and correct GraphQL query, output is a result from the API.\n    If the query is not correct, an error message will be returned.\n    If an error is returned with 'Bad request' in it, rewrite the query and try again.\n    If an error is returned with 'Unauthorized' in it, do not try again, but tell the user to change their authentication.\n\n    Example Input: query {{ allUsers {{ id, name, email }} }}    ", args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, graphql_wrapper: GraphQLAPIWrapper)[source]¶
Bases: BaseTool
Base tool for querying a GraphQL API.
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.


param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = "    Input to this tool is a detailed and correct GraphQL query, output is a result from the API.\n    If the query is not correct, an error message will be returned.\n    If an error is returned with 'Bad request' in it, rewrite the query and try again.\n    If an error is returned with 'Unauthorized' in it, do not try again, but tell the user to change their authentication.\n\n    Example Input: query {{ allUsers {{ id, name, email }} }}    "¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param graphql_wrapper: langchain.utilities.graphql.GraphQLAPIWrapper [Required]¶
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'query_graphql'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶


Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config[source]¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶


langchain.tools.file_management.list_dir.DirectoryListingInput¶
class langchain.tools.file_management.list_dir.DirectoryListingInput(*, dir_path: str = '.')[source]¶
Bases: BaseModel
Input for ListDirectoryTool.
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 dir_path: str = '.'¶
Subdirectory to list.


langchain.tools.requests.tool.RequestsGetTool¶
class langchain.tools.requests.tool.RequestsGetTool(*, name: str = 'requests_get', description: str = 'A portal to the internet. Use this when you need to get specific content from a website. Input should be a  url (i.e. https://www.google.com). The output will be the text response of the GET request.', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, requests_wrapper: TextRequestsWrapper)[source]¶
Bases: BaseRequestsTool, BaseTool
Tool for making a GET request to an API endpoint.
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'A portal to the internet. Use this when you need to get specific content from a website. Input should be a  url (i.e. https://www.google.com). The output will be the text response of the GET request.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.


You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'requests_get'¶
The unique name of the tool that clearly communicates its purpose.
param requests_wrapper: langchain.requests.TextRequestsWrapper [Required]¶
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.base.ToolException¶
class langchain.tools.base.ToolException[source]¶
Bases: Exception
An optional exception that tool throws when execution error occurs.
When this exception is thrown, the agent will not stop working,
but will handle the exception according to the handle_tool_error
variable of the tool, and the processing result will be returned
to the agent as observation, and printed in red on the console.
add_note()¶
Exception.add_note(note) –
add a note to the exception
with_traceback()¶
Exception.with_traceback(tb) –
set self.__traceback__ to tb and return self.
args¶


langchain.tools.ifttt.IFTTTWebhook¶
class langchain.tools.ifttt.IFTTTWebhook(*, name: str, description: str, args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, url: str)[source]¶
Bases: BaseTool
IFTTT Webhook.
Parameters
name – name of the tool
description – description of the tool
url – url to hit with the json event.
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str [Required]¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str [Required]¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.


that after the tool is called, the AgentExecutor will stop looping.
param url: str [Required]¶
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.sql_database.tool.QuerySQLCheckerTool¶
class langchain.tools.sql_database.tool.QuerySQLCheckerTool(*, name: str = 'sql_db_query_checker', description: str = '\n    Use this tool to double check if your query is correct before executing it.\n    Always use this tool before executing a query with query_sql_db!\n    ', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, db: SQLDatabase, template: str = '\n{query}\nDouble check the {dialect} query above for common mistakes, including:\n- Using NOT IN with NULL values\n- Using UNION when UNION ALL should have been used\n- Using BETWEEN for exclusive ranges\n- Data type mismatch in predicates\n- Properly quoting identifiers\n- Using the correct number of arguments for functions\n- Casting to the correct data type\n- Using the proper columns for joins\n\nIf there are any of the above mistakes, rewrite the query. If there are no mistakes, just reproduce the original query.', llm: BaseLanguageModel, llm_chain: LLMChain)[source]¶
Bases: BaseSQLDatabaseTool, BaseTool
Use an LLM to check if a query is correct.
Adapted from https://www.patterns.app/blog/2023/01/18/crunchbot-sql-analyst-gpt/
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: Optional[Type[BaseModel]] = None¶


param args_schema: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param db: SQLDatabase [Required]¶
param description: str = '\n    Use this tool to double check if your query is correct before executing it.\n    Always use this tool before executing a query with query_sql_db!\n    '¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param llm: langchain.base_language.BaseLanguageModel [Required]¶
param llm_chain: langchain.chains.llm.LLMChain [Required]¶
param name: str = 'sql_db_query_checker'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.


that after the tool is called, the AgentExecutor will stop looping.
param template: str = '\n{query}\nDouble check the {dialect} query above for common mistakes, including:\n- Using NOT IN with NULL values\n- Using UNION when UNION ALL should have been used\n- Using BETWEEN for exclusive ranges\n- Data type mismatch in predicates\n- Properly quoting identifiers\n- Using the correct number of arguments for functions\n- Casting to the correct data type\n- Using the proper columns for joins\n\nIf there are any of the above mistakes, rewrite the query. If there are no mistakes, just reproduce the original query.'¶
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator initialize_llm_chain  »  all fields[source]¶
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: Config


Whether the tool only accepts a single input.
model Config¶
Bases: Config
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.file_management.utils.FileValidationError¶
class langchain.tools.file_management.utils.FileValidationError[source]¶
Bases: ValueError
Error for paths outside the root directory.
add_note()¶
Exception.add_note(note) –
add a note to the exception
with_traceback()¶
Exception.with_traceback(tb) –
set self.__traceback__ to tb and return self.
args¶


langchain.tools.google_serper.tool.GoogleSerperRun¶
class langchain.tools.google_serper.tool.GoogleSerperRun(*, name: str = 'google_serper', description: str = 'A low-cost Google Search API.Useful for when you need to answer questions about current events.Input should be a search query.', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, api_wrapper: GoogleSerperAPIWrapper)[source]¶
Bases: BaseTool
Tool that adds the capability to query the Serper.dev Google search API.
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 api_wrapper: langchain.utilities.google_serper.GoogleSerperAPIWrapper [Required]¶
param args_schema: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'A low-cost Google Search API.Useful for when you need to answer questions about current events.Input should be a search query.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.


Handle the content of the ToolException thrown.
param name: str = 'google_serper'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.playwright.current_page.CurrentWebPageTool¶
class langchain.tools.playwright.current_page.CurrentWebPageTool(*, name: str = 'current_webpage', description: str = 'Returns the URL of the current page', args_schema: ~typing.Type[~pydantic.main.BaseModel] = <class 'pydantic.main.BaseModel'>, return_direct: bool = False, verbose: bool = False, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, handle_tool_error: ~typing.Optional[~typing.Union[bool, str, ~typing.Callable[[~langchain.tools.base.ToolException], str]]] = False, sync_browser: Optional['SyncBrowser'] = None, async_browser: Optional['AsyncBrowser'] = None)[source]¶
Bases: BaseBrowserTool
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: Type[BaseModel] = <class 'pydantic.main.BaseModel'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param async_browser: Optional['AsyncBrowser'] = None¶
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Returns the URL of the current page'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.


You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'current_webpage'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param sync_browser: Optional['SyncBrowser'] = None¶
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
classmethod from_browser(sync_browser: Optional[SyncBrowser] = None, async_browser: Optional[AsyncBrowser] = None) → BaseBrowserTool¶
Instantiate the tool.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
validator validate_browser_provided  »  all fields¶
Check that the arguments are valid.


validator validate_browser_provided  »  all fields¶
Check that the arguments are valid.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.azure_cognitive_services.image_analysis.AzureCogsImageAnalysisTool¶
class langchain.tools.azure_cognitive_services.image_analysis.AzureCogsImageAnalysisTool(*, name: str = 'azure_cognitive_services_image_analysis', description: str = 'A wrapper around Azure Cognitive Services Image Analysis. Useful for when you need to analyze images. Input should be a url to an image.', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, azure_cogs_key: str = '', azure_cogs_endpoint: str = '', vision_service: Any = None, analysis_options: Any = None)[source]¶
Bases: BaseTool
Tool that queries the Azure Cognitive Services Image Analysis API.
In order to set this up, follow instructions at:
https://learn.microsoft.com/en-us/azure/cognitive-services/computer-vision/quickstarts-sdk/image-analysis-client-library-40
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'A wrapper around Azure Cognitive Services Image Analysis. Useful for when you need to analyze images. Input should be a url to an image.'¶


Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'azure_cognitive_services_image_analysis'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
validator validate_environment  »  all fields[source]¶
Validate that api key and endpoint exists in environment.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶


Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.gmail.search.GmailSearch¶
class langchain.tools.gmail.search.GmailSearch(*, name: str = 'search_gmail', description: str = 'Use this tool to search for email messages or threads. The input must be a valid Gmail query. The output is a JSON list of the requested resource.', args_schema: ~typing.Type[~langchain.tools.gmail.search.SearchArgsSchema] = <class 'langchain.tools.gmail.search.SearchArgsSchema'>, return_direct: bool = False, verbose: bool = False, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, handle_tool_error: ~typing.Optional[~typing.Union[bool, str, ~typing.Callable[[~langchain.tools.base.ToolException], str]]] = False, api_resource: Resource = None)[source]¶
Bases: GmailBaseTool
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 api_resource: Resource [Optional]¶
param args_schema: Type[langchain.tools.gmail.search.SearchArgsSchema] = <class 'langchain.tools.gmail.search.SearchArgsSchema'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Use this tool to search for email messages or threads. The input must be a valid Gmail query. The output is a JSON list of the requested resource.'¶
Used to tell the model how/when/why to use the tool.


Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'search_gmail'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
classmethod from_api_resource(api_resource: Resource) → GmailBaseTool¶
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object


langchain.tools.spark_sql.tool.QueryCheckerTool¶
class langchain.tools.spark_sql.tool.QueryCheckerTool(*, name: str = 'query_checker_sql_db', description: str = '\n    Use this tool to double check if your query is correct before executing it.\n    Always use this tool before executing a query with query_sql_db!\n    ', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, db: SparkSQL, template: str = '\n{query}\nDouble check the Spark SQL query above for common mistakes, including:\n- Using NOT IN with NULL values\n- Using UNION when UNION ALL should have been used\n- Using BETWEEN for exclusive ranges\n- Data type mismatch in predicates\n- Properly quoting identifiers\n- Using the correct number of arguments for functions\n- Casting to the correct data type\n- Using the proper columns for joins\n\nIf there are any of the above mistakes, rewrite the query. If there are no mistakes, just reproduce the original query.', llm: BaseLanguageModel, llm_chain: LLMChain)[source]¶
Bases: BaseSparkSQLTool, BaseTool
Use an LLM to check if a query is correct.
Adapted from https://www.patterns.app/blog/2023/01/18/crunchbot-sql-analyst-gpt/
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: Optional[Type[BaseModel]] = None¶


param args_schema: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param db: SparkSQL [Required]¶
param description: str = '\n    Use this tool to double check if your query is correct before executing it.\n    Always use this tool before executing a query with query_sql_db!\n    '¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param llm: langchain.base_language.BaseLanguageModel [Required]¶
param llm_chain: langchain.chains.llm.LLMChain [Required]¶
param name: str = 'query_checker_sql_db'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.


that after the tool is called, the AgentExecutor will stop looping.
param template: str = '\n{query}\nDouble check the Spark SQL query above for common mistakes, including:\n- Using NOT IN with NULL values\n- Using UNION when UNION ALL should have been used\n- Using BETWEEN for exclusive ranges\n- Data type mismatch in predicates\n- Properly quoting identifiers\n- Using the correct number of arguments for functions\n- Casting to the correct data type\n- Using the proper columns for joins\n\nIf there are any of the above mistakes, rewrite the query. If there are no mistakes, just reproduce the original query.'¶
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator initialize_llm_chain  »  all fields[source]¶
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: Config


langchain.tools.file_management.move.MoveFileTool¶
class langchain.tools.file_management.move.MoveFileTool(*, name: str = 'move_file', description: str = 'Move or rename a file from one location to another', args_schema: ~typing.Type[~pydantic.main.BaseModel] = <class 'langchain.tools.file_management.move.FileMoveInput'>, return_direct: bool = False, verbose: bool = False, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, handle_tool_error: ~typing.Optional[~typing.Union[bool, str, ~typing.Callable[[~langchain.tools.base.ToolException], str]]] = False, root_dir: ~typing.Optional[str] = None)[source]¶
Bases: BaseFileToolMixin, BaseTool
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: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.move.FileMoveInput'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Move or rename a file from one location to another'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶


Handle the content of the ToolException thrown.
param name: str = 'move_file'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param root_dir: Optional[str] = None¶
The final path will be chosen relative to root_dir if specified.
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
get_relative_path(file_path: str) → Path¶
Get the relative path, returning an error if unsupported.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.sleep.tool.SleepInput¶
class langchain.tools.sleep.tool.SleepInput(*, sleep_time: int)[source]¶
Bases: BaseModel
Input for CopyFileTool.
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 sleep_time: int [Required]¶
Time to sleep in seconds


langchain.tools.plugin.marshal_spec¶
langchain.tools.plugin.marshal_spec(txt: str) → dict[source]¶
Convert the yaml or json serialized spec to a dict.
Parameters
txt – The yaml or json serialized spec.
Returns
The spec as a dict.
Return type
dict


langchain.tools.file_management.utils.BaseFileToolMixin¶
class langchain.tools.file_management.utils.BaseFileToolMixin(*, root_dir: Optional[str] = None)[source]¶
Bases: BaseModel
Mixin for file system 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 root_dir: Optional[str] = None¶
The final path will be chosen relative to root_dir if specified.
get_relative_path(file_path: str) → Path[source]¶
Get the relative path, returning an error if unsupported.


langchain.tools.steamship_image_generation.utils.make_image_public¶
langchain.tools.steamship_image_generation.utils.make_image_public(client: Steamship, block: Block) → str[source]¶
Upload a block to a signed URL and return the public URL.


langchain.tools.openapi.utils.api_models.APIRequestBodyProperty¶
class langchain.tools.openapi.utils.api_models.APIRequestBodyProperty(*, name: str, required: bool, type: Union[str, Type, tuple, None, Enum] = None, default: Optional[Any] = None, description: Optional[str] = None, properties: List[APIRequestBodyProperty], references_used: List[str])[source]¶
Bases: APIPropertyBase
A model for a request body property.
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 default: Optional[Any] = None¶
The default value of the property.
param description: Optional[str] = None¶
The description of the property.
param name: str [Required]¶
The name of the property.
param properties: List[langchain.tools.openapi.utils.api_models.APIRequestBodyProperty] [Required]¶
The sub-properties of the property.
param references_used: List[str] [Required]¶
The references used by the property.
param required: bool [Required]¶
Whether the property is required.
param type: Union[str, Type, tuple, None, enum.Enum] = None¶
The type of the property.
Either a primitive type, a component/parameter type,
or an array or ‘object’ (dict) of the above.
classmethod from_schema(schema: Schema, name: str, required: bool, spec: OpenAPISpec, references_used: Optional[List[str]] = None) → APIRequestBodyProperty[source]¶
Recursively populate from an OpenAPI Schema.


langchain.tools.gmail.utils.import_google¶
langchain.tools.gmail.utils.import_google() → Tuple[Request, Credentials][source]¶
Import google libraries.
Returns
Request and Credentials classes.
Return type
Tuple[Request, Credentials]


langchain.tools.file_management.move.FileMoveInput¶
class langchain.tools.file_management.move.FileMoveInput(*, source_path: str, destination_path: str)[source]¶
Bases: BaseModel
Input for MoveFileTool.
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 destination_path: str [Required]¶
New path for the moved file
param source_path: str [Required]¶
Path of the file to move


langchain.tools.powerbi.tool.ListPowerBITool¶
class langchain.tools.powerbi.tool.ListPowerBITool(*, name: str = 'list_tables_powerbi', description: str = 'Input is an empty string, output is a comma separated list of tables in the database.', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, powerbi: PowerBIDataset)[source]¶
Bases: BaseTool
Tool for getting tables names.
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Input is an empty string, output is a comma separated list of tables in the database.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'list_tables_powerbi'¶
The unique name of the tool that clearly communicates its purpose.
param powerbi: langchain.utilities.powerbi.PowerBIDataset [Required]¶


param powerbi: langchain.utilities.powerbi.PowerBIDataset [Required]¶
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config[source]¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶


langchain.tools.office365.utils.clean_body¶
langchain.tools.office365.utils.clean_body(body: str) → str[source]¶
Clean body of a message or event.


langchain.tools.scenexplain.tool.SceneXplainInput¶
class langchain.tools.scenexplain.tool.SceneXplainInput(*, query: str)[source]¶
Bases: BaseModel
Input for SceneXplain.
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 query: str [Required]¶
The link to the image to explain


langchain.tools.base.tool¶
langchain.tools.base.tool(*args: Union[str, Callable], return_direct: bool = False, args_schema: Optional[Type[BaseModel]] = None, infer_schema: bool = True) → Callable[source]¶
Make tools out of functions, can be used with or without arguments.
Parameters
*args – The arguments to the tool.
return_direct – Whether to return directly from the tool rather
than continuing the agent loop.
args_schema – optional argument schema for user to specify
infer_schema – Whether to infer the schema of the arguments from
the function’s signature. This also makes the resultant tool
accept a dictionary input to its run() function.
Requires:
Function must be of type (str) -> str
Function must have a docstring
Examples
@tool
def search_api(query: str) -> str:
    # Searches the API for the query.
    return
@tool("search", return_direct=True)
def search_api(query: str) -> str:
    # Searches the API for the query.
    return


langchain.tools.python.tool.sanitize_input¶
langchain.tools.python.tool.sanitize_input(query: str) → str[source]¶
Sanitize input to the python REPL.
Remove whitespace, backtick & python (if llm mistakes python console as terminal)
Parameters
query – The query to sanitize
Returns
The sanitized query
Return type
str


langchain.tools.gmail.get_thread.GetThreadSchema¶
class langchain.tools.gmail.get_thread.GetThreadSchema(*, thread_id: str)[source]¶
Bases: BaseModel
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 thread_id: str [Required]¶
The thread ID.


langchain.tools.convert_to_openai.format_tool_to_openai_function¶
langchain.tools.convert_to_openai.format_tool_to_openai_function(tool: BaseTool) → FunctionDescription[source]¶
Format tool into the OpenAI function API.


langchain.tools.file_management.read.ReadFileInput¶
class langchain.tools.file_management.read.ReadFileInput(*, file_path: str)[source]¶
Bases: BaseModel
Input for ReadFileTool.
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 file_path: str [Required]¶
name of file


langchain.tools.gmail.create_draft.GmailCreateDraft¶
class langchain.tools.gmail.create_draft.GmailCreateDraft(*, name: str = 'create_gmail_draft', description: str = 'Use this tool to create a draft email with the provided message fields.', args_schema: ~typing.Type[~langchain.tools.gmail.create_draft.CreateDraftSchema] = <class 'langchain.tools.gmail.create_draft.CreateDraftSchema'>, return_direct: bool = False, verbose: bool = False, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, handle_tool_error: ~typing.Optional[~typing.Union[bool, str, ~typing.Callable[[~langchain.tools.base.ToolException], str]]] = False, api_resource: Resource = None)[source]¶
Bases: GmailBaseTool
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 api_resource: Resource [Optional]¶
param args_schema: Type[langchain.tools.gmail.create_draft.CreateDraftSchema] = <class 'langchain.tools.gmail.create_draft.CreateDraftSchema'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Use this tool to create a draft email with the provided message fields.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.


You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'create_gmail_draft'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
classmethod from_api_resource(api_resource: Resource) → GmailBaseTool¶
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶


Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.brave_search.tool.BraveSearch¶
class langchain.tools.brave_search.tool.BraveSearch(*, name: str = 'brave_search', description: str = 'a search engine. useful for when you need to answer questions about current events. input should be a search query.', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, search_wrapper: BraveSearchWrapper)[source]¶
Bases: BaseTool
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'a search engine. useful for when you need to answer questions about current events. input should be a search query.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'brave_search'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶


param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param search_wrapper: BraveSearchWrapper [Required]¶
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
classmethod from_api_key(api_key: str, search_kwargs: Optional[dict] = None, **kwargs: Any) → BraveSearch[source]¶
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.vectorstore.tool.VectorStoreQATool¶
class langchain.tools.vectorstore.tool.VectorStoreQATool(*, name: str, description: str, args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, vectorstore: VectorStore, llm: BaseLanguageModel = None)[source]¶
Bases: BaseVectorStoreTool, BaseTool
Tool for the VectorDBQA chain. To be initialized with name and 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 a valid model.
param args_schema: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str [Required]¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param llm: langchain.base_language.BaseLanguageModel [Optional]¶
param name: str [Required]¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means


Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param vectorstore: langchain.vectorstores.base.VectorStore [Required]¶
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
static get_description(name: str, description: str) → str[source]¶
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: Config
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.playwright.navigate.NavigateToolInput¶
class langchain.tools.playwright.navigate.NavigateToolInput(*, url: str)[source]¶
Bases: BaseModel
Input for NavigateToolInput.
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 url: str [Required]¶
url to navigate to


langchain.tools.requests.tool.RequestsDeleteTool¶
class langchain.tools.requests.tool.RequestsDeleteTool(*, name: str = 'requests_delete', description: str = 'A portal to the internet. Use this when you need to make a DELETE request to a URL. Input should be a specific url, and the output will be the text response of the DELETE request.', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, requests_wrapper: TextRequestsWrapper)[source]¶
Bases: BaseRequestsTool, BaseTool
Tool for making a DELETE request to an API endpoint.
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'A portal to the internet. Use this when you need to make a DELETE request to a URL. Input should be a specific url, and the output will be the text response of the DELETE request.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶


Handle the content of the ToolException thrown.
param name: str = 'requests_delete'¶
The unique name of the tool that clearly communicates its purpose.
param requests_wrapper: langchain.requests.TextRequestsWrapper [Required]¶
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.playwright.base.BaseBrowserTool¶
class langchain.tools.playwright.base.BaseBrowserTool(*, name: str, description: str, args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, sync_browser: Optional['SyncBrowser'] = None, async_browser: Optional['AsyncBrowser'] = None)[source]¶
Bases: BaseTool
Base class for browser 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 args_schema: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param async_browser: Optional['AsyncBrowser'] = None¶
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str [Required]¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str [Required]¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.


that after the tool is called, the AgentExecutor will stop looping.
param sync_browser: Optional['SyncBrowser'] = None¶
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
classmethod from_browser(sync_browser: Optional[SyncBrowser] = None, async_browser: Optional[AsyncBrowser] = None) → BaseBrowserTool[source]¶
Instantiate the tool.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
validator validate_browser_provided  »  all fields[source]¶
Check that the arguments are valid.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.pubmed.tool.PubmedQueryRun¶
class langchain.tools.pubmed.tool.PubmedQueryRun(*, name: str = 'PubMed', description: str = 'A wrapper around PubMed.org Useful for when you need to answer questions about Physics, Mathematics, Computer Science, Quantitative Biology, Quantitative Finance, Statistics, Electrical Engineering, and Economics from scientific articles on PubMed.org. Input should be a search query.', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, api_wrapper: PubMedAPIWrapper = None)[source]¶
Bases: BaseTool
Tool that adds the capability to search using the PubMed API.
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 api_wrapper: langchain.utilities.pupmed.PubMedAPIWrapper [Optional]¶
param args_schema: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'A wrapper around PubMed.org Useful for when you need to answer questions about Physics, Mathematics, Computer Science, Quantitative Biology, Quantitative Finance, Statistics, Electrical Engineering, and Economics from scientific articles on PubMed.org. Input should be a search query.'¶
Used to tell the model how/when/why to use the tool.


Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'PubMed'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.metaphor_search.tool.MetaphorSearchResults¶
class langchain.tools.metaphor_search.tool.MetaphorSearchResults(*, name: str = 'metaphor_search_results_json', description: str = 'A wrapper around Metaphor Search. Input should be a Metaphor-optimized query. Output is a JSON array of the query results', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, api_wrapper: MetaphorSearchAPIWrapper)[source]¶
Bases: BaseTool
Tool that has capability to query the Metaphor Search API and get back json.
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 api_wrapper: langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper [Required]¶
param args_schema: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'A wrapper around Metaphor Search. Input should be a Metaphor-optimized query. Output is a JSON array of the query results'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.


You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'metaphor_search_results_json'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.playwright.click.ClickTool¶
class langchain.tools.playwright.click.ClickTool(*, name: str = 'click_element', description: str = 'Click on an element with the given CSS selector', args_schema: ~typing.Type[~pydantic.main.BaseModel] = <class 'langchain.tools.playwright.click.ClickToolInput'>, return_direct: bool = False, verbose: bool = False, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, handle_tool_error: ~typing.Optional[~typing.Union[bool, str, ~typing.Callable[[~langchain.tools.base.ToolException], str]]] = False, sync_browser: Optional['SyncBrowser'] = None, async_browser: Optional['AsyncBrowser'] = None, visible_only: bool = True, playwright_strict: bool = False, playwright_timeout: float = 1000)[source]¶
Bases: BaseBrowserTool
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: Type[BaseModel] = <class 'langchain.tools.playwright.click.ClickToolInput'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param async_browser: Optional['AsyncBrowser'] = None¶
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Click on an element with the given CSS selector'¶
Used to tell the model how/when/why to use the tool.


Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'click_element'¶
The unique name of the tool that clearly communicates its purpose.
param playwright_strict: bool = False¶
Whether to employ Playwright’s strict mode when clicking on elements.
param playwright_timeout: float = 1000¶
Timeout (in ms) for Playwright to wait for element to be ready.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param sync_browser: Optional['SyncBrowser'] = None¶
param verbose: bool = False¶
Whether to log the tool’s progress.
param visible_only: bool = True¶
Whether to consider only visible elements.
__call__(tool_input: str, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → str¶
Make tool callable.
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, **kwargs: Any) → Any¶
Run the tool asynchronously.
classmethod from_browser(sync_browser: Optional[SyncBrowser] = None, async_browser: Optional[AsyncBrowser] = None) → BaseBrowserTool¶
Instantiate the tool.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.


Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
validator validate_browser_provided  »  all fields¶
Check that the arguments are valid.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.json.tool.JsonGetValueTool¶
class langchain.tools.json.tool.JsonGetValueTool(*, name: str = 'json_spec_get_value', description: str = '\n    Can be used to see value in string format at a given path.\n    Before calling this you should be SURE that the path to this exists.\n    The input is a text representation of the path to the dict in Python syntax (e.g. data["key1"][0]["key2"]).\n    ', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, spec: JsonSpec)[source]¶
Bases: BaseTool
Tool for getting a value in a JSON spec.
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = '\n    Can be used to see value in string format at a given path.\n    Before calling this you should be SURE that the path to this exists.\n    The input is a text representation of the path to the dict in Python syntax (e.g. data["key1"][0]["key2"]).\n    '¶


Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'json_spec_get_value'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param spec: JsonSpec [Required]¶
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.


model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.openapi.utils.api_models.APIProperty¶
class langchain.tools.openapi.utils.api_models.APIProperty(*, name: str, required: bool, type: Union[str, Type, tuple, None, Enum] = None, default: Optional[Any] = None, description: Optional[str] = None, location: APIPropertyLocation)[source]¶
Bases: APIPropertyBase
A model for a property in the query, path, header, or cookie params.
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 default: Optional[Any] = None¶
The default value of the property.
param description: Optional[str] = None¶
The description of the property.
param location: langchain.tools.openapi.utils.api_models.APIPropertyLocation [Required]¶
The path/how it’s being passed to the endpoint.
param name: str [Required]¶
The name of the property.
param required: bool [Required]¶
Whether the property is required.
param type: Union[str, Type, tuple, None, enum.Enum] = None¶
The type of the property.
Either a primitive type, a component/parameter type,
or an array or ‘object’ (dict) of the above.
classmethod from_parameter(parameter: Parameter, spec: OpenAPISpec) → APIProperty[source]¶
Instantiate from an OpenAPI Parameter.
static is_supported_location(location: str) → bool[source]¶
Return whether the provided location is supported.


langchain.tools.shell.tool.ShellTool¶
class langchain.tools.shell.tool.ShellTool(*, name: str = 'terminal', description: str = 'Run shell commands on this Linux machine.', args_schema: ~typing.Type[~pydantic.main.BaseModel] = <class 'langchain.tools.shell.tool.ShellInput'>, return_direct: bool = False, verbose: bool = False, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, handle_tool_error: ~typing.Optional[~typing.Union[bool, str, ~typing.Callable[[~langchain.tools.base.ToolException], str]]] = False, process: ~langchain.utilities.bash.BashProcess = None)[source]¶
Bases: BaseTool
Tool to run shell commands.
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: Type[pydantic.main.BaseModel] = <class 'langchain.tools.shell.tool.ShellInput'>¶
Schema for input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Run shell commands on this Linux machine.'¶
Description of tool.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'terminal'¶
Name of tool.
param process: langchain.utilities.bash.BashProcess [Optional]¶


param process: langchain.utilities.bash.BashProcess [Optional]¶
Bash process to run commands.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param 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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.playwright.navigate_back.NavigateBackTool¶
class langchain.tools.playwright.navigate_back.NavigateBackTool(*, name: str = 'previous_webpage', description: str = 'Navigate back to the previous page in the browser history', args_schema: ~typing.Type[~pydantic.main.BaseModel] = <class 'pydantic.main.BaseModel'>, return_direct: bool = False, verbose: bool = False, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallbackManager]] = None, callback_manager: ~typing.Optional[~langchain.callbacks.base.BaseCallbackManager] = None, handle_tool_error: ~typing.Optional[~typing.Union[bool, str, ~typing.Callable[[~langchain.tools.base.ToolException], str]]] = False, sync_browser: Optional['SyncBrowser'] = None, async_browser: Optional['AsyncBrowser'] = None)[source]¶
Bases: BaseBrowserTool
Navigate back to the previous page in the browser history.
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: Type[BaseModel] = <class 'pydantic.main.BaseModel'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param async_browser: Optional['AsyncBrowser'] = None¶
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Navigate back to the previous page in the browser history'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.


You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param name: str = 'previous_webpage'¶
The unique name of the tool that clearly communicates its purpose.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param sync_browser: Optional['SyncBrowser'] = None¶
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 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, **kwargs: Any) → Any¶
Run the tool asynchronously.
classmethod from_browser(sync_browser: Optional[SyncBrowser] = None, async_browser: Optional[AsyncBrowser] = None) → BaseBrowserTool¶
Instantiate the tool.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
validator validate_browser_provided  »  all fields¶
Check that the arguments are valid.


validator validate_browser_provided  »  all fields¶
Check that the arguments are valid.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶


langchain.tools.searx_search.tool.SearxSearchResults¶
class langchain.tools.searx_search.tool.SearxSearchResults(*, name: str = 'Searx Search Results', description: str = 'A meta search engine.Useful for when you need to answer questions about current events.Input should be a search query. Output is a JSON array of the query results', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, wrapper: SearxSearchWrapper, num_results: int = 4, kwargs: dict = None, **extra_data: Any)[source]¶
Bases: BaseTool
Tool that has the capability to query a Searx instance and get back json.
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'A meta search engine.Useful for when you need to answer questions about current events.Input should be a search query. Output is a JSON array of the query results'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.


You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param kwargs: dict [Optional]¶
param name: str = 'Searx Search Results'¶
The unique name of the tool that clearly communicates its purpose.
param num_results: int = 4¶
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
param verbose: bool = False¶
Whether to log the tool’s progress.
param wrapper: langchain.utilities.searx_search.SearxSearchWrapper [Required]¶
__call__(tool_input: str, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → str¶
Make tool callable.
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, **kwargs: Any) → Any¶
Run the tool asynchronously.
validator raise_deprecation  »  all fields¶
Raise deprecation warning if callback_manager is used.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → Any¶
Run the tool.
property args: dict¶
property is_single_input: bool¶
Whether the tool only accepts a single input.
model Config[source]¶


Whether the tool only accepts a single input.
model Config[source]¶
Bases: object
Pydantic config.
extra = 'allow'¶


langchain.tools.office365.utils.authenticate¶
langchain.tools.office365.utils.authenticate() → Account[source]¶
Authenticate using the Microsoft Grah API


langchain.tools.gmail.search.SearchArgsSchema¶
class langchain.tools.gmail.search.SearchArgsSchema(*, query: str, resource: Resource = Resource.MESSAGES, max_results: int = 10)[source]¶
Bases: BaseModel
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 max_results: int = 10¶
The maximum number of results to return.
param query: str [Required]¶
The Gmail query. Example filters include from:sender, to:recipient, subject:subject, -filtered_term, in:folder, is:important|read|starred, after:year/mo/date, before:year/mo/date, label:label_name “exact phrase”. Search newer/older than using d (day), m (month), and y (year): newer_than:2d, older_than:1y. Attachments with extension example: filename:pdf. Multiple term matching example: from:amy OR from:david.
param resource: langchain.tools.gmail.search.Resource = Resource.MESSAGES¶
Whether to search for threads or messages.


langchain.tools.python.tool.PythonAstREPLTool¶
class langchain.tools.python.tool.PythonAstREPLTool(*, name: str = 'python_repl_ast', description: str = 'A Python shell. Use this to execute python commands. Input should be a valid python command. When using this tool, sometimes output is abbreviated - make sure it does not look abbreviated before using it in your answer.', args_schema: Optional[Type[BaseModel]] = None, return_direct: bool = False, verbose: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False, globals: Optional[Dict] = None, locals: Optional[Dict] = None, sanitize_input: bool = True)[source]¶
Bases: BaseTool
A tool for running python code in a REPL.
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: Optional[Type[BaseModel]] = None¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'A Python shell. Use this to execute python commands. Input should be a valid python command. When using this tool, sometimes output is abbreviated - make sure it does not look abbreviated before using it in your answer.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.