id
stringlengths
14
16
text
stringlengths
31
2.41k
source
stringlengths
53
121
6d859eadd4b9-12
class langchain.utilities.JiraAPIWrapper(*, jira=None, confluence=None, jira_username=None, jira_api_token=None, jira_instance_url=None, operations=[{'mode': 'jql', 'name': 'JQL Query', 'description': '\nΒ Β Β  This tool is a wrapper around atlassian-python-api\'s Jira jql API, useful when you need to search for Jira issues.\nΒ Β Β  The input to this tool is a JQL query string, and will be passed into atlassian-python-api\'s Jira `jql` function,\nΒ Β Β  For example, to find all the issues in project "Test" assigned to the me, you would pass in the following string:\nΒ Β Β  project = Test AND assignee = currentUser()\nΒ Β Β  or to find issues with summaries that contain the word "test", you would pass in the following string:\nΒ Β Β  summary ~ \'test\'\nΒ Β Β  '}, {'mode': 'get_projects', 'name': 'Get Projects', 'description': "\nΒ Β Β  This tool is a wrapper around atlassian-python-api's Jira project API, \nΒ Β Β  useful when you need to fetch all the projects the user has access to, find out how many projects there are, or as an intermediary step that involv searching by projects. \nΒ Β Β  there is no input to this tool.\nΒ Β Β  "}, {'mode': 'create_issue', 'name': 'Create Issue', 'description': '\nΒ Β Β  This tool is a wrapper around atlassian-python-api\'s Jira issue_create API, useful when you need to create a Jira issue. \nΒ Β Β  The input to this tool is a dictionary specifying the fields of the Jira issue, and will be passed into atlassian-python-api\'s Jira `issue_create` function.\nΒ Β Β  For example, to create a low priority task called "test issue" with description "test description", you would pass in the following
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-13
low priority task called "test issue" with description "test description", you would pass in the following dictionary: \nΒ Β Β  {{"summary": "test issue", "description": "test description", "issuetype": {{"name": "Task"}}, "priority": {{"name": "Low"}}}}\nΒ Β Β  '}, {'mode': 'other', 'name': 'Catch all Jira API call', 'description': '\nΒ Β Β  This tool is a wrapper around atlassian-python-api\'s Jira API.\nΒ Β Β  There are other dedicated tools for fetching all projects, and creating and searching for issues, \nΒ Β Β  use this tool if you need to perform any other actions allowed by the atlassian-python-api Jira API.\nΒ Β Β  The input to this tool is line of python code that calls a function from atlassian-python-api\'s Jira API\nΒ Β Β  For example, to update the summary field of an issue, you would pass in the following string:\nΒ Β Β  self.jira.update_issue_field(key, {{"summary": "New summary"}})\nΒ Β Β  or to find out how many projects are in the Jira instance, you would pass in the following string:\nΒ Β Β  self.jira.projects()\nΒ Β Β  For more information on the Jira API, refer to https://atlassian-python-api.readthedocs.io/jira.html\nΒ Β Β  '}, {'mode': 'create_page', 'name': 'Create confluence page', 'description': 'This tool is a wrapper around atlassian-python-api\'s Confluence \natlassian-python-api API, useful when you need to create a Confluence page. The input to this tool is a dictionary \nspecifying the fields of the Confluence page, and will be passed into atlassian-python-api\'s Confluence `create_page` \nfunction. For example, to create a page in the DEMO space titled "This is the title" with body "This is the body. You
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-14
the DEMO space titled "This is the title" with body "This is the body. You can use \n<strong>HTML tags</strong>!", you would pass in the following dictionary: {{"space": "DEMO", "title":"This is the \ntitle","body":"This is the body. You can use <strong>HTML tags</strong>!"}} '}])[source]
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-15
Bases: pydantic.main.BaseModel Wrapper for Jira API. Parameters jira (Any) – confluence (Any) – jira_username (Optional[str]) – jira_api_token (Optional[str]) – jira_instance_url (Optional[str]) – operations (List[Dict]) – Return type None attribute confluence: Any = None attribute jira_api_token: Optional[str] = None attribute jira_instance_url: Optional[str] = None attribute jira_username: Optional[str] = None
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-16
attribute operations: List[Dict] = [{'mode': 'jql', 'name': 'JQL Query', 'description': '\nΒ Β Β  This tool is a wrapper around atlassian-python-api\'s Jira jql API, useful when you need to search for Jira issues.\nΒ Β Β  The input to this tool is a JQL query string, and will be passed into atlassian-python-api\'s Jira `jql` function,\nΒ Β Β  For example, to find all the issues in project "Test" assigned to the me, you would pass in the following string:\nΒ Β Β  project = Test AND assignee = currentUser()\nΒ Β Β  or to find issues with summaries that contain the word "test", you would pass in the following string:\nΒ Β Β  summary ~ \'test\'\nΒ Β Β  '}, {'mode': 'get_projects', 'name': 'Get Projects', 'description': "\nΒ Β Β  This tool is a wrapper around atlassian-python-api's Jira project API, \nΒ Β Β  useful when you need to fetch all the projects the user has access to, find out how many projects there are, or as an intermediary step that involv searching by projects. \nΒ Β Β  there is no input to this tool.\nΒ Β Β  "}, {'mode': 'create_issue', 'name': 'Create Issue', 'description': '\nΒ Β Β  This tool is a wrapper around atlassian-python-api\'s Jira issue_create API, useful when you need to create a Jira issue. \nΒ Β Β  The input to this tool is a dictionary specifying the fields of the Jira issue, and will be passed into atlassian-python-api\'s Jira `issue_create` function.\nΒ Β Β  For example, to create a low priority task called "test issue" with description "test description", you would pass in the following dictionary: \nΒ Β Β  {{"summary": "test issue", "description": "test description", "issuetype": {{"name":
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-17
"test issue", "description": "test description", "issuetype": {{"name": "Task"}}, "priority": {{"name": "Low"}}}}\nΒ Β Β  '}, {'mode': 'other', 'name': 'Catch all Jira API call', 'description': '\nΒ Β Β  This tool is a wrapper around atlassian-python-api\'s Jira API.\nΒ Β Β  There are other dedicated tools for fetching all projects, and creating and searching for issues, \nΒ Β Β  use this tool if you need to perform any other actions allowed by the atlassian-python-api Jira API.\nΒ Β Β  The input to this tool is line of python code that calls a function from atlassian-python-api\'s Jira API\nΒ Β Β  For example, to update the summary field of an issue, you would pass in the following string:\nΒ Β Β  self.jira.update_issue_field(key, {{"summary": "New summary"}})\nΒ Β Β  or to find out how many projects are in the Jira instance, you would pass in the following string:\nΒ Β Β  self.jira.projects()\nΒ Β Β  For more information on the Jira API, refer to https://atlassian-python-api.readthedocs.io/jira.html\nΒ Β Β  '}, {'mode': 'create_page', 'name': 'Create confluence page', 'description': 'This tool is a wrapper around atlassian-python-api\'s Confluence \natlassian-python-api API, useful when you need to create a Confluence page. The input to this tool is a dictionary \nspecifying the fields of the Confluence page, and will be passed into atlassian-python-api\'s Confluence `create_page` \nfunction. For example, to create a page in the DEMO space titled "This is the title" with body "This is the body. You can use \n<strong>HTML tags</strong>!", you would pass in the following dictionary: {{"space": "DEMO",
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-18
you would pass in the following dictionary: {{"space": "DEMO", "title":"This is the \ntitle","body":"This is the body. You can use <strong>HTML tags</strong>!"}} '}]
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-19
issue_create(query)[source] Parameters query (str) – Return type str list()[source] Return type List[Dict] other(query)[source] Parameters query (str) – Return type str page_create(query)[source] Parameters query (str) – Return type str parse_issues(issues)[source] Parameters issues (Dict) – Return type List[dict] parse_projects(projects)[source] Parameters projects (List[dict]) – Return type List[dict] project()[source] Return type str run(mode, query)[source] Parameters mode (str) – query (str) – Return type str search(query)[source] Parameters query (str) – Return type str class langchain.utilities.LambdaWrapper(*, lambda_client=None, function_name=None, awslambda_tool_name=None, awslambda_tool_description=None)[source] Bases: pydantic.main.BaseModel Wrapper for AWS Lambda SDK. Docs for using: pip install boto3 Create a lambda function using the AWS Console or CLI Run aws configure and enter your AWS credentials Parameters lambda_client (Any) – function_name (Optional[str]) – awslambda_tool_name (Optional[str]) – awslambda_tool_description (Optional[str]) – Return type None attribute awslambda_tool_description: Optional[str] = None attribute awslambda_tool_name: Optional[str] = None attribute function_name: Optional[str] = None run(query)[source] Invoke Lambda function and parse result. Parameters
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-20
run(query)[source] Invoke Lambda function and parse result. Parameters query (str) – Return type str class langchain.utilities.MaxComputeAPIWrapper(client)[source] Bases: object Interface for querying Alibaba Cloud MaxCompute tables. Parameters client (ODPS) – classmethod from_params(endpoint, project, *, access_id=None, secret_access_key=None)[source] Convenience constructor that builds the odsp.ODPS MaxCompute client fromgiven parameters. Parameters endpoint (str) – MaxCompute endpoint. project (str) – A project is a basic organizational unit of MaxCompute, which is similar to a database. access_id (Optional[str]) – MaxCompute access ID. Should be passed in directly or set as the environment variable MAX_COMPUTE_ACCESS_ID. secret_access_key (Optional[str]) – MaxCompute secret access key. Should be passed in directly or set as the environment variable MAX_COMPUTE_SECRET_ACCESS_KEY. Return type langchain.utilities.max_compute.MaxComputeAPIWrapper lazy_query(query)[source] Parameters query (str) – Return type Iterator[dict] query(query)[source] Parameters query (str) – Return type List[dict] class langchain.utilities.MetaphorSearchAPIWrapper(*, metaphor_api_key, k=10)[source] Bases: pydantic.main.BaseModel Wrapper for Metaphor Search API. Parameters metaphor_api_key (str) – k (int) – Return type None attribute k: int = 10 attribute metaphor_api_key: str [Required]
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-21
attribute metaphor_api_key: str [Required] results(query, num_results, include_domains=None, exclude_domains=None, start_crawl_date=None, end_crawl_date=None, start_published_date=None, end_published_date=None)[source] Run query through Metaphor Search and return metadata. Parameters query (str) – The query to search for. num_results (int) – The number of results to return. include_domains (Optional[List[str]]) – exclude_domains (Optional[List[str]]) – start_crawl_date (Optional[str]) – end_crawl_date (Optional[str]) – start_published_date (Optional[str]) – end_published_date (Optional[str]) – Returns title - The title of the url - The url author - Author of the content, if applicable. Otherwise, None. published_date - Estimated date published in YYYY-MM-DD format. Otherwise, None. Return type A list of dictionaries with the following keys async results_async(query, num_results, include_domains=None, exclude_domains=None, start_crawl_date=None, end_crawl_date=None, start_published_date=None, end_published_date=None)[source] Get results from the Metaphor Search API asynchronously. Parameters query (str) – num_results (int) – include_domains (Optional[List[str]]) – exclude_domains (Optional[List[str]]) – start_crawl_date (Optional[str]) – end_crawl_date (Optional[str]) – start_published_date (Optional[str]) – end_published_date (Optional[str]) – Return type List[Dict] class langchain.utilities.OpenWeatherMapAPIWrapper(*, owm=None, openweathermap_api_key=None)[source] Bases: pydantic.main.BaseModel
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-22
Bases: pydantic.main.BaseModel Wrapper for OpenWeatherMap API using PyOWM. Docs for using: Go to OpenWeatherMap and sign up for an API key Save your API KEY into OPENWEATHERMAP_API_KEY env variable pip install pyowm Parameters owm (Any) – openweathermap_api_key (Optional[str]) – Return type None attribute openweathermap_api_key: Optional[str] = None attribute owm: Any = None run(location)[source] Get the current weather information for a specified location. Parameters location (str) – Return type str class langchain.utilities.PowerBIDataset(*, dataset_id, table_names, group_id=None, credential=None, token=None, impersonated_user_name=None, sample_rows_in_table_info=1, schemas=None, aiosession=None)[source] Bases: pydantic.main.BaseModel Create PowerBI engine from dataset ID and credential or token. Use either the credential or a supplied token to authenticate. If both are supplied the credential is used to generate a token. The impersonated_user_name is the UPN of a user to be impersonated. If the model is not RLS enabled, this will be ignored. Parameters dataset_id (str) – table_names (List[str]) – group_id (Optional[str]) – credential (Optional[TokenCredential]) – token (Optional[str]) – impersonated_user_name (Optional[str]) – sample_rows_in_table_info (langchain.utilities.powerbi.ConstrainedIntValue) – schemas (Dict[str, str]) – aiosession (Optional[aiohttp.client.ClientSession]) – Return type None
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-23
aiosession (Optional[aiohttp.client.ClientSession]) – Return type None attribute aiosession: Optional[aiohttp.ClientSession] = None attribute credential: Optional[TokenCredential] = None attribute dataset_id: str [Required] attribute group_id: Optional[str] = None attribute impersonated_user_name: Optional[str] = None attribute sample_rows_in_table_info: int = 1 Constraints exclusiveMinimum = 0 maximum = 10 attribute schemas: Dict[str, str] [Optional] attribute table_names: List[str] [Required] attribute token: Optional[str] = None async aget_table_info(table_names=None)[source] Get information about specified tables. Parameters table_names (Optional[Union[List[str], str]]) – Return type str async arun(command)[source] Execute a DAX command and return the result asynchronously. Parameters command (str) – Return type Any get_schemas()[source] Get the available schema’s. Return type str get_table_info(table_names=None)[source] Get information about specified tables. Parameters table_names (Optional[Union[List[str], str]]) – Return type str get_table_names()[source] Get names of tables available. Return type Iterable[str] run(command)[source] Execute a DAX command and return a json representing the results. Parameters command (str) – Return type Any property headers: Dict[str, str] Get the token. property request_url: str Get the request url. property table_info: str Information about all tables in the database.
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-24
property table_info: str Information about all tables in the database. class langchain.utilities.PubMedAPIWrapper(*, top_k_results=3, load_max_docs=25, doc_content_chars_max=2000, load_all_available_meta=False, email='your_email@example.com', base_url_esearch='https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?', base_url_efetch='https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?', max_retry=5, sleep_time=0.2, ARXIV_MAX_QUERY_LENGTH=300)[source] Bases: pydantic.main.BaseModel Wrapper around PubMed API. This wrapper will use the PubMed API to conduct searches and fetch document summaries. By default, it will return the document summaries of the top-k results of an input search. Parameters top_k_results (int) – number of the top-scored document used for the PubMed tool load_max_docs (int) – a limit to the number of loaded documents load_all_available_meta (bool) – if True: the metadata of the loaded Documents gets all available meta info(see https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.ESearch) if False: the metadata gets only the most informative fields. doc_content_chars_max (int) – email (str) – base_url_esearch (str) – base_url_efetch (str) – max_retry (int) – sleep_time (float) – ARXIV_MAX_QUERY_LENGTH (int) – Return type None attribute doc_content_chars_max: int = 2000 attribute email: str = 'your_email@example.com' attribute load_all_available_meta: bool = False
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-25
attribute load_all_available_meta: bool = False attribute load_max_docs: int = 25 attribute top_k_results: int = 3 load(query)[source] Search PubMed for documents matching the query. Return a list of dictionaries containing the document metadata. Parameters query (str) – Return type List[dict] load_docs(query)[source] Parameters query (str) – Return type List[langchain.schema.Document] retrieve_article(uid, webenv)[source] Parameters uid (str) – webenv (str) – Return type dict run(query)[source] Run PubMed search and get the article meta information. See https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.ESearch It uses only the most informative fields of article meta information. Parameters query (str) – Return type str class langchain.utilities.PythonREPL(*, _globals=None, _locals=None)[source] Bases: pydantic.main.BaseModel Simulates a standalone Python REPL. Parameters _globals (Optional[Dict]) – _locals (Optional[Dict]) – Return type None attribute globals: Optional[Dict] [Optional] (alias '_globals') attribute locals: Optional[Dict] [Optional] (alias '_locals') run(command)[source] Run command with own globals/locals and returns anything printed. Parameters command (str) – Return type str pydantic settings langchain.utilities.SceneXplainAPIWrapper[source] Bases: pydantic.env_settings.BaseSettings, pydantic.main.BaseModel Wrapper for SceneXplain API.
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-26
Wrapper for SceneXplain API. In order to set this up, you need API key for the SceneXplain API. You can obtain a key by following the steps below. - Sign up for a free account at https://scenex.jina.ai/. - Navigate to the API Access page (https://scenex.jina.ai/api) and create a new API key. Show JSON schema{ "title": "SceneXplainAPIWrapper", "description": "Wrapper for SceneXplain API.\n\nIn order to set this up, you need API key for the SceneXplain API.\nYou can obtain a key by following the steps below.\n- Sign up for a free account at https://scenex.jina.ai/.\n- Navigate to the API Access page (https://scenex.jina.ai/api)\n and create a new API key.", "type": "object", "properties": { "scenex_api_key": { "title": "Scenex Api Key", "env": "SCENEX_API_KEY", "env_names": "{'scenex_api_key'}", "type": "string" }, "scenex_api_url": { "title": "Scenex Api Url", "default": "https://us-central1-causal-diffusion.cloudfunctions.net/describe", "env_names": "{'scenex_api_url'}", "type": "string" } }, "required": [ "scenex_api_key" ], "additionalProperties": false } Fields scenex_api_key (str) scenex_api_url (str)
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-27
Fields scenex_api_key (str) scenex_api_url (str) attribute scenex_api_key: str [Required] attribute scenex_api_url: str = 'https://us-central1-causal-diffusion.cloudfunctions.net/describe' run(image)[source] Run SceneXplain image explainer. Parameters image (str) – Return type str validator validate_environmentΒ  »  all fields[source] Validate that api key exists in environment. Parameters values (Dict) – Return type Dict class langchain.utilities.SearxSearchWrapper(*, searx_host='', unsecure=False, params=None, headers=None, engines=[], categories=[], query_suffix='', k=10, aiosession=None)[source] Bases: pydantic.main.BaseModel Wrapper for Searx API. To use you need to provide the searx host by passing the named parameter searx_host or exporting the environment variable SEARX_HOST. In some situations you might want to disable SSL verification, for example if you are running searx locally. You can do this by passing the named parameter unsecure. You can also pass the host url scheme as http to disable SSL. Example from langchain.utilities import SearxSearchWrapper searx = SearxSearchWrapper(searx_host="http://localhost:8888") Example with SSL disabled:from langchain.utilities import SearxSearchWrapper # note the unsecure parameter is not needed if you pass the url scheme as # http searx = SearxSearchWrapper(searx_host="http://localhost:8888", unsecure=True) Parameters searx_host (str) – unsecure (bool) –
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-28
Parameters searx_host (str) – unsecure (bool) – params (dict) – headers (Optional[dict]) – engines (Optional[List[str]]) – categories (Optional[List[str]]) – query_suffix (Optional[str]) – k (int) – aiosession (Optional[Any]) – Return type None attribute aiosession: Optional[Any] = None attribute categories: Optional[List[str]] = [] attribute engines: Optional[List[str]] = [] attribute headers: Optional[dict] = None attribute k: int = 10 attribute params: dict [Optional] attribute query_suffix: Optional[str] = '' attribute searx_host: str = '' attribute unsecure: bool = False async aresults(query, num_results, engines=None, query_suffix='', **kwargs)[source] Asynchronously query with json results. Uses aiohttp. See results for more info. Parameters query (str) – num_results (int) – engines (Optional[List[str]]) – query_suffix (Optional[str]) – kwargs (Any) – Return type List[Dict] async arun(query, engines=None, query_suffix='', **kwargs)[source] Asynchronously version of run. Parameters query (str) – engines (Optional[List[str]]) – query_suffix (Optional[str]) – kwargs (Any) – Return type str results(query, num_results, engines=None, categories=None, query_suffix='', **kwargs)[source] Run query through Searx API and returns the results with metadata. Parameters query (str) – The query to search for.
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-29
Parameters query (str) – The query to search for. query_suffix (Optional[str]) – Extra suffix appended to the query. num_results (int) – Limit the number of results to return. engines (Optional[List[str]]) – List of engines to use for the query. categories (Optional[List[str]]) – List of categories to use for the query. **kwargs – extra parameters to pass to the searx API. kwargs (Any) – Returns {snippet: The description of the result. title: The title of the result. link: The link to the result. engines: The engines used for the result. category: Searx category of the result. } Return type Dict with the following keys run(query, engines=None, categories=None, query_suffix='', **kwargs)[source] Run query through Searx API and parse results. You can pass any other params to the searx query API. Parameters query (str) – The query to search for. query_suffix (Optional[str]) – Extra suffix appended to the query. engines (Optional[List[str]]) – List of engines to use for the query. categories (Optional[List[str]]) – List of categories to use for the query. **kwargs – extra parameters to pass to the searx API. kwargs (Any) – Returns The result of the query. Return type str Raises ValueError – If an error occurred with the query. Example This will make a query to the qwant engine: from langchain.utilities import SearxSearchWrapper searx = SearxSearchWrapper(searx_host="http://my.searx.host") searx.run("what is the weather in France ?", engine="qwant")
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-30
searx.run("what is the weather in France ?", engine="qwant") # the same result can be achieved using the `!` syntax of searx # to select the engine using `query_suffix` searx.run("what is the weather in France ?", query_suffix="!qwant") class langchain.utilities.SerpAPIWrapper(*, search_engine=None, params={'engine': 'google', 'gl': 'us', 'google_domain': 'google.com', 'hl': 'en'}, serpapi_api_key=None, aiosession=None)[source] Bases: pydantic.main.BaseModel Wrapper around SerpAPI. To use, you should have the google-search-results python package installed, and the environment variable SERPAPI_API_KEY set with your API key, or pass serpapi_api_key as a named parameter to the constructor. Example from langchain.utilities import SerpAPIWrapper serpapi = SerpAPIWrapper() Parameters search_engine (Any) – params (dict) – serpapi_api_key (Optional[str]) – aiosession (Optional[aiohttp.client.ClientSession]) – Return type None attribute aiosession: Optional[aiohttp.client.ClientSession] = None attribute params: dict = {'engine': 'google', 'gl': 'us', 'google_domain': 'google.com', 'hl': 'en'} attribute serpapi_api_key: Optional[str] = None async aresults(query)[source] Use aiohttp to run query through SerpAPI and return the results async. Parameters query (str) – Return type dict async arun(query, **kwargs)[source] Run query through SerpAPI and parse result async. Parameters
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-31
Run query through SerpAPI and parse result async. Parameters query (str) – kwargs (Any) – Return type str get_params(query)[source] Get parameters for SerpAPI. Parameters query (str) – Return type Dict[str, str] results(query)[source] Run query through SerpAPI and return the raw result. Parameters query (str) – Return type dict run(query, **kwargs)[source] Run query through SerpAPI and parse result. Parameters query (str) – kwargs (Any) – Return type str class langchain.utilities.SparkSQL(spark_session=None, catalog=None, schema=None, ignore_tables=None, include_tables=None, sample_rows_in_table_info=3)[source] Bases: object Parameters spark_session (Optional[SparkSession]) – catalog (Optional[str]) – schema (Optional[str]) – ignore_tables (Optional[List[str]]) – include_tables (Optional[List[str]]) – sample_rows_in_table_info (int) – classmethod from_uri(database_uri, engine_args=None, **kwargs)[source] Creating a remote Spark Session via Spark connect. For example: SparkSQL.from_uri(β€œsc://localhost:15002”) Parameters database_uri (str) – engine_args (Optional[dict]) – kwargs (Any) – Return type langchain.utilities.spark_sql.SparkSQL get_usable_table_names()[source] Get names of tables available. Return type Iterable[str] get_table_info(table_names=None)[source] Parameters table_names (Optional[List[str]]) – Return type str run(command, fetch='all')[source]
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-32
Return type str run(command, fetch='all')[source] Parameters command (str) – fetch (str) – Return type str get_table_info_no_throw(table_names=None)[source] Get information about specified tables. Follows best practices as specified in: Rajkumar et al, 2022 (https://arxiv.org/abs/2204.00498) If sample_rows_in_table_info, the specified number of sample rows will be appended to each table description. This can increase performance as demonstrated in the paper. Parameters table_names (Optional[List[str]]) – Return type str run_no_throw(command, fetch='all')[source] Execute a SQL command and return a string representing the results. If the statement returns rows, a string of the results is returned. If the statement returns no rows, an empty string is returned. If the statement throws an error, the error message is returned. Parameters command (str) – fetch (str) – Return type str class langchain.utilities.TextRequestsWrapper(*, headers=None, aiosession=None)[source] Bases: pydantic.main.BaseModel Lightweight wrapper around requests library. The main purpose of this wrapper is to always return a text output. Parameters headers (Optional[Dict[str, str]]) – aiosession (Optional[aiohttp.client.ClientSession]) – Return type None attribute aiosession: Optional[aiohttp.client.ClientSession] = None attribute headers: Optional[Dict[str, str]] = None async adelete(url, **kwargs)[source] DELETE the URL and return the text asynchronously. Parameters url (str) – kwargs (Any) –
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-33
Parameters url (str) – kwargs (Any) – Return type str async aget(url, **kwargs)[source] GET the URL and return the text asynchronously. Parameters url (str) – kwargs (Any) – Return type str async apatch(url, data, **kwargs)[source] PATCH the URL and return the text asynchronously. Parameters url (str) – data (Dict[str, Any]) – kwargs (Any) – Return type str async apost(url, data, **kwargs)[source] POST to the URL and return the text asynchronously. Parameters url (str) – data (Dict[str, Any]) – kwargs (Any) – Return type str async aput(url, data, **kwargs)[source] PUT the URL and return the text asynchronously. Parameters url (str) – data (Dict[str, Any]) – kwargs (Any) – Return type str delete(url, **kwargs)[source] DELETE the URL and return the text. Parameters url (str) – kwargs (Any) – Return type str get(url, **kwargs)[source] GET the URL and return the text. Parameters url (str) – kwargs (Any) – Return type str patch(url, data, **kwargs)[source] PATCH the URL and return the text. Parameters url (str) – data (Dict[str, Any]) – kwargs (Any) – Return type str post(url, data, **kwargs)[source] POST to the URL and return the text. Parameters url (str) –
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-34
POST to the URL and return the text. Parameters url (str) – data (Dict[str, Any]) – kwargs (Any) – Return type str put(url, data, **kwargs)[source] PUT the URL and return the text. Parameters url (str) – data (Dict[str, Any]) – kwargs (Any) – Return type str property requests: langchain.requests.Requests class langchain.utilities.TwilioAPIWrapper(*, client=None, account_sid=None, auth_token=None, from_number=None)[source] Bases: pydantic.main.BaseModel Messaging Client using Twilio. To use, you should have the twilio python package installed, and the environment variables TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_FROM_NUMBER, or pass account_sid, auth_token, and from_number as named parameters to the constructor. Example from langchain.utilities.twilio import TwilioAPIWrapper twilio = TwilioAPIWrapper( account_sid="ACxxx", auth_token="xxx", from_number="+10123456789" ) twilio.run('test', '+12484345508') Parameters client (Any) – account_sid (Optional[str]) – auth_token (Optional[str]) – from_number (Optional[str]) – Return type None attribute account_sid: Optional[str] = None Twilio account string identifier. attribute auth_token: Optional[str] = None Twilio auth token. attribute from_number: Optional[str] = None A Twilio phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, an
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-35
format, an [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), or a [Channel Endpoint address](https://www.twilio.com/docs/sms/channels#channel-addresses) that is enabled for the type of message you want to send. Phone numbers or [short codes](https://www.twilio.com/docs/sms/api/short-code) purchased from Twilio also work here. You cannot, for example, spoof messages from a private cell phone number. If you are using messaging_service_sid, this parameter must be empty. run(body, to)[source] Run body through Twilio and respond with message sid. Parameters body (str) – The text of the message you want to send. Can be up to 1,600 characters in length. to (str) – The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format for SMS/MMS or [Channel user address](https://www.twilio.com/docs/sms/channels#channel-addresses) for other 3rd-party channels. Return type str class langchain.utilities.WikipediaAPIWrapper(*, wiki_client=None, top_k_results=3, lang='en', load_all_available_meta=False, doc_content_chars_max=4000)[source] Bases: pydantic.main.BaseModel Wrapper around WikipediaAPI. To use, you should have the wikipedia python package installed. This wrapper will use the Wikipedia API to conduct searches and fetch page summaries. By default, it will return the page summaries of the top-k results. It limits the Document content by doc_content_chars_max. Parameters wiki_client (Any) – top_k_results (int) –
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-36
Parameters wiki_client (Any) – top_k_results (int) – lang (str) – load_all_available_meta (bool) – doc_content_chars_max (int) – Return type None attribute doc_content_chars_max: int = 4000 attribute lang: str = 'en' attribute load_all_available_meta: bool = False attribute top_k_results: int = 3 load(query)[source] Run Wikipedia search and get the article text plus the meta information. See Returns: a list of documents. Parameters query (str) – Return type List[langchain.schema.Document] run(query)[source] Run Wikipedia search and get page summaries. Parameters query (str) – Return type str class langchain.utilities.WolframAlphaAPIWrapper(*, wolfram_client=None, wolfram_alpha_appid=None)[source] Bases: pydantic.main.BaseModel Wrapper for Wolfram Alpha. Docs for using: Go to wolfram alpha and sign up for a developer account Create an app and get your APP ID Save your APP ID into WOLFRAM_ALPHA_APPID env variable pip install wolframalpha Parameters wolfram_client (Any) – wolfram_alpha_appid (Optional[str]) – Return type None attribute wolfram_alpha_appid: Optional[str] = None run(query)[source] Run query through WolframAlpha and parse result. Parameters query (str) – Return type str
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-37
Parameters query (str) – Return type str class langchain.utilities.ZapierNLAWrapper(*, zapier_nla_api_key, zapier_nla_oauth_access_token, zapier_nla_api_base='https://nla.zapier.com/api/v1/')[source] Bases: pydantic.main.BaseModel Wrapper for Zapier NLA. Full docs here: https://nla.zapier.com/start/ This wrapper supports both API Key and OAuth Credential auth methods. API Key is the fastest way to get started using this wrapper. Call this wrapper with either zapier_nla_api_key or zapier_nla_oauth_access_token arguments, or set the ZAPIER_NLA_API_KEY environment variable. If both arguments are set, the Access Token will take precedence. For use-cases where LangChain + Zapier NLA is powering a user-facing application, and LangChain needs access to the end-user’s connected accounts on Zapier.com, you’ll need to use OAuth. Review the full docs above to learn how to create your own provider and generate credentials. Parameters zapier_nla_api_key (str) – zapier_nla_oauth_access_token (str) – zapier_nla_api_base (str) – Return type None attribute zapier_nla_api_base: str = 'https://nla.zapier.com/api/v1/' attribute zapier_nla_api_key: str [Required] attribute zapier_nla_oauth_access_token: str [Required] async alist()[source] Returns a list of all exposed (enabled) actions associated with current user (associated with the set api_key). Change your exposed actions here: https://nla.zapier.com/demo/start/
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-38
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) Return type List[Dict] async alist_as_str()[source] Same as list, but returns a stringified version of the JSON for insertting back into an LLM. Return type str async apreview(action_id, instructions, params=None)[source] Same as run, but instead of actually executing the action, will instead return a preview of params that have been guessed by the AI in case you need to explicitly review before executing. Parameters action_id (str) – instructions (str) – params (Optional[Dict]) – Return type Dict async apreview_as_str(*args, **kwargs)[source] Same as preview, but returns a stringified version of the JSON for insertting back into an LLM. Return type str async arun(action_id, instructions, params=None)[source] 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) –
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-39
call. Parameters action_id (str) – instructions (str) – params (Optional[Dict]) – Return type Dict async arun_as_str(*args, **kwargs)[source] Same as run, but returns a stringified version of the JSON for insertting back into an LLM. Return type str list()[source] Returns a list of all exposed (enabled) actions associated with current 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/docs/using-the-api#ai-guessing) Return type List[Dict] list_as_str()[source] Same as list, but returns a stringified version of the JSON for insertting back into an LLM. Return type str preview(action_id, instructions, params=None)[source] Same as run, but instead of actually executing the action, will instead return a preview of params that have been guessed by the AI in case you need to explicitly review before executing. Parameters action_id (str) – instructions (str) – params (Optional[Dict]) – Return type Dict preview_as_str(*args, **kwargs)[source] Same as preview, but returns a stringified version of the JSON for
https://api.python.langchain.com/en/stable/modules/utilities.html
6d859eadd4b9-40
Same as preview, but returns a stringified version of the JSON for insertting back into an LLM. Return type str run(action_id, instructions, params=None)[source] 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) – instructions (str) – params (Optional[Dict]) – Return type Dict run_as_str(*args, **kwargs)[source] Same as run, but returns a stringified version of the JSON for insertting back into an LLM. Return type str
https://api.python.langchain.com/en/stable/modules/utilities.html
49934f65bf86-0
Prompt Templates Prompt template classes. class langchain.prompts.AIMessagePromptTemplate(*, prompt, additional_kwargs=None)[source] Bases: langchain.prompts.chat.BaseStringMessagePromptTemplate Parameters prompt (langchain.prompts.base.StringPromptTemplate) – additional_kwargs (dict) – Return type None format(**kwargs)[source] To a BaseMessage. Parameters kwargs (Any) – Return type langchain.schema.BaseMessage class langchain.prompts.BaseChatPromptTemplate(*, input_variables, output_parser=None, partial_variables=None)[source] Bases: langchain.prompts.base.BasePromptTemplate, abc.ABC Parameters input_variables (List[str]) – output_parser (Optional[langchain.schema.BaseOutputParser]) – partial_variables (Mapping[str, Union[str, Callable[[], str]]]) – Return type None format(**kwargs)[source] Format the prompt with the inputs. Parameters kwargs (Any) – Any arguments to be passed to the prompt template. Returns A formatted string. Return type str Example: prompt.format(variable1="foo") abstract format_messages(**kwargs)[source] Format kwargs into a list of messages. Parameters kwargs (Any) – Return type List[langchain.schema.BaseMessage] format_prompt(**kwargs)[source] Create Chat Messages. Parameters kwargs (Any) – Return type langchain.schema.PromptValue class langchain.prompts.BasePromptTemplate(*, input_variables, output_parser=None, partial_variables=None)[source] Bases: langchain.load.serializable.Serializable, abc.ABC Base class for all prompt templates, returning a prompt. Parameters input_variables (List[str]) –
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-1
Parameters input_variables (List[str]) – output_parser (Optional[langchain.schema.BaseOutputParser]) – partial_variables (Mapping[str, Union[str, Callable[[], str]]]) – Return type None attribute input_variables: List[str] [Required] A list of the names of the variables the prompt template expects. attribute output_parser: Optional[langchain.schema.BaseOutputParser] = None How to parse the output of calling an LLM on this formatted prompt. attribute partial_variables: Mapping[str, Union[str, Callable[[], str]]] [Optional] dict(**kwargs)[source] Return dictionary representation of prompt. Parameters kwargs (Any) – Return type Dict abstract format(**kwargs)[source] Format the prompt with the inputs. Parameters kwargs (Any) – Any arguments to be passed to the prompt template. Returns A formatted string. Return type str Example: prompt.format(variable1="foo") abstract format_prompt(**kwargs)[source] Create Chat Messages. Parameters kwargs (Any) – Return type langchain.schema.PromptValue partial(**kwargs)[source] Return a partial of the prompt template. Parameters kwargs (Union[str, Callable[[], str]]) – Return type langchain.prompts.base.BasePromptTemplate save(file_path)[source] Save the prompt. Parameters file_path (Union[pathlib.Path, str]) – Path to directory to save prompt to. Return type None Example: .. code-block:: python prompt.save(file_path=”path/prompt.yaml”) property lc_serializable: bool Return whether or not the class is serializable.
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-2
property lc_serializable: bool Return whether or not the class is serializable. class langchain.prompts.ChatMessagePromptTemplate(*, prompt, additional_kwargs=None, role)[source] Bases: langchain.prompts.chat.BaseStringMessagePromptTemplate Parameters prompt (langchain.prompts.base.StringPromptTemplate) – additional_kwargs (dict) – role (str) – Return type None attribute role: str [Required] format(**kwargs)[source] To a BaseMessage. Parameters kwargs (Any) – Return type langchain.schema.BaseMessage class langchain.prompts.ChatPromptTemplate(*, input_variables, output_parser=None, partial_variables=None, messages)[source] Bases: langchain.prompts.chat.BaseChatPromptTemplate, abc.ABC Parameters input_variables (List[str]) – output_parser (Optional[langchain.schema.BaseOutputParser]) – partial_variables (Mapping[str, Union[str, Callable[[], str]]]) – messages (List[Union[langchain.prompts.chat.BaseMessagePromptTemplate, langchain.schema.BaseMessage]]) – Return type None attribute input_variables: List[str] [Required] A list of the names of the variables the prompt template expects. attribute messages: List[Union[BaseMessagePromptTemplate, BaseMessage]] [Required] format(**kwargs)[source] Format the prompt with the inputs. Parameters kwargs (Any) – Any arguments to be passed to the prompt template. Returns A formatted string. Return type str Example: prompt.format(variable1="foo") format_messages(**kwargs)[source] Format kwargs into a list of messages. Parameters kwargs (Any) – Return type
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-3
Parameters kwargs (Any) – Return type List[langchain.schema.BaseMessage] classmethod from_messages(messages)[source] Parameters messages (Sequence[Union[langchain.prompts.chat.BaseMessagePromptTemplate, langchain.schema.BaseMessage]]) – Return type langchain.prompts.chat.ChatPromptTemplate classmethod from_role_strings(string_messages)[source] Parameters string_messages (List[Tuple[str, str]]) – Return type langchain.prompts.chat.ChatPromptTemplate classmethod from_strings(string_messages)[source] Parameters string_messages (List[Tuple[Type[langchain.prompts.chat.BaseMessagePromptTemplate], str]]) – Return type langchain.prompts.chat.ChatPromptTemplate classmethod from_template(template, **kwargs)[source] Parameters template (str) – kwargs (Any) – Return type langchain.prompts.chat.ChatPromptTemplate partial(**kwargs)[source] Return a partial of the prompt template. Parameters kwargs (Union[str, Callable[[], str]]) – Return type langchain.prompts.base.BasePromptTemplate save(file_path)[source] Save the prompt. Parameters file_path (Union[pathlib.Path, str]) – Path to directory to save prompt to. Return type None Example: .. code-block:: python prompt.save(file_path=”path/prompt.yaml”) class langchain.prompts.FewShotPromptTemplate(*, input_variables, output_parser=None, partial_variables=None, examples=None, example_selector=None, example_prompt, suffix, example_separator='\n\n', prefix='', template_format='f-string', validate_template=True)[source] Bases: langchain.prompts.base.StringPromptTemplate Prompt template that contains few shot examples. Parameters input_variables (List[str]) –
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-4
Prompt template that contains few shot examples. Parameters input_variables (List[str]) – output_parser (Optional[langchain.schema.BaseOutputParser]) – partial_variables (Mapping[str, Union[str, Callable[[], str]]]) – examples (Optional[List[dict]]) – example_selector (Optional[langchain.prompts.example_selector.base.BaseExampleSelector]) – example_prompt (langchain.prompts.prompt.PromptTemplate) – suffix (str) – example_separator (str) – prefix (str) – template_format (str) – validate_template (bool) – Return type None attribute example_prompt: langchain.prompts.prompt.PromptTemplate [Required] PromptTemplate used to format an individual example. attribute example_selector: Optional[langchain.prompts.example_selector.base.BaseExampleSelector] = None ExampleSelector to choose the examples to format into the prompt. Either this or examples should be provided. attribute example_separator: str = '\n\n' String separator used to join the prefix, the examples, and suffix. attribute examples: Optional[List[dict]] = None Examples to format into the prompt. Either this or example_selector should be provided. attribute input_variables: List[str] [Required] A list of the names of the variables the prompt template expects. attribute prefix: str = '' A prompt template string to put before the examples. attribute suffix: str [Required] A prompt template string to put after the examples. attribute template_format: str = 'f-string' The format of the prompt template. Options are: β€˜f-string’, β€˜jinja2’. attribute validate_template: bool = True Whether or not to try validating the template.
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-5
attribute validate_template: bool = True Whether or not to try validating the template. dict(**kwargs)[source] Return a dictionary of the prompt. Parameters kwargs (Any) – Return type Dict format(**kwargs)[source] Format the prompt with the inputs. Parameters kwargs (Any) – Any arguments to be passed to the prompt template. Returns A formatted string. Return type str Example: prompt.format(variable1="foo") property lc_serializable: bool Return whether or not the class is serializable. class langchain.prompts.FewShotPromptWithTemplates(*, input_variables, output_parser=None, partial_variables=None, examples=None, example_selector=None, example_prompt, suffix, example_separator='\n\n', prefix=None, template_format='f-string', validate_template=True)[source] Bases: langchain.prompts.base.StringPromptTemplate Prompt template that contains few shot examples. Parameters input_variables (List[str]) – output_parser (Optional[langchain.schema.BaseOutputParser]) – partial_variables (Mapping[str, Union[str, Callable[[], str]]]) – examples (Optional[List[dict]]) – example_selector (Optional[langchain.prompts.example_selector.base.BaseExampleSelector]) – example_prompt (langchain.prompts.prompt.PromptTemplate) – suffix (langchain.prompts.base.StringPromptTemplate) – example_separator (str) – prefix (Optional[langchain.prompts.base.StringPromptTemplate]) – template_format (str) – validate_template (bool) – Return type None attribute example_prompt: langchain.prompts.prompt.PromptTemplate [Required] PromptTemplate used to format an individual example.
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-6
PromptTemplate used to format an individual example. attribute example_selector: Optional[langchain.prompts.example_selector.base.BaseExampleSelector] = None ExampleSelector to choose the examples to format into the prompt. Either this or examples should be provided. attribute example_separator: str = '\n\n' String separator used to join the prefix, the examples, and suffix. attribute examples: Optional[List[dict]] = None Examples to format into the prompt. Either this or example_selector should be provided. attribute input_variables: List[str] [Required] A list of the names of the variables the prompt template expects. attribute prefix: Optional[langchain.prompts.base.StringPromptTemplate] = None A PromptTemplate to put before the examples. attribute suffix: langchain.prompts.base.StringPromptTemplate [Required] A PromptTemplate to put after the examples. attribute template_format: str = 'f-string' The format of the prompt template. Options are: β€˜f-string’, β€˜jinja2’. attribute validate_template: bool = True Whether or not to try validating the template. dict(**kwargs)[source] Return a dictionary of the prompt. Parameters kwargs (Any) – Return type Dict format(**kwargs)[source] Format the prompt with the inputs. Parameters kwargs (Any) – Any arguments to be passed to the prompt template. Returns A formatted string. Return type str Example: prompt.format(variable1="foo") class langchain.prompts.HumanMessagePromptTemplate(*, prompt, additional_kwargs=None)[source] Bases: langchain.prompts.chat.BaseStringMessagePromptTemplate Parameters prompt (langchain.prompts.base.StringPromptTemplate) – additional_kwargs (dict) –
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-7
additional_kwargs (dict) – Return type None format(**kwargs)[source] To a BaseMessage. Parameters kwargs (Any) – Return type langchain.schema.BaseMessage class langchain.prompts.LengthBasedExampleSelector(*, examples, example_prompt, get_text_length=<function _get_length_based>, max_length=2048, example_text_lengths=[])[source] Bases: langchain.prompts.example_selector.base.BaseExampleSelector, pydantic.main.BaseModel Select examples based on length. Parameters examples (List[dict]) – example_prompt (langchain.prompts.prompt.PromptTemplate) – get_text_length (Callable[[str], int]) – max_length (int) – example_text_lengths (List[int]) – Return type None attribute example_prompt: langchain.prompts.prompt.PromptTemplate [Required] Prompt template used to format the examples. attribute examples: List[dict] [Required] A list of the examples that the prompt template expects. attribute get_text_length: Callable[[str], int] = <function _get_length_based> Function to measure prompt length. Defaults to word count. attribute max_length: int = 2048 Max length for the prompt, beyond which examples are cut. add_example(example)[source] Add new example to list. Parameters example (Dict[str, str]) – Return type None select_examples(input_variables)[source] Select which examples to use based on the input lengths. Parameters input_variables (Dict[str, str]) – Return type List[dict]
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-8
input_variables (Dict[str, str]) – Return type List[dict] class langchain.prompts.MaxMarginalRelevanceExampleSelector(*, vectorstore, k=4, example_keys=None, input_keys=None, fetch_k=20)[source] Bases: langchain.prompts.example_selector.semantic_similarity.SemanticSimilarityExampleSelector ExampleSelector that selects examples based on Max Marginal Relevance. This was shown to improve performance in this paper: https://arxiv.org/pdf/2211.13892.pdf Parameters vectorstore (langchain.vectorstores.base.VectorStore) – k (int) – example_keys (Optional[List[str]]) – input_keys (Optional[List[str]]) – fetch_k (int) – Return type None attribute example_keys: Optional[List[str]] = None Optional keys to filter examples to. attribute fetch_k: int = 20 Number of examples to fetch to rerank. attribute input_keys: Optional[List[str]] = None Optional keys to filter input to. If provided, the search is based on the input variables instead of all variables. attribute k: int = 4 Number of examples to select. attribute vectorstore: langchain.vectorstores.base.VectorStore [Required] VectorStore than contains information about examples. classmethod from_examples(examples, embeddings, vectorstore_cls, k=4, input_keys=None, fetch_k=20, **vectorstore_cls_kwargs)[source] Create k-shot example selector using example list and embeddings. Reshuffles examples dynamically based on query similarity. Parameters examples (List[dict]) – List of examples to use in the prompt.
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-9
Parameters examples (List[dict]) – List of examples to use in the prompt. embeddings (langchain.embeddings.base.Embeddings) – An iniialized embedding API interface, e.g. OpenAIEmbeddings(). vectorstore_cls (Type[langchain.vectorstores.base.VectorStore]) – A vector store DB interface class, e.g. FAISS. k (int) – Number of examples to select input_keys (Optional[List[str]]) – If provided, the search is based on the input variables instead of all variables. vectorstore_cls_kwargs (Any) – optional kwargs containing url for vector store fetch_k (int) – Returns The ExampleSelector instantiated, backed by a vector store. Return type langchain.prompts.example_selector.semantic_similarity.MaxMarginalRelevanceExampleSelector select_examples(input_variables)[source] Select which examples to use based on semantic similarity. Parameters input_variables (Dict[str, str]) – Return type List[dict] class langchain.prompts.MessagesPlaceholder(*, variable_name)[source] Bases: langchain.prompts.chat.BaseMessagePromptTemplate Prompt template that assumes variable is already list of messages. Parameters variable_name (str) – Return type None attribute variable_name: str [Required] format_messages(**kwargs)[source] To a BaseMessage. Parameters kwargs (Any) – Return type List[langchain.schema.BaseMessage] property input_variables: List[str] Input variables for this prompt template. class langchain.prompts.NGramOverlapExampleSelector(*, examples, example_prompt, threshold=- 1.0)[source] Bases: langchain.prompts.example_selector.base.BaseExampleSelector, pydantic.main.BaseModel
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-10
Select and order examples based on ngram overlap score (sentence_bleu score). https://www.nltk.org/_modules/nltk/translate/bleu_score.html https://aclanthology.org/P02-1040.pdf Parameters examples (List[dict]) – example_prompt (langchain.prompts.prompt.PromptTemplate) – threshold (float) – Return type None attribute example_prompt: langchain.prompts.prompt.PromptTemplate [Required] Prompt template used to format the examples. attribute examples: List[dict] [Required] A list of the examples that the prompt template expects. attribute threshold: float = -1.0 Threshold at which algorithm stops. Set to -1.0 by default. For negative threshold: select_examples sorts examples by ngram_overlap_score, but excludes none. For threshold greater than 1.0: select_examples excludes all examples, and returns an empty list. For threshold equal to 0.0: select_examples sorts examples by ngram_overlap_score, and excludes examples with no ngram overlap with input. add_example(example)[source] Add new example to list. Parameters example (Dict[str, str]) – Return type None select_examples(input_variables)[source] Return list of examples sorted by ngram_overlap_score with input. Descending order. Excludes any examples with ngram_overlap_score less than or equal to threshold. Parameters input_variables (Dict[str, str]) – Return type List[dict] class langchain.prompts.PipelinePromptTemplate(*, input_variables, output_parser=None, partial_variables=None, final_prompt, pipeline_prompts)[source] Bases: langchain.prompts.base.BasePromptTemplate A prompt template for composing multiple prompts together.
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-11
A prompt template for composing multiple prompts together. This can be useful when you want to reuse parts of prompts. A PipelinePrompt consists of two main parts: final_prompt: This is the final prompt that is returned pipeline_prompts: This is a list of tuples, consistingof a string (name) and a Prompt Template. Each PromptTemplate will be formatted and then passed to future prompt templates as a variable with the same name as name Parameters input_variables (List[str]) – output_parser (Optional[langchain.schema.BaseOutputParser]) – partial_variables (Mapping[str, Union[str, Callable[[], str]]]) – final_prompt (langchain.prompts.base.BasePromptTemplate) – pipeline_prompts (List[Tuple[str, langchain.prompts.base.BasePromptTemplate]]) – Return type None attribute final_prompt: langchain.prompts.base.BasePromptTemplate [Required] attribute pipeline_prompts: List[Tuple[str, langchain.prompts.base.BasePromptTemplate]] [Required] format(**kwargs)[source] Format the prompt with the inputs. Parameters kwargs (Any) – Any arguments to be passed to the prompt template. Returns A formatted string. Return type str Example: prompt.format(variable1="foo") format_prompt(**kwargs)[source] Create Chat Messages. Parameters kwargs (Any) – Return type langchain.schema.PromptValue langchain.prompts.Prompt alias of langchain.prompts.prompt.PromptTemplate class langchain.prompts.PromptTemplate(*, input_variables, output_parser=None, partial_variables=None, template, template_format='f-string', validate_template=True)[source] Bases: langchain.prompts.base.StringPromptTemplate Schema to represent a prompt for an LLM. Example
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-12
Schema to represent a prompt for an LLM. Example from langchain import PromptTemplate prompt = PromptTemplate(input_variables=["foo"], template="Say {foo}") Parameters input_variables (List[str]) – output_parser (Optional[langchain.schema.BaseOutputParser]) – partial_variables (Mapping[str, Union[str, Callable[[], str]]]) – template (str) – template_format (str) – validate_template (bool) – Return type None attribute input_variables: List[str] [Required] A list of the names of the variables the prompt template expects. attribute template: str [Required] The prompt template. attribute template_format: str = 'f-string' The format of the prompt template. Options are: β€˜f-string’, β€˜jinja2’. attribute validate_template: bool = True Whether or not to try validating the template. format(**kwargs)[source] Format the prompt with the inputs. Parameters kwargs (Any) – Any arguments to be passed to the prompt template. Returns A formatted string. Return type str Example: prompt.format(variable1="foo") classmethod from_examples(examples, suffix, input_variables, example_separator='\n\n', prefix='', **kwargs)[source] Take examples in list format with prefix and suffix to create a prompt. Intended to be used as a way to dynamically create a prompt from examples. Parameters examples (List[str]) – List of examples to use in the prompt. suffix (str) – String to go after the list of examples. Should generally set up the user’s input. input_variables (List[str]) – A list of variable names the final prompt template will expect. example_separator (str) – The separator to use in between examples. Defaults
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-13
will expect. example_separator (str) – The separator to use in between examples. Defaults to two new line characters. prefix (str) – String that should go before any examples. Generally includes examples. Default to an empty string. kwargs (Any) – Returns The final prompt generated. Return type langchain.prompts.prompt.PromptTemplate classmethod from_file(template_file, input_variables, **kwargs)[source] Load a prompt from a file. Parameters template_file (Union[str, pathlib.Path]) – The path to the file containing the prompt template. input_variables (List[str]) – A list of variable names the final prompt template will expect. kwargs (Any) – Returns The prompt loaded from the file. Return type langchain.prompts.prompt.PromptTemplate classmethod from_template(template, **kwargs)[source] Load a prompt template from a template. Parameters template (str) – kwargs (Any) – Return type langchain.prompts.prompt.PromptTemplate property lc_attributes: Dict[str, Any] Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor. class langchain.prompts.SemanticSimilarityExampleSelector(*, vectorstore, k=4, example_keys=None, input_keys=None)[source] Bases: langchain.prompts.example_selector.base.BaseExampleSelector, pydantic.main.BaseModel Example selector that selects examples based on SemanticSimilarity. Parameters vectorstore (langchain.vectorstores.base.VectorStore) – k (int) – example_keys (Optional[List[str]]) – input_keys (Optional[List[str]]) – Return type None attribute example_keys: Optional[List[str]] = None
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-14
Return type None attribute example_keys: Optional[List[str]] = None Optional keys to filter examples to. attribute input_keys: Optional[List[str]] = None Optional keys to filter input to. If provided, the search is based on the input variables instead of all variables. attribute k: int = 4 Number of examples to select. attribute vectorstore: langchain.vectorstores.base.VectorStore [Required] VectorStore than contains information about examples. add_example(example)[source] Add new example to vectorstore. Parameters example (Dict[str, str]) – Return type str classmethod from_examples(examples, embeddings, vectorstore_cls, k=4, input_keys=None, **vectorstore_cls_kwargs)[source] Create k-shot example selector using example list and embeddings. Reshuffles examples dynamically based on query similarity. Parameters examples (List[dict]) – List of examples to use in the prompt. embeddings (langchain.embeddings.base.Embeddings) – An initialized embedding API interface, e.g. OpenAIEmbeddings(). vectorstore_cls (Type[langchain.vectorstores.base.VectorStore]) – A vector store DB interface class, e.g. FAISS. k (int) – Number of examples to select input_keys (Optional[List[str]]) – If provided, the search is based on the input variables instead of all variables. vectorstore_cls_kwargs (Any) – optional kwargs containing url for vector store Returns The ExampleSelector instantiated, backed by a vector store. Return type langchain.prompts.example_selector.semantic_similarity.SemanticSimilarityExampleSelector select_examples(input_variables)[source] Select which examples to use based on semantic similarity. Parameters input_variables (Dict[str, str]) – Return type List[dict]
https://api.python.langchain.com/en/stable/modules/prompts.html
49934f65bf86-15
input_variables (Dict[str, str]) – Return type List[dict] class langchain.prompts.StringPromptTemplate(*, input_variables, output_parser=None, partial_variables=None)[source] Bases: langchain.prompts.base.BasePromptTemplate, abc.ABC String prompt should expose the format method, returning a prompt. Parameters input_variables (List[str]) – output_parser (Optional[langchain.schema.BaseOutputParser]) – partial_variables (Mapping[str, Union[str, Callable[[], str]]]) – Return type None format_prompt(**kwargs)[source] Create Chat Messages. Parameters kwargs (Any) – Return type langchain.schema.PromptValue class langchain.prompts.SystemMessagePromptTemplate(*, prompt, additional_kwargs=None)[source] Bases: langchain.prompts.chat.BaseStringMessagePromptTemplate Parameters prompt (langchain.prompts.base.StringPromptTemplate) – additional_kwargs (dict) – Return type None format(**kwargs)[source] To a BaseMessage. Parameters kwargs (Any) – Return type langchain.schema.BaseMessage langchain.prompts.load_prompt(path)[source] Unified method for loading a prompt from LangChainHub or local fs. Parameters path (Union[str, pathlib.Path]) – Return type langchain.prompts.base.BasePromptTemplate
https://api.python.langchain.com/en/stable/modules/prompts.html
cc7118a75a71-0
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) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-1
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-2
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-3
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-4
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-5
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-6
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-7
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-8
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-9
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-10
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) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-11
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-12
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]]) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-13
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) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-14
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) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-15
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]) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-16
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]) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-17
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-18
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) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-19
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.
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-20
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.
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-21
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.
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-22
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.
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-23
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.
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-24
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.
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-25
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.
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-26
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-27
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) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-28
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-29
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-30
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]) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-31
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-32
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-33
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]) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-34
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-35
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-36
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) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-37
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) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-38
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-39
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]]) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-40
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-41
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'>
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-42
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.
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-43
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-44
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-45
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.
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-46
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-47
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]) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-48
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]
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-49
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]) –
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-50
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.'
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-51
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-52
<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] =
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-53
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
https://api.python.langchain.com/en/stable/modules/tools.html
cc7118a75a71-54
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:
https://api.python.langchain.com/en/stable/modules/tools.html