Tools
Core toolkit implementations.
class langchain.tools.AIPluginTool(*, name, description, args_schema=<class 'langchain.tools.plugin.AIPluginToolSchema'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, plugin, api_spec)[source]
Bases: langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[langchain.tools.plugin.AIPluginToolSchema]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
plugin (langchain.tools.plugin.AIPlugin) – 
api_spec (str) – 
Return type
None
attribute api_spec: str [Required]
attribute args_schema: Type[AIPluginToolSchema] = <class 'langchain.tools.plugin.AIPluginToolSchema'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute plugin: AIPlugin [Required]
classmethod from_plugin_url(url)[source]
Parameters
url (str) – 
Return type
langchain.tools.plugin.AIPluginTool
class langchain.tools.APIOperation(*, operation_id, description=None, base_url, path, method, properties, request_body=None)[source]
Bases: pydantic.main.BaseModel
A model for a single API operation.
Parameters
operation_id (str) – 
description (Optional[str]) – 
base_url (str) – 
path (str) – 
method (langchain.utilities.openapi.HTTPVerb) – 
properties (Sequence[langchain.tools.openapi.utils.api_models.APIProperty]) – 
request_body (Optional[langchain.tools.openapi.utils.api_models.APIRequestBody]) – 
Return type
None
attribute base_url: str [Required]
The base URL of the operation.
attribute description: Optional[str] = None
The description of the operation.
attribute method: langchain.utilities.openapi.HTTPVerb [Required]
The HTTP method of the operation.
attribute operation_id: str [Required]
The unique identifier of the operation.
attribute path: str [Required]
The path of the operation.
attribute properties: Sequence[langchain.tools.openapi.utils.api_models.APIProperty] [Required]
attribute request_body: Optional[langchain.tools.openapi.utils.api_models.APIRequestBody] = None
The request body of the operation.
classmethod from_openapi_spec(spec, path, method)[source]
Create an APIOperation from an OpenAPI spec.
Parameters
spec (langchain.utilities.openapi.OpenAPISpec) – 
path (str) – 
method (str) – 
Return type
langchain.tools.openapi.utils.api_models.APIOperation
classmethod from_openapi_url(spec_url, path, method)[source]
Create an APIOperation from an OpenAPI URL.
Parameters
spec_url (str) – 
path (str) – 
method (str) – 
Return type
langchain.tools.openapi.utils.api_models.APIOperation
to_typescript()[source]
Get typescript string representation of the operation.
Return type
str
static ts_type_from_python(type_)[source]
Parameters
type_ (Union[str, Type, tuple, None, enum.Enum]) – 
Return type
str
property body_params: List[str]
property path_params: List[str]
property query_params: List[str]
class langchain.tools.ArxivQueryRun(*, name='arxiv', description='A wrapper around Arxiv.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 arxiv.org. Input should be a search query.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to search using the Arxiv API.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.arxiv.ArxivAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.arxiv.ArxivAPIWrapper [Optional]
class langchain.tools.AzureCogsFormRecognizerTool(*, name='azure_cognitive_services_form_recognizer', description='A wrapper around Azure Cognitive Services Form Recognizer. Useful for when you need to extract text, tables, and key-value pairs from documents. Input should be a url to a document.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, azure_cogs_key='', azure_cogs_endpoint='', doc_analysis_client=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that queries the Azure Cognitive Services Form Recognizer API.
In order to set this up, follow instructions at:
https://learn.microsoft.com/en-us/azure/applied-ai-services/form-recognizer/quickstarts/get-started-sdks-rest-api?view=form-recog-3.0.0&pivots=programming-language-python
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
azure_cogs_key (str) – 
azure_cogs_endpoint (str) – 
doc_analysis_client (Any) – 
Return type
None
class langchain.tools.AzureCogsImageAnalysisTool(*, name='azure_cognitive_services_image_analysis', description='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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, azure_cogs_key='', azure_cogs_endpoint='', vision_service=None, analysis_options=None)[source]
Bases: langchain.tools.base.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
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
azure_cogs_key (str) – 
azure_cogs_endpoint (str) – 
vision_service (Any) – 
analysis_options (Any) – 
Return type
None
class langchain.tools.AzureCogsSpeech2TextTool(*, name='azure_cognitive_services_speech2text', description='A wrapper around Azure Cognitive Services Speech2Text. Useful for when you need to transcribe audio to text. Input should be a url to an audio file.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, azure_cogs_key='', azure_cogs_region='', speech_language='en-US', speech_config=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that queries the Azure Cognitive Services Speech2Text API.
In order to set this up, follow instructions at:
https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/get-started-speech-to-text?pivots=programming-language-python
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
azure_cogs_key (str) – 
azure_cogs_region (str) – 
speech_language (str) – 
speech_config (Any) – 
Return type
None
class langchain.tools.AzureCogsText2SpeechTool(*, name='azure_cognitive_services_text2speech', description='A wrapper around Azure Cognitive Services Text2Speech. Useful for when you need to convert text to speech. ', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, azure_cogs_key='', azure_cogs_region='', speech_language='en-US', speech_config=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that queries the Azure Cognitive Services Text2Speech API.
In order to set this up, follow instructions at:
https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/get-started-text-to-speech?pivots=programming-language-python
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
azure_cogs_key (str) – 
azure_cogs_region (str) – 
speech_language (str) – 
speech_config (Any) – 
Return type
None
class langchain.tools.BaseGraphQLTool(*, name='query_graphql', description="    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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, graphql_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Base tool for querying a GraphQL API.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
graphql_wrapper (langchain.utilities.graphql.GraphQLAPIWrapper) – 
Return type
None
attribute graphql_wrapper: langchain.utilities.graphql.GraphQLAPIWrapper [Required]
class langchain.tools.BaseRequestsTool(*, requests_wrapper)[source]
Bases: pydantic.main.BaseModel
Base class for requests tools.
Parameters
requests_wrapper (langchain.requests.TextRequestsWrapper) – 
Return type
None
attribute requests_wrapper: langchain.requests.TextRequestsWrapper [Required]
class langchain.tools.BaseSQLDatabaseTool(*, db)[source]
Bases: pydantic.main.BaseModel
Base tool for interacting with a SQL database.
Parameters
db (langchain.sql_database.SQLDatabase) – 
Return type
None
attribute db: langchain.sql_database.SQLDatabase [Required]
class langchain.tools.BaseSparkSQLTool(*, db)[source]
Bases: pydantic.main.BaseModel
Base tool for interacting with Spark SQL.
Parameters
db (langchain.utilities.spark_sql.SparkSQL) – 
Return type
None
attribute db: langchain.utilities.spark_sql.SparkSQL [Required]
class langchain.tools.BaseTool(*, name, description, args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False)[source]
Bases: abc.ABC, pydantic.main.BaseModel
Interface LangChain tools must implement.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
Return type
None
attribute args_schema: Optional[Type[pydantic.main.BaseModel]] = None
Pydantic model class to validate and parse the tool’s input arguments.
attribute callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None
Deprecated. Please use callbacks instead.
attribute callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None
Callbacks to be called during tool execution.
attribute 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.
attribute handle_tool_error: Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]] = False
Handle the content of the ToolException thrown.
attribute name: str [Required]
The unique name of the tool that clearly communicates its purpose.
attribute 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.
attribute verbose: bool = False
Whether to log the tool’s progress.
async arun(tool_input, verbose=None, start_color='green', color='green', callbacks=None, **kwargs)[source]
Run the tool asynchronously.
Parameters
tool_input (Union[str, Dict]) – 
verbose (Optional[bool]) – 
start_color (Optional[str]) – 
color (Optional[str]) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
kwargs (Any) – 
Return type
Any
run(tool_input, verbose=None, start_color='green', color='green', callbacks=None, **kwargs)[source]
Run the tool.
Parameters
tool_input (Union[str, Dict]) – 
verbose (Optional[bool]) – 
start_color (Optional[str]) – 
color (Optional[str]) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
kwargs (Any) – 
Return type
Any
property args: dict
property is_single_input: bool
Whether the tool only accepts a single input.
class langchain.tools.BingSearchResults(*, name='Bing Search Results JSON', description='A wrapper around Bing Search. 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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, num_results=4, api_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Tool that has capability to query the Bing Search API and get back json.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
num_results (int) – 
api_wrapper (langchain.utilities.bing_search.BingSearchAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.bing_search.BingSearchAPIWrapper [Required]
attribute num_results: int = 4
class langchain.tools.BingSearchRun(*, name='bing_search', description='A wrapper around Bing Search. Useful for when you need to answer questions about current events. Input should be a search query.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to query the Bing search API.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.bing_search.BingSearchAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.bing_search.BingSearchAPIWrapper [Required]
class langchain.tools.BraveSearch(*, name='brave_search', description='a search engine. useful for when you need to answer questions about current events. input should be a search query.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, search_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
search_wrapper (langchain.utilities.brave_search.BraveSearchWrapper) – 
Return type
None
attribute search_wrapper: BraveSearchWrapper [Required]
classmethod from_api_key(api_key, search_kwargs=None, **kwargs)[source]
Parameters
api_key (str) – 
search_kwargs (Optional[dict]) – 
kwargs (Any) – 
Return type
langchain.tools.brave_search.tool.BraveSearch
class langchain.tools.ClickTool(*, name='click_element', description='Click on an element with the given CSS selector', args_schema=<class 'langchain.tools.playwright.click.ClickToolInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, sync_browser=None, async_browser=None, visible_only=True, playwright_strict=False, playwright_timeout=1000)[source]
Bases: langchain.tools.playwright.base.BaseBrowserTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
sync_browser (Optional['SyncBrowser']) – 
async_browser (Optional['AsyncBrowser']) – 
visible_only (bool) – 
playwright_strict (bool) – 
playwright_timeout (float) – 
Return type
None
attribute args_schema: Type[BaseModel] = <class 'langchain.tools.playwright.click.ClickToolInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Click on an element with the given CSS selector'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'click_element'
The unique name of the tool that clearly communicates its purpose.
attribute playwright_strict: bool = False
Whether to employ Playwright’s strict mode when clicking on elements.
attribute playwright_timeout: float = 1000
Timeout (in ms) for Playwright to wait for element to be ready.
attribute visible_only: bool = True
Whether to consider only visible elements.
class langchain.tools.CopyFileTool(*, name='copy_file', description='Create a copy of a file in a specified location', args_schema=<class 'langchain.tools.file_management.copy.FileCopyInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, root_dir=None)[source]
Bases: langchain.tools.file_management.utils.BaseFileToolMixin, langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
root_dir (Optional[str]) – 
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.copy.FileCopyInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Create a copy of a file in a specified location'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'copy_file'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.CurrentWebPageTool(*, name='current_webpage', description='Returns the URL of the current page', args_schema=<class 'pydantic.main.BaseModel'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, sync_browser=None, async_browser=None)[source]
Bases: langchain.tools.playwright.base.BaseBrowserTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
sync_browser (Optional['SyncBrowser']) – 
async_browser (Optional['AsyncBrowser']) – 
Return type
None
attribute args_schema: Type[BaseModel] = <class 'pydantic.main.BaseModel'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute 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.
attribute name: str = 'current_webpage'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.DeleteFileTool(*, name='file_delete', description='Delete a file', args_schema=<class 'langchain.tools.file_management.delete.FileDeleteInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, root_dir=None)[source]
Bases: langchain.tools.file_management.utils.BaseFileToolMixin, langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
root_dir (Optional[str]) – 
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.delete.FileDeleteInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Delete a file'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'file_delete'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.DuckDuckGoSearchResults(*, name='DuckDuckGo Results JSON', description='A wrapper around Duck Duck Go Search. 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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, num_results=4, api_wrapper=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that queries the Duck Duck Go Search API and get back json.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
num_results (int) – 
api_wrapper (langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper [Optional]
attribute num_results: int = 4
class langchain.tools.DuckDuckGoSearchRun(*, name='duckduckgo_search', description='A wrapper around DuckDuckGo Search. Useful for when you need to answer questions about current events. Input should be a search query.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to query the DuckDuckGo search API.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper [Optional]
class langchain.tools.ExtractHyperlinksTool(*, name='extract_hyperlinks', description='Extract all hyperlinks on the current webpage', args_schema=<class 'langchain.tools.playwright.extract_hyperlinks.ExtractHyperlinksToolInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, sync_browser=None, async_browser=None)[source]
Bases: langchain.tools.playwright.base.BaseBrowserTool
Extract all hyperlinks on the page.
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
sync_browser (Optional['SyncBrowser']) – 
async_browser (Optional['AsyncBrowser']) – 
Return type
None
attribute args_schema: Type[BaseModel] = <class 'langchain.tools.playwright.extract_hyperlinks.ExtractHyperlinksToolInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Extract all hyperlinks on the current webpage'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'extract_hyperlinks'
The unique name of the tool that clearly communicates its purpose.
static scrape_page(page, html_content, absolute_urls)[source]
Parameters
page (Any) – 
html_content (str) – 
absolute_urls (bool) – 
Return type
str
class langchain.tools.ExtractTextTool(*, name='extract_text', description='Extract all the text on the current webpage', args_schema=<class 'pydantic.main.BaseModel'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, sync_browser=None, async_browser=None)[source]
Bases: langchain.tools.playwright.base.BaseBrowserTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
sync_browser (Optional['SyncBrowser']) – 
async_browser (Optional['AsyncBrowser']) – 
Return type
None
attribute args_schema: Type[BaseModel] = <class 'pydantic.main.BaseModel'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Extract all the text on the current webpage'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'extract_text'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.FileSearchTool(*, name='file_search', description='Recursively search for files in a subdirectory that match the regex pattern', args_schema=<class 'langchain.tools.file_management.file_search.FileSearchInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, root_dir=None)[source]
Bases: langchain.tools.file_management.utils.BaseFileToolMixin, langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
root_dir (Optional[str]) – 
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.file_search.FileSearchInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Recursively search for files in a subdirectory that match the regex pattern'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'file_search'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.GetElementsTool(*, name='get_elements', description='Retrieve elements in the current web page matching the given CSS selector', args_schema=<class 'langchain.tools.playwright.get_elements.GetElementsToolInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, sync_browser=None, async_browser=None)[source]
Bases: langchain.tools.playwright.base.BaseBrowserTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
sync_browser (Optional['SyncBrowser']) – 
async_browser (Optional['AsyncBrowser']) – 
Return type
None
attribute args_schema: Type[BaseModel] = <class 'langchain.tools.playwright.get_elements.GetElementsToolInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Retrieve elements in the current web page matching the given CSS selector'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'get_elements'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.GmailCreateDraft(*, name='create_gmail_draft', description='Use this tool to create a draft email with the provided message fields.', args_schema=<class 'langchain.tools.gmail.create_draft.CreateDraftSchema'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_resource=None)[source]
Bases: langchain.tools.gmail.base.GmailBaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[langchain.tools.gmail.create_draft.CreateDraftSchema]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_resource (Resource) – 
Return type
None
attribute 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.
attribute 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.
attribute name: str = 'create_gmail_draft'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.GmailGetMessage(*, name='get_gmail_message', description='Use this tool to fetch an email by message ID. Returns the thread ID, snipet, body, subject, and sender.', args_schema=<class 'langchain.tools.gmail.get_message.SearchArgsSchema'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_resource=None)[source]
Bases: langchain.tools.gmail.base.GmailBaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[langchain.tools.gmail.get_message.SearchArgsSchema]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_resource (Resource) – 
Return type
None
attribute 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.
attribute 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.
attribute name: str = 'get_gmail_message'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.GmailGetThread(*, name='get_gmail_thread', description='Use this tool to search for email messages. The input must be a valid Gmail query. The output is a JSON list of messages.', args_schema=<class 'langchain.tools.gmail.get_thread.GetThreadSchema'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_resource=None)[source]
Bases: langchain.tools.gmail.base.GmailBaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[langchain.tools.gmail.get_thread.GetThreadSchema]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_resource (Resource) – 
Return type
None
attribute args_schema: Type[langchain.tools.gmail.get_thread.GetThreadSchema] = <class 'langchain.tools.gmail.get_thread.GetThreadSchema'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Use this tool to search for email messages. The input must be a valid Gmail query. The output is a JSON list of messages.'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'get_gmail_thread'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.GmailSearch(*, name='search_gmail', description='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=<class 'langchain.tools.gmail.search.SearchArgsSchema'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_resource=None)[source]
Bases: langchain.tools.gmail.base.GmailBaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[langchain.tools.gmail.search.SearchArgsSchema]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_resource (Resource) – 
Return type
None
attribute 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.
attribute 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.
You can provide few-shot examples as a part of the description.
attribute name: str = 'search_gmail'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.GmailSendMessage(*, name='send_gmail_message', description='Use this tool to send email messages. The input is the message, recipents', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_resource=None)[source]
Bases: langchain.tools.gmail.base.GmailBaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_resource (Resource) – 
Return type
None
attribute description: str = 'Use this tool to send email messages. The input is the message, recipents'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'send_gmail_message'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.GooglePlacesTool(*, name='google_places', description='A wrapper around Google Places. Useful for when you need to validate or discover addressed from ambiguous text. Input should be a search query.', args_schema=<class 'langchain.tools.google_places.tool.GooglePlacesSchema'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to query the Google places API.
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.google_places_api.GooglePlacesAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.google_places_api.GooglePlacesAPIWrapper [Optional]
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.google_places.tool.GooglePlacesSchema'>
Pydantic model class to validate and parse the tool’s input arguments.
class langchain.tools.GoogleSearchResults(*, name='Google Search Results JSON', description='A wrapper around Google Search. 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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, num_results=4, api_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Tool that has capability to query the Google Search API and get back json.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
num_results (int) – 
api_wrapper (langchain.utilities.google_search.GoogleSearchAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.google_search.GoogleSearchAPIWrapper [Required]
attribute num_results: int = 4
class langchain.tools.GoogleSearchRun(*, name='google_search', description='A wrapper around Google Search. Useful for when you need to answer questions about current events. Input should be a search query.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to query the Google search API.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.google_search.GoogleSearchAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.google_search.GoogleSearchAPIWrapper [Required]
class langchain.tools.GoogleSerperResults(*, name='Google Serrper Results JSON', description='A low-cost Google Search API.Useful for when you need to answer questions about current events.Input should be a search query. Output is a JSON object of the query results', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that has capability to query the Serper.dev Google Search API
and get back json.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.google_serper.GoogleSerperAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.google_serper.GoogleSerperAPIWrapper [Optional]
class langchain.tools.GoogleSerperRun(*, name='google_serper', description='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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to query the Serper.dev Google search API.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.google_serper.GoogleSerperAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.google_serper.GoogleSerperAPIWrapper [Required]
class langchain.tools.HumanInputRun(*, name='human', description='You can ask a human for guidance when you think you got stuck or you are not sure what to do next. The input should be a question for the human.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, prompt_func=None, input_func=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to ask user for input.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
prompt_func (Callable[[str], None]) – 
input_func (Callable) – 
Return type
None
attribute input_func: Callable [Optional]
attribute prompt_func: Callable[[str], None] [Optional]
class langchain.tools.IFTTTWebhook(*, name, description, args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, url)[source]
Bases: langchain.tools.base.BaseTool
IFTTT Webhook.
Parameters
name (str) – name of the tool
description (str) – description of the tool
url (str) – url to hit with the json event.
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
Return type
None
attribute url: str [Required]
class langchain.tools.InfoPowerBITool(*, name='schema_powerbi', description='\n    Input to this tool is a comma-separated list of tables, output is the schema and sample rows for those tables.\n    Be sure that the tables actually exist by calling list_tables_powerbi first!\n\n    Example Input: "table1, table2, table3"\n    ', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, powerbi)[source]
Bases: langchain.tools.base.BaseTool
Tool for getting metadata about a PowerBI Dataset.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
powerbi (langchain.utilities.powerbi.PowerBIDataset) – 
Return type
None
attribute powerbi: langchain.utilities.powerbi.PowerBIDataset [Required]
class langchain.tools.InfoSQLDatabaseTool(*, name='sql_db_schema', description='\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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, db)[source]
Bases: langchain.tools.sql_database.tool.BaseSQLDatabaseTool, langchain.tools.base.BaseTool
Tool for getting metadata about a SQL database.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
db (langchain.sql_database.SQLDatabase) – 
Return type
None
class langchain.tools.InfoSparkSQLTool(*, name='schema_sql_db', description='\n    Input to this tool is a comma-separated list of tables, output is the schema and sample rows for those tables.\n    Be sure that the tables actually exist by calling list_tables_sql_db first!\n\n    Example Input: "table1, table2, table3"\n    ', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, db)[source]
Bases: langchain.tools.spark_sql.tool.BaseSparkSQLTool, langchain.tools.base.BaseTool
Tool for getting metadata about a Spark SQL.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
db (langchain.utilities.spark_sql.SparkSQL) – 
Return type
None
class langchain.tools.JiraAction(*, name='', description='', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None, mode)[source]
Bases: langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.jira.JiraAPIWrapper) – 
mode (str) – 
Return type
None
attribute api_wrapper: langchain.utilities.jira.JiraAPIWrapper [Optional]
attribute mode: str [Required]
class langchain.tools.JsonGetValueTool(*, name='json_spec_get_value', description='\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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, spec)[source]
Bases: langchain.tools.base.BaseTool
Tool for getting a value in a JSON spec.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
spec (langchain.tools.json.tool.JsonSpec) – 
Return type
None
attribute spec: JsonSpec [Required]
class langchain.tools.JsonListKeysTool(*, name='json_spec_list_keys', description='\n    Can be used to list all keys 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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, spec)[source]
Bases: langchain.tools.base.BaseTool
Tool for listing keys in a JSON spec.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
spec (langchain.tools.json.tool.JsonSpec) – 
Return type
None
attribute spec: JsonSpec [Required]
class langchain.tools.ListDirectoryTool(*, name='list_directory', description='List files and directories in a specified folder', args_schema=<class 'langchain.tools.file_management.list_dir.DirectoryListingInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, root_dir=None)[source]
Bases: langchain.tools.file_management.utils.BaseFileToolMixin, langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
root_dir (Optional[str]) – 
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.list_dir.DirectoryListingInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'List files and directories in a specified folder'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'list_directory'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.ListPowerBITool(*, name='list_tables_powerbi', description='Input is an empty string, output is a comma separated list of tables in the database.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, powerbi)[source]
Bases: langchain.tools.base.BaseTool
Tool for getting tables names.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
powerbi (langchain.utilities.powerbi.PowerBIDataset) – 
Return type
None
attribute powerbi: langchain.utilities.powerbi.PowerBIDataset [Required]
class langchain.tools.ListSQLDatabaseTool(*, name='sql_db_list_tables', description='Input is an empty string, output is a comma separated list of tables in the database.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, db)[source]
Bases: langchain.tools.sql_database.tool.BaseSQLDatabaseTool, langchain.tools.base.BaseTool
Tool for getting tables names.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
db (langchain.sql_database.SQLDatabase) – 
Return type
None
class langchain.tools.ListSparkSQLTool(*, name='list_tables_sql_db', description='Input is an empty string, output is a comma separated list of tables in the Spark SQL.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, db)[source]
Bases: langchain.tools.spark_sql.tool.BaseSparkSQLTool, langchain.tools.base.BaseTool
Tool for getting tables names.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
db (langchain.utilities.spark_sql.SparkSQL) – 
Return type
None
class langchain.tools.MetaphorSearchResults(*, name='metaphor_search_results_json', description='A wrapper around Metaphor Search. Input should be a Metaphor-optimized query. Output is a JSON array of the query results', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Tool that has capability to query the Metaphor Search API and get back json.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper [Required]
class langchain.tools.MoveFileTool(*, name='move_file', description='Move or rename a file from one location to another', args_schema=<class 'langchain.tools.file_management.move.FileMoveInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, root_dir=None)[source]
Bases: langchain.tools.file_management.utils.BaseFileToolMixin, langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
root_dir (Optional[str]) – 
Return type
None
attribute 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.
attribute 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.
attribute name: str = 'move_file'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.NavigateBackTool(*, name='previous_webpage', description='Navigate back to the previous page in the browser history', args_schema=<class 'pydantic.main.BaseModel'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, sync_browser=None, async_browser=None)[source]
Bases: langchain.tools.playwright.base.BaseBrowserTool
Navigate back to the previous page in the browser history.
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
sync_browser (Optional['SyncBrowser']) – 
async_browser (Optional['AsyncBrowser']) – 
Return type
None
attribute args_schema: Type[BaseModel] = <class 'pydantic.main.BaseModel'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute 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.
attribute name: str = 'previous_webpage'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.NavigateTool(*, name='navigate_browser', description='Navigate a browser to the specified URL', args_schema=<class 'langchain.tools.playwright.navigate.NavigateToolInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, sync_browser=None, async_browser=None)[source]
Bases: langchain.tools.playwright.base.BaseBrowserTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
sync_browser (Optional['SyncBrowser']) – 
async_browser (Optional['AsyncBrowser']) – 
Return type
None
attribute args_schema: Type[BaseModel] = <class 'langchain.tools.playwright.navigate.NavigateToolInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Navigate a browser to the specified URL'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'navigate_browser'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.OpenAPISpec(*, openapi='3.1.0', info, jsonSchemaDialect=None, servers=[Server(url='/', description=None, variables=None)], paths=None, webhooks=None, components=None, security=None, tags=None, externalDocs=None)[source]
Bases: openapi_schema_pydantic.v3.v3_1_0.open_api.OpenAPI
OpenAPI Model that removes misformatted parts of the spec.
Parameters
openapi (str) – 
info (openapi_schema_pydantic.v3.v3_1_0.info.Info) – 
jsonSchemaDialect (Optional[str]) – 
servers (List[openapi_schema_pydantic.v3.v3_1_0.server.Server]) – 
paths (Optional[Dict[str, openapi_schema_pydantic.v3.v3_1_0.path_item.PathItem]]) – 
webhooks (Optional[Dict[str, Union[openapi_schema_pydantic.v3.v3_1_0.path_item.PathItem, openapi_schema_pydantic.v3.v3_1_0.reference.Reference]]]) – 
components (Optional[openapi_schema_pydantic.v3.v3_1_0.components.Components]) – 
security (Optional[List[Dict[str, List[str]]]]) – 
tags (Optional[List[openapi_schema_pydantic.v3.v3_1_0.tag.Tag]]) – 
externalDocs (Optional[openapi_schema_pydantic.v3.v3_1_0.external_documentation.ExternalDocumentation]) – 
Return type
None
classmethod from_file(path)[source]
Get an OpenAPI spec from a file path.
Parameters
path (Union[str, pathlib.Path]) – 
Return type
langchain.utilities.openapi.OpenAPISpec
classmethod from_spec_dict(spec_dict)[source]
Get an OpenAPI spec from a dict.
Parameters
spec_dict (dict) – 
Return type
langchain.utilities.openapi.OpenAPISpec
classmethod from_text(text)[source]
Get an OpenAPI spec from a text.
Parameters
text (str) – 
Return type
langchain.utilities.openapi.OpenAPISpec
classmethod from_url(url)[source]
Get an OpenAPI spec from a URL.
Parameters
url (str) – 
Return type
langchain.utilities.openapi.OpenAPISpec
static get_cleaned_operation_id(operation, path, method)[source]
Get a cleaned operation id from an operation id.
Parameters
operation (openapi_schema_pydantic.v3.v3_1_0.operation.Operation) – 
path (str) – 
method (str) – 
Return type
str
get_methods_for_path(path)[source]
Return a list of valid methods for the specified path.
Parameters
path (str) – 
Return type
List[str]
get_operation(path, method)[source]
Get the operation object for a given path and HTTP method.
Parameters
path (str) – 
method (str) – 
Return type
openapi_schema_pydantic.v3.v3_1_0.operation.Operation
get_parameters_for_operation(operation)[source]
Get the components for a given operation.
Parameters
operation (openapi_schema_pydantic.v3.v3_1_0.operation.Operation) – 
Return type
List[openapi_schema_pydantic.v3.v3_1_0.parameter.Parameter]
get_parameters_for_path(path)[source]
Parameters
path (str) – 
Return type
List[openapi_schema_pydantic.v3.v3_1_0.parameter.Parameter]
get_referenced_schema(ref)[source]
Get a schema (or nested reference) or err.
Parameters
ref (openapi_schema_pydantic.v3.v3_1_0.reference.Reference) – 
Return type
openapi_schema_pydantic.v3.v3_1_0.schema.Schema
get_request_body_for_operation(operation)[source]
Get the request body for a given operation.
Parameters
operation (openapi_schema_pydantic.v3.v3_1_0.operation.Operation) – 
Return type
Optional[openapi_schema_pydantic.v3.v3_1_0.request_body.RequestBody]
get_schema(schema)[source]
Parameters
schema (Union[openapi_schema_pydantic.v3.v3_1_0.reference.Reference, openapi_schema_pydantic.v3.v3_1_0.schema.Schema]) – 
Return type
openapi_schema_pydantic.v3.v3_1_0.schema.Schema
classmethod parse_obj(obj)[source]
Parameters
obj (dict) – 
Return type
langchain.utilities.openapi.OpenAPISpec
property base_url: str
Get the base url.
class langchain.tools.OpenWeatherMapQueryRun(*, name='OpenWeatherMap', description='A wrapper around OpenWeatherMap API. Useful for fetching current weather information for a specified location. Input should be a location string (e.g. London,GB).', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to query using the OpenWeatherMap API.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.openweathermap.OpenWeatherMapAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.openweathermap.OpenWeatherMapAPIWrapper [Optional]
class langchain.tools.PubmedQueryRun(*, name='PubMed', description='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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to search using the PubMed API.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.pupmed.PubMedAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.pupmed.PubMedAPIWrapper [Optional]
class langchain.tools.PythonAstREPLTool(*, name='python_repl_ast', description='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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, globals=None, locals=None, sanitize_input=True)[source]
Bases: langchain.tools.base.BaseTool
A tool for running python code in a REPL.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
globals (Optional[Dict]) – 
locals (Optional[Dict]) – 
sanitize_input (bool) – 
Return type
None
attribute globals: Optional[Dict] [Optional]
attribute locals: Optional[Dict] [Optional]
attribute sanitize_input: bool = True
class langchain.tools.PythonREPLTool(*, name='Python_REPL', description='A Python shell. Use this to execute python commands. Input should be a valid python command. If you want to see the output of a value, you should print it out with `print(...)`.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, python_repl=None, sanitize_input=True)[source]
Bases: langchain.tools.base.BaseTool
A tool for running python code in a REPL.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
python_repl (langchain.utilities.python.PythonREPL) – 
sanitize_input (bool) – 
Return type
None
attribute python_repl: langchain.utilities.python.PythonREPL [Optional]
attribute sanitize_input: bool = True
class langchain.tools.QueryCheckerTool(*, name='query_checker_sql_db', description='\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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, db, template='\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, llm_chain)[source]
Bases: langchain.tools.spark_sql.tool.BaseSparkSQLTool, langchain.tools.base.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/
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
db (langchain.utilities.spark_sql.SparkSQL) – 
template (str) – 
llm (langchain.base_language.BaseLanguageModel) – 
llm_chain (langchain.chains.llm.LLMChain) – 
Return type
None
attribute llm: langchain.base_language.BaseLanguageModel [Required]
attribute llm_chain: langchain.chains.llm.LLMChain [Required]
attribute 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.'
class langchain.tools.QueryPowerBITool(*, name='query_powerbi', description='\n    Input to this tool is a detailed question about the dataset, output is a result from the dataset. It will try to answer the question using the dataset, and if it cannot, it will ask for clarification.\n\n    Example Input: "How many rows are in table1?"\n    ', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, llm_chain, powerbi, template='\nAnswer the question below with a DAX query that can be sent to Power BI. DAX queries have a simple syntax comprised of just one required keyword, EVALUATE, and several optional keywords: ORDER BY, START AT, DEFINE, MEASURE, VAR, TABLE, and COLUMN. Each keyword defines a statement used for the duration of the query. Any time < or > are used in the text below it means that those values need to be replaced by table, columns or other things. If the question is not something you can answer with a DAX query, reply with "I cannot answer this" and the question will be escalated to a human.\n\nSome DAX functions return a table instead of a scalar, and must be wrapped in a function that evaluates the table and returns a scalar; unless the table is a single column, single row table, then it is treated as a scalar value. Most DAX functions require one or more arguments, which can include tables, columns, expressions, and values. However, some functions, such as PI, do not require any arguments, but always require parentheses to indicate the null argument. For example, you must always type PI(), not PI. You can also nest functions within other functions. \n\nSome commonly used functions are:\nEVALUATE <table> - At the most basic level, a DAX query is an EVALUATE statement containing a table expression. At least one EVALUATE statement is required, however, a query can contain any number of EVALUATE statements.\nEVALUATE <table> ORDER BY <expression> ASC or DESC - The optional ORDER BY keyword defines one or more expressions used to sort query results. Any expression that can be evaluated for each row of the result is valid.\nEVALUATE <table> ORDER BY <expression> ASC or DESC START AT <value> or <parameter> - The optional START AT keyword is used inside an ORDER BY clause. It defines the value at which the query results begin.\nDEFINE MEASURE | VAR; EVALUATE <table> - The optional DEFINE keyword introduces one or more calculated entity definitions that exist only for the duration of the query. Definitions precede the EVALUATE statement and are valid for all EVALUATE statements in the query. Definitions can be variables, measures, tables1, and columns1. Definitions can reference other definitions that appear before or after the current definition. At least one definition is required if the DEFINE keyword is included in a query.\nMEASURE <table name>[<measure name>] = <scalar expression> - Introduces a measure definition in a DEFINE statement of a DAX query.\nVAR <name> = <expression> - Stores the result of an expression as a named variable, which can then be passed as an argument to other measure expressions. Once resultant values have been calculated for a variable expression, those values do not change, even if the variable is referenced in another expression.\n\nFILTER(<table>,<filter>) - Returns a table that represents a subset of another table or expression, where <filter> is a Boolean expression that is to be evaluated for each row of the table. For example, [Amount] > 0 or [Region] = "France"\nROW(<name>, <expression>) - Returns a table with a single row containing values that result from the expressions given to each column.\nDISTINCT(<column>) - Returns a one-column table that contains the distinct values from the specified column. In other words, duplicate values are removed and only unique values are returned. This function cannot be used to Return values into a cell or column on a worksheet; rather, you nest the DISTINCT function within a formula, to get a list of distinct values that can be passed to another function and then counted, summed, or used for other operations.\nDISTINCT(<table>) - Returns a table by removing duplicate rows from another table or expression.\n\nAggregation functions, names with a A in it, handle booleans and empty strings in appropriate ways, while the same function without A only uses the numeric values in a column. Functions names with an X in it can include a expression as an argument, this will be evaluated for each row in the table and the result will be used in the regular function calculation, these are the functions:\nCOUNT(<column>), COUNTA(<column>), COUNTX(<table>,<expression>), COUNTAX(<table>,<expression>), COUNTROWS([<table>]), COUNTBLANK(<column>), DISTINCTCOUNT(<column>), DISTINCTCOUNTNOBLANK (<column>) - these are all variantions of count functions.\nAVERAGE(<column>), AVERAGEA(<column>), AVERAGEX(<table>,<expression>) - these are all variantions of average functions.\nMAX(<column>), MAXA(<column>), MAXX(<table>,<expression>) - these are all variantions of max functions.\nMIN(<column>), MINA(<column>), MINX(<table>,<expression>) - these are all variantions of min functions.\nPRODUCT(<column>), PRODUCTX(<table>,<expression>) - these are all variantions of product functions.\nSUM(<column>), SUMX(<table>,<expression>) - these are all variantions of sum functions.\n\nDate and time functions:\nDATE(year, month, day) - Returns a date value that represents the specified year, month, and day.\nDATEDIFF(date1, date2, <interval>) - Returns the difference between two date values, in the specified interval, that can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR.\nDATEVALUE(<date_text>) - Returns a date value that represents the specified date.\nYEAR(<date>), QUARTER(<date>), MONTH(<date>), DAY(<date>), HOUR(<date>), MINUTE(<date>), SECOND(<date>) - Returns the part of the date for the specified date.\n\nFinally, make sure to escape double quotes with a single backslash, and make sure that only table names have single quotes around them, while names of measures or the values of columns that you want to compare against are in escaped double quotes. Newlines are not necessary and can be skipped. The queries are serialized as json and so will have to fit be compliant with json syntax. Sometimes you will get a question, a DAX query and a error, in that case you need to rewrite the DAX query to get the correct answer.\n\nThe following tables exist: {tables}\n\nand the schema\'s for some are given here:\n{schemas}\n\nExamples:\n{examples}\n\nQuestion: {tool_input}\nDAX: \n', examples='\nQuestion: How many rows are in the table <table>?\nDAX: EVALUATE ROW("Number of rows", COUNTROWS(<table>))\n----\nQuestion: How many rows are in the table <table> where <column> is not empty?\nDAX: EVALUATE ROW("Number of rows", COUNTROWS(FILTER(<table>, <table>[<column>] <> "")))\n----\nQuestion: What was the average of <column> in <table>?\nDAX: EVALUATE ROW("Average", AVERAGE(<table>[<column>]))\n----\n', session_cache=None, max_iterations=5)[source]
Bases: langchain.tools.base.BaseTool
Tool for querying a Power BI Dataset.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
llm_chain (langchain.chains.llm.LLMChain) – 
powerbi (langchain.utilities.powerbi.PowerBIDataset) – 
template (Optional[str]) – 
examples (Optional[str]) – 
session_cache (Dict[str, Any]) – 
max_iterations (int) – 
Return type
None
attribute examples: Optional[str] = '\nQuestion: How many rows are in the table <table>?\nDAX: EVALUATE ROW("Number of rows", COUNTROWS(<table>))\n----\nQuestion: How many rows are in the table <table> where <column> is not empty?\nDAX: EVALUATE ROW("Number of rows", COUNTROWS(FILTER(<table>, <table>[<column>] <> "")))\n----\nQuestion: What was the average of <column> in <table>?\nDAX: EVALUATE ROW("Average", AVERAGE(<table>[<column>]))\n----\n'
attribute llm_chain: langchain.chains.llm.LLMChain [Required]
attribute max_iterations: int = 5
attribute powerbi: langchain.utilities.powerbi.PowerBIDataset [Required]
attribute session_cache: Dict[str, Any] [Optional]
attribute template: Optional[str] = '\nAnswer the question below with a DAX query that can be sent to Power BI. DAX queries have a simple syntax comprised of just one required keyword, EVALUATE, and several optional keywords: ORDER BY, START AT, DEFINE, MEASURE, VAR, TABLE, and COLUMN. Each keyword defines a statement used for the duration of the query. Any time < or > are used in the text below it means that those values need to be replaced by table, columns or other things. If the question is not something you can answer with a DAX query, reply with "I cannot answer this" and the question will be escalated to a human.\n\nSome DAX functions return a table instead of a scalar, and must be wrapped in a function that evaluates the table and returns a scalar; unless the table is a single column, single row table, then it is treated as a scalar value. Most DAX functions require one or more arguments, which can include tables, columns, expressions, and values. However, some functions, such as PI, do not require any arguments, but always require parentheses to indicate the null argument. For example, you must always type PI(), not PI. You can also nest functions within other functions. \n\nSome commonly used functions are:\nEVALUATE <table> - At the most basic level, a DAX query is an EVALUATE statement containing a table expression. At least one EVALUATE statement is required, however, a query can contain any number of EVALUATE statements.\nEVALUATE <table> ORDER BY <expression> ASC or DESC - The optional ORDER BY keyword defines one or more expressions used to sort query results. Any expression that can be evaluated for each row of the result is valid.\nEVALUATE <table> ORDER BY <expression> ASC or DESC START AT <value> or <parameter> - The optional START AT keyword is used inside an ORDER BY clause. It defines the value at which the query results begin.\nDEFINE MEASURE | VAR; EVALUATE <table> - The optional DEFINE keyword introduces one or more calculated entity definitions that exist only for the duration of the query. Definitions precede the EVALUATE statement and are valid for all EVALUATE statements in the query. Definitions can be variables, measures, tables1, and columns1. Definitions can reference other definitions that appear before or after the current definition. At least one definition is required if the DEFINE keyword is included in a query.\nMEASURE <table name>[<measure name>] = <scalar expression> - Introduces a measure definition in a DEFINE statement of a DAX query.\nVAR <name> = <expression> - Stores the result of an expression as a named variable, which can then be passed as an argument to other measure expressions. Once resultant values have been calculated for a variable expression, those values do not change, even if the variable is referenced in another expression.\n\nFILTER(<table>,<filter>) - Returns a table that represents a subset of another table or expression, where <filter> is a Boolean expression that is to be evaluated for each row of the table. For example, [Amount] > 0 or [Region] = "France"\nROW(<name>, <expression>) - Returns a table with a single row containing values that result from the expressions given to each column.\nDISTINCT(<column>) - Returns a one-column table that contains the distinct values from the specified column. In other words, duplicate values are removed and only unique values are returned. This function cannot be used to Return values into a cell or column on a worksheet; rather, you nest the DISTINCT function within a formula, to get a list of distinct values that can be passed to another function and then counted, summed, or used for other operations.\nDISTINCT(<table>) - Returns a table by removing duplicate rows from another table or expression.\n\nAggregation functions, names with a A in it, handle booleans and empty strings in appropriate ways, while the same function without A only uses the numeric values in a column. Functions names with an X in it can include a expression as an argument, this will be evaluated for each row in the table and the result will be used in the regular function calculation, these are the functions:\nCOUNT(<column>), COUNTA(<column>), COUNTX(<table>,<expression>), COUNTAX(<table>,<expression>), COUNTROWS([<table>]), COUNTBLANK(<column>), DISTINCTCOUNT(<column>), DISTINCTCOUNTNOBLANK (<column>) - these are all variantions of count functions.\nAVERAGE(<column>), AVERAGEA(<column>), AVERAGEX(<table>,<expression>) - these are all variantions of average functions.\nMAX(<column>), MAXA(<column>), MAXX(<table>,<expression>) - these are all variantions of max functions.\nMIN(<column>), MINA(<column>), MINX(<table>,<expression>) - these are all variantions of min functions.\nPRODUCT(<column>), PRODUCTX(<table>,<expression>) - these are all variantions of product functions.\nSUM(<column>), SUMX(<table>,<expression>) - these are all variantions of sum functions.\n\nDate and time functions:\nDATE(year, month, day) - Returns a date value that represents the specified year, month, and day.\nDATEDIFF(date1, date2, <interval>) - Returns the difference between two date values, in the specified interval, that can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR.\nDATEVALUE(<date_text>) - Returns a date value that represents the specified date.\nYEAR(<date>), QUARTER(<date>), MONTH(<date>), DAY(<date>), HOUR(<date>), MINUTE(<date>), SECOND(<date>) - Returns the part of the date for the specified date.\n\nFinally, make sure to escape double quotes with a single backslash, and make sure that only table names have single quotes around them, while names of measures or the values of columns that you want to compare against are in escaped double quotes. Newlines are not necessary and can be skipped. The queries are serialized as json and so will have to fit be compliant with json syntax. Sometimes you will get a question, a DAX query and a error, in that case you need to rewrite the DAX query to get the correct answer.\n\nThe following tables exist: {tables}\n\nand the schema\'s for some are given here:\n{schemas}\n\nExamples:\n{examples}\n\nQuestion: {tool_input}\nDAX: \n'
class langchain.tools.QuerySQLCheckerTool(*, name='sql_db_query_checker', description='\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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, db, template='\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, llm_chain)[source]
Bases: langchain.tools.sql_database.tool.BaseSQLDatabaseTool, langchain.tools.base.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/
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
db (langchain.sql_database.SQLDatabase) – 
template (str) – 
llm (langchain.base_language.BaseLanguageModel) – 
llm_chain (langchain.chains.llm.LLMChain) – 
Return type
None
attribute llm: langchain.base_language.BaseLanguageModel [Required]
attribute llm_chain: langchain.chains.llm.LLMChain [Required]
attribute 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.'
class langchain.tools.QuerySQLDataBaseTool(*, name='sql_db_query', description='\n    Input to this tool is a detailed and correct SQL query, output is a result from the database.\n    If the query is not correct, an error message will be returned.\n    If an error is returned, rewrite the query, check the query, and try again.\n    ', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, db)[source]
Bases: langchain.tools.sql_database.tool.BaseSQLDatabaseTool, langchain.tools.base.BaseTool
Tool for querying a SQL database.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
db (langchain.sql_database.SQLDatabase) – 
Return type
None
class langchain.tools.QuerySparkSQLTool(*, name='query_sql_db', description='\n    Input to this tool is a detailed and correct SQL query, output is a result from the Spark SQL.\n    If the query is not correct, an error message will be returned.\n    If an error is returned, rewrite the query, check the query, and try again.\n    ', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, db)[source]
Bases: langchain.tools.spark_sql.tool.BaseSparkSQLTool, langchain.tools.base.BaseTool
Tool for querying a Spark SQL.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
db (langchain.utilities.spark_sql.SparkSQL) – 
Return type
None
class langchain.tools.ReadFileTool(*, name='read_file', description='Read file from disk', args_schema=<class 'langchain.tools.file_management.read.ReadFileInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, root_dir=None)[source]
Bases: langchain.tools.file_management.utils.BaseFileToolMixin, langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
root_dir (Optional[str]) – 
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.read.ReadFileInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Read file from disk'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'read_file'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.RequestsDeleteTool(*, name='requests_delete', description='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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, requests_wrapper)[source]
Bases: langchain.tools.requests.tool.BaseRequestsTool, langchain.tools.base.BaseTool
Tool for making a DELETE request to an API endpoint.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
requests_wrapper (langchain.requests.TextRequestsWrapper) – 
Return type
None
class langchain.tools.RequestsGetTool(*, name='requests_get', description='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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, requests_wrapper)[source]
Bases: langchain.tools.requests.tool.BaseRequestsTool, langchain.tools.base.BaseTool
Tool for making a GET request to an API endpoint.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
requests_wrapper (langchain.requests.TextRequestsWrapper) – 
Return type
None
class langchain.tools.RequestsPatchTool(*, name='requests_patch', description='Use this when you want to PATCH 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 PATCH 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 PATCH request.\n    ', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, requests_wrapper)[source]
Bases: langchain.tools.requests.tool.BaseRequestsTool, langchain.tools.base.BaseTool
Tool for making a PATCH request to an API endpoint.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
requests_wrapper (langchain.requests.TextRequestsWrapper) – 
Return type
None
class langchain.tools.RequestsPostTool(*, name='requests_post', description='Use this when you want to POST 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 POST 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 POST request.\n    ', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, requests_wrapper)[source]
Bases: langchain.tools.requests.tool.BaseRequestsTool, langchain.tools.base.BaseTool
Tool for making a POST request to an API endpoint.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
requests_wrapper (langchain.requests.TextRequestsWrapper) – 
Return type
None
class langchain.tools.RequestsPutTool(*, name='requests_put', description='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    ', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, requests_wrapper)[source]
Bases: langchain.tools.requests.tool.BaseRequestsTool, langchain.tools.base.BaseTool
Tool for making a PUT request to an API endpoint.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
requests_wrapper (langchain.requests.TextRequestsWrapper) – 
Return type
None
class langchain.tools.SceneXplainTool(*, name='image_explainer', description='An Image Captioning Tool: Use this tool to generate a detailed caption for an image. The input can be an image file of any format, and the output will be a text description that covers every detail of the image.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to explain images.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.scenexplain.SceneXplainAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.scenexplain.SceneXplainAPIWrapper [Optional]
class langchain.tools.SearxSearchResults(*, name='Searx Search Results', description='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=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, wrapper, num_results=4, kwargs=None, **extra_data)[source]
Bases: langchain.tools.base.BaseTool
Tool that has the capability to query a Searx instance and get back json.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
wrapper (langchain.utilities.searx_search.SearxSearchWrapper) – 
num_results (int) – 
kwargs (dict) – 
extra_data (Any) – 
Return type
None
attribute kwargs: dict [Optional]
attribute num_results: int = 4
attribute wrapper: langchain.utilities.searx_search.SearxSearchWrapper [Required]
class langchain.tools.SearxSearchRun(*, name='searx_search', description='A meta search engine.Useful for when you need to answer questions about current events.Input should be a search query.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, wrapper, kwargs=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to query a Searx instance.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
wrapper (langchain.utilities.searx_search.SearxSearchWrapper) – 
kwargs (dict) – 
Return type
None
attribute kwargs: dict [Optional]
attribute wrapper: langchain.utilities.searx_search.SearxSearchWrapper [Required]
class langchain.tools.ShellTool(*, name='terminal', description='Run shell commands on this Linux machine.', args_schema=<class 'langchain.tools.shell.tool.ShellInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, process=None)[source]
Bases: langchain.tools.base.BaseTool
Tool to run shell commands.
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
process (langchain.utilities.bash.BashProcess) – 
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.shell.tool.ShellInput'>
Schema for input arguments.
attribute description: str = 'Run shell commands on this Linux machine.'
Description of tool.
attribute name: str = 'terminal'
Name of tool.
attribute process: langchain.utilities.bash.BashProcess [Optional]
Bash process to run commands.
class langchain.tools.SleepTool(*, name='sleep', description='Make agent sleep for a specified number of seconds.', args_schema=<class 'langchain.tools.sleep.tool.SleepInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to sleep.
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.sleep.tool.SleepInput'>
Pydantic model class to validate and parse the tool’s input arguments.
langchain.tools.StdInInquireTool(*args, **kwargs)[source]
Tool for asking the user for input.
Parameters
args (Any) – 
kwargs (Any) – 
Return type
langchain.tools.human.tool.HumanInputRun
class langchain.tools.SteamshipImageGenerationTool(*, name='GenerateImage', description='Useful for when you need to generate an image.Input: A detailed text-2-image prompt describing an imageOutput: the UUID of a generated image', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, model_name, size='512x512', steamship, return_urls=False)[source]
Bases: langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
model_name (langchain.tools.steamship_image_generation.tool.ModelName) – 
size (Optional[str]) – 
steamship (Steamship) – 
return_urls (Optional[bool]) – 
Return type
None
attribute model_name: ModelName [Required]
attribute return_urls: Optional[bool] = False
attribute size: Optional[str] = '512x512'
attribute steamship: Steamship [Required]
class langchain.tools.StructuredTool(*, name, description='', args_schema, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, func, coroutine=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that can operate on any number of inputs.
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
func (Callable[[...], Any]) – 
coroutine (Optional[Callable[[...], Awaitable[Any]]]) – 
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] [Required]
The input arguments’ schema.
The tool schema.
attribute coroutine: Optional[Callable[[...], Awaitable[Any]]] = None
The asynchronous version of the function.
attribute description: str = ''
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute func: Callable[[...], Any] [Required]
The function to run when the tool is called.
classmethod from_function(func, name=None, description=None, return_direct=False, args_schema=None, infer_schema=True, **kwargs)[source]
Create tool from a given function.
A classmethod that helps to create a tool from a function.
Parameters
func (Callable) – The function from which to create a tool
name (Optional[str]) – The name of the tool. Defaults to the function name
description (Optional[str]) – The description of the tool. Defaults to the function docstring
return_direct (bool) – Whether to return the result directly or as a callback
args_schema (Optional[Type[pydantic.main.BaseModel]]) – The schema of the tool’s input arguments
infer_schema (bool) – Whether to infer the schema from the function’s signature
**kwargs – Additional arguments to pass to the tool
kwargs (Any) – 
Returns
The tool
Return type
langchain.tools.base.StructuredTool
Examples
… code-block:: python
def add(a: int, b: int) -> int:“””Add two numbers”””
return a + b
tool = StructuredTool.from_function(add)
tool.run(1, 2) # 3
property args: dict
The tool’s input arguments.
class langchain.tools.Tool(name, func, description, *, args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, coroutine=None)[source]
Bases: langchain.tools.base.BaseTool
Tool that takes in function or coroutine directly.
Parameters
name (str) – 
func (Callable[[...], str]) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
coroutine (Optional[Callable[[...], Awaitable[str]]]) – 
Return type
None
attribute args_schema: Optional[Type[pydantic.main.BaseModel]] = None
Pydantic model class to validate and parse the tool’s input arguments.
attribute callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None
Deprecated. Please use callbacks instead.
attribute callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None
Callbacks to be called during tool execution.
attribute coroutine: Optional[Callable[[...], Awaitable[str]]] = None
The asynchronous version of the function.
attribute description: str = ''
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute func: Callable[[...], str] [Required]
The function to run when the tool is called.
attribute handle_tool_error: Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]] = False
Handle the content of the ToolException thrown.
attribute name: str [Required]
The unique name of the tool that clearly communicates its purpose.
attribute 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.
attribute verbose: bool = False
Whether to log the tool’s progress.
classmethod from_function(func, name, description, return_direct=False, args_schema=None, **kwargs)[source]
Initialize tool from a function.
Parameters
func (Callable) – 
name (str) – 
description (str) – 
return_direct (bool) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
kwargs (Any) – 
Return type
langchain.tools.base.Tool
property args: dict
The tool’s input arguments.
class langchain.tools.VectorStoreQATool(*, name, description, args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, vectorstore, llm=None)[source]
Bases: langchain.tools.vectorstore.tool.BaseVectorStoreTool, langchain.tools.base.BaseTool
Tool for the VectorDBQA chain. To be initialized with name and chain.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
vectorstore (langchain.vectorstores.base.VectorStore) – 
llm (langchain.base_language.BaseLanguageModel) – 
Return type
None
static get_description(name, description)[source]
Parameters
name (str) – 
description (str) – 
Return type
str
class langchain.tools.VectorStoreQAWithSourcesTool(*, name, description, args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, vectorstore, llm=None)[source]
Bases: langchain.tools.vectorstore.tool.BaseVectorStoreTool, langchain.tools.base.BaseTool
Tool for the VectorDBQAWithSources chain.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
vectorstore (langchain.vectorstores.base.VectorStore) – 
llm (langchain.base_language.BaseLanguageModel) – 
Return type
None
static get_description(name, description)[source]
Parameters
name (str) – 
description (str) – 
Return type
str
class langchain.tools.WikipediaQueryRun(*, name='Wikipedia', description='A wrapper around Wikipedia. Useful for when you need to answer general questions about people, places, companies, facts, historical events, or other subjects. Input should be a search query.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to search using the Wikipedia API.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.wikipedia.WikipediaAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.wikipedia.WikipediaAPIWrapper [Required]
class langchain.tools.WolframAlphaQueryRun(*, name='wolfram_alpha', description='A wrapper around Wolfram Alpha. Useful for when you need to answer questions about Math, Science, Technology, Culture, Society and Everyday Life. Input should be a search query.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper)[source]
Bases: langchain.tools.base.BaseTool
Tool that adds the capability to query using the Wolfram Alpha SDK.
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper [Required]
class langchain.tools.WriteFileTool(*, name='write_file', description='Write file to disk', args_schema=<class 'langchain.tools.file_management.write.WriteFileInput'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, root_dir=None)[source]
Bases: langchain.tools.file_management.utils.BaseFileToolMixin, langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Type[pydantic.main.BaseModel]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
root_dir (Optional[str]) – 
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.write.WriteFileInput'>
Pydantic model class to validate and parse the tool’s input arguments.
attribute description: str = 'Write file to disk'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
attribute name: str = 'write_file'
The unique name of the tool that clearly communicates its purpose.
class langchain.tools.YouTubeSearchTool(*, name='youtube_search', description='search for youtube videos associated with a person. the input to this tool should be a comma separated list, the first part contains a person name and the second a number that is the maximum number of video results to return aka num_results. the second part is optional', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False)[source]
Bases: langchain.tools.base.BaseTool
Parameters
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
Return type
None
class langchain.tools.ZapierNLAListActions(*, name='ZapierNLA_list_actions', description='A wrapper around Zapier NLA actions. The input to this tool is a natural language instruction, for example "get the latest email from my bank" or "send a slack message to the #general channel". Each tool will have params associated with it that are specified as a list. You MUST take into account the params when creating the instruction. For example, if the params are [\'Message_Text\', \'Channel\'], your instruction should be something like \'send a slack message to the #general channel with the text hello world\'. Another example: if the params are [\'Calendar\', \'Search_Term\'], your instruction should be something like \'find the meeting in my personal calendar at 3pm\'. Do not make up params, they will be explicitly specified in the tool description. If you do not have enough information to fill in the params, just say \'not enough information provided in the instruction, missing <param>\'. If you get a none or null response, STOP EXECUTION, do not try to another tool!This tool specifically used for: {zapier_description}, and has params: {params}This tool returns a list of the user\'s exposed actions.', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None)[source]
Bases: langchain.tools.base.BaseTool
Returns a list of all exposed (enabled) actions associated withcurrent user (associated with the set api_key). Change your exposed
actions here: https://nla.zapier.com/demo/start/
The return list can be empty if no actions exposed. Else will contain
a list of action objects:
[{“id”: str,
“description”: str,
“params”: Dict[str, str]
}]
params will always contain an instructions key, the only required
param. All others optional and if provided will override any AI guesses
(see “understanding the AI guessing flow” here:
https://nla.zapier.com/api/v1/docs)
Parameters
None – 
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.zapier.ZapierNLAWrapper) – 
Return type
None
attribute api_wrapper: langchain.utilities.zapier.ZapierNLAWrapper [Optional]
class langchain.tools.ZapierNLARunAction(*, name='', description='', args_schema=None, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, api_wrapper=None, action_id, params=None, base_prompt='A wrapper around Zapier NLA actions. The input to this tool is a natural language instruction, for example "get the latest email from my bank" or "send a slack message to the #general channel". Each tool will have params associated with it that are specified as a list. You MUST take into account the params when creating the instruction. For example, if the params are [\'Message_Text\', \'Channel\'], your instruction should be something like \'send a slack message to the #general channel with the text hello world\'. Another example: if the params are [\'Calendar\', \'Search_Term\'], your instruction should be something like \'find the meeting in my personal calendar at 3pm\'. Do not make up params, they will be explicitly specified in the tool description. If you do not have enough information to fill in the params, just say \'not enough information provided in the instruction, missing <param>\'. If you get a none or null response, STOP EXECUTION, do not try to another tool!This tool specifically used for: {zapier_description}, and has params: {params}', zapier_description, params_schema=None)[source]
Bases: langchain.tools.base.BaseTool
Executes an action that is identified by action_id, must be exposed(enabled) by the current user (associated with the set api_key). Change
your exposed actions here: https://nla.zapier.com/demo/start/
The return JSON is guaranteed to be less than ~500 words (350
tokens) making it safe to inject into the prompt of another LLM
call.
Parameters
action_id (str) – a specific action ID (from list actions) of the action to execute
(the set api_key must be associated with the action owner)
instructions – a natural language instruction string for using the action
(eg. “get the latest email from Mike Knoop” for “Gmail: find email” action)
params (Optional[dict]) – a dict, optional. Any params provided will override AI guesses
from instructions (see “understanding the AI guessing flow” here:
https://nla.zapier.com/api/v1/docs)
name (str) – 
description (str) – 
args_schema (Optional[Type[pydantic.main.BaseModel]]) – 
return_direct (bool) – 
verbose (bool) – 
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – 
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – 
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) – 
api_wrapper (langchain.utilities.zapier.ZapierNLAWrapper) – 
base_prompt (str) – 
zapier_description (str) – 
params_schema (Dict[str, str]) – 
Return type
None
attribute action_id: str [Required]
attribute api_wrapper: langchain.utilities.zapier.ZapierNLAWrapper [Optional]
attribute base_prompt: str = 'A wrapper around Zapier NLA actions. The input to this tool is a natural language instruction, for example "get the latest email from my bank" or "send a slack message to the #general channel". Each tool will have params associated with it that are specified as a list. You MUST take into account the params when creating the instruction. For example, if the params are [\'Message_Text\', \'Channel\'], your instruction should be something like \'send a slack message to the #general channel with the text hello world\'. Another example: if the params are [\'Calendar\', \'Search_Term\'], your instruction should be something like \'find the meeting in my personal calendar at 3pm\'. Do not make up params, they will be explicitly specified in the tool description. If you do not have enough information to fill in the params, just say \'not enough information provided in the instruction, missing <param>\'. If you get a none or null response, STOP EXECUTION, do not try to another tool!This tool specifically used for: {zapier_description}, and has params: {params}'
attribute params: Optional[dict] = None
attribute params_schema: Dict[str, str] [Optional]
attribute zapier_description: str [Required]
langchain.tools.format_tool_to_openai_function(tool)[source]
Format tool into the OpenAI function API.
Parameters
tool (langchain.tools.base.BaseTool) – 
Return type
langchain.tools.convert_to_openai.FunctionDescription
langchain.tools.tool(*args, return_direct=False, args_schema=None, infer_schema=True)[source]
Make tools out of functions, can be used with or without arguments.
Parameters
*args – The arguments to the tool.
return_direct (bool) – Whether to return directly from the tool rather
than continuing the agent loop.
args_schema (Optional[Type[pydantic.main.BaseModel]]) – optional argument schema for user to specify
infer_schema (bool) – 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.
args (Union[str, Callable]) – 
Return type
Callable
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