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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.