id
stringlengths
14
16
text
stringlengths
31
2.41k
source
stringlengths
53
121
46d47edcfcf7-12
Returns List of embeddings, one for each text. Return type List[List[float]] embed_query(text)[source] Compute query embeddings using a TensorflowHub embedding model. Parameters text (str) – The text to embed. Returns Embeddings for the text. Return type List[float] class langchain.embeddings.SagemakerEndpointEmbeddin...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-13
The content handler class that provides an input and output transform functions to handle formats between LLM and the endpoint. attribute credentials_profile_name: Optional[str] = None The name of the profile in the ~/.aws/credentials or ~/.aws/config files, which has either access keys or role information specified. ...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-14
Parameters text (str) – The text to embed. Returns Embeddings for the text. Return type List[float] class langchain.embeddings.HuggingFaceInstructEmbeddings(*, client=None, model_name='hkunlp/instructor-large', cache_folder=None, model_kwargs=None, encode_kwargs=None, embed_instruction='Represent the document for retri...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-15
attribute model_kwargs: Dict[str, Any] [Optional] Key word arguments to pass to the model. attribute model_name: str = 'hkunlp/instructor-large' Model name to use. attribute query_instruction: str = 'Represent the question for retrieving supporting documents: ' Instruction to use for embedding query. embed_documents...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-16
endpoint_url=endpoint_url, mosaicml_api_token="my-api-key" ) Parameters endpoint_url (str) – embed_instruction (str) – query_instruction (str) – retry_sleep (float) – mosaicml_api_token (Optional[str]) – Return type None attribute embed_instruction: str = 'Represent the document for retrieval: ' Instruction u...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-17
Runs custom embedding models on self-hosted remote hardware. Supported hardware includes auto-launched instances on AWS, GCP, Azure, and Lambda, as well as servers specified by IP address and SSH credentials (such as on-prem, or another cloud like Paperspace, Coreweave, etc.). To use, you should have the runhouse pytho...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-18
) Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – tags (Optional[List[str]]) – pipeline_ref (Any) – clien...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-19
Returns Embeddings for the text. Return type List[float] class langchain.embeddings.SelfHostedHuggingFaceEmbeddings(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, pipeline_ref=None, client=None, inference_fn=<function _embed_documents>, hardware=None, model_load_fn=<function load_embeddi...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-20
inference_fn (Callable) – hardware (Any) – model_load_fn (Callable) – load_fn_kwargs (Optional[dict]) – model_reqs (List[str]) – inference_kwargs (Any) – model_id (str) – Return type None attribute hardware: Any = None Remote hardware to send the inference function to. attribute inference_fn: Callable = <functi...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-21
Supported hardware includes auto-launched instances on AWS, GCP, Azure, and Lambda, as well as servers specified by IP address and SSH credentials (such as on-prem, or another cloud like Paperspace, Coreweave, etc.). To use, you should have the runhouse python package installed. Example from langchain.embeddings import...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-22
Requirements to install on hardware to inference the model. attribute query_instruction: str = 'Represent the question for retrieving supporting documents: ' Instruction to use for embedding query. embed_documents(texts)[source] Compute doc embeddings using a HuggingFace instruct model. Parameters texts (List[str]) –...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-23
the query for a document as similar as possible. To learn more, check out: https://docs.aleph-alpha.com/docs/tasks/semantic_embed/ Example from aleph_alpha import AlephAlphaAsymmetricSemanticEmbedding embeddings = AlephAlphaSymmetricSemanticEmbedding() document = "This is a content of the document" query = "What is the...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-24
attribute normalize: Optional[bool] = True Should returned embeddings be normalized embed_documents(texts)[source] Call out to Aleph Alpha’s asymmetric Document endpoint. Parameters texts (List[str]) – The list of texts to embed. Returns List of embeddings, one for each text. Return type List[List[float]] embed_query...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-25
aleph_alpha_api_key (Optional[str]) – Return type None embed_documents(texts)[source] Call out to Aleph Alpha’s Document endpoint. Parameters texts (List[str]) – The list of texts to embed. Returns List of embeddings, one for each text. Return type List[List[float]] embed_query(text)[source] Call out to Aleph Alpha’...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-26
embed_type_query (str) – minimax_group_id (Optional[str]) – minimax_api_key (Optional[str]) – Return type None attribute embed_type_db: str = 'db' For embed_documents attribute embed_type_query: str = 'query' For embed_query attribute endpoint_url: str = 'https://api.minimax.chat/v1/embeddings' Endpoint URL to us...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-27
If a specific credential profile should be used, you must pass the name of the profile from the ~/.aws/credentials file that is to be used. Make sure the credentials / roles used have the required policies to access the Bedrock service. Parameters client (Any) – region_name (Optional[str]) – credentials_profile_name ...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-28
only for compatibility with the embeddings interface. Returns List of embeddings, one for each text. Return type List[List[float]] embed_query(text)[source] Compute query embeddings using a Bedrock model. Parameters text (str) – The text to embed. Returns Embeddings for the text. Return type List[float] class langchai...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-29
deepinfra_api_token (Optional[str]) – Return type None attribute embed_instruction: str = 'passage: ' Instruction used to embed documents. attribute model_id: str = 'sentence-transformers/clip-ViT-B-32' Embeddings model to use. attribute model_kwargs: Optional[dict] = None Other model keyword args attribute normali...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-30
os.environ["DASHSCOPE_API_KEY"] = "your DashScope API KEY" from langchain.embeddings.dashscope import DashScopeEmbeddings embeddings = DashScopeEmbeddings( model="text-embedding-v1", ) text = "This is a test query." query_result = embeddings.embed_query(text) Parameters client (Any) – model (str) – dashscope_api_...
https://api.python.langchain.com/en/latest/modules/embeddings.html
46d47edcfcf7-31
it as a named parameter to the constructor. Example # Initialise with default model and instruction from langchain.embeddings import EmbaasEmbeddings emb = EmbaasEmbeddings() # Initialise with custom model and instruction from langchain.embeddings import EmbaasEmbeddings emb_model = "instructor-large" emb_inst = "Repre...
https://api.python.langchain.com/en/latest/modules/embeddings.html
897ef9cfbf02-0
Utilities General utilities. class langchain.utilities.ApifyWrapper(*, apify_client=None, apify_client_async=None)[source] Bases: pydantic.main.BaseModel Wrapper around Apify. To use, you should have the apify-client python package installed, and the environment variable APIFY_API_TOKEN set with your API key, or pass...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-1
Run a saved Actor task on Apify and wait for results to be ready. Parameters task_id (str) – The ID or name of the task on the Apify platform. task_input (Dict) – The input object of the task that you’re trying to run. Overrides the task’s saved input. dataset_mapping_function (Callable) – A function that takes a singl...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-2
timeout_secs (int, optional) – Optional timeout for the run, in seconds. Returns A loader that will fetch the records from theActor run’s default dataset. Return type ApifyDatasetLoader call_actor_task(task_id, task_input, dataset_mapping_function, *, build=None, memory_mbytes=None, timeout_secs=None)[source] Run a sa...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-3
This wrapper will use the Arxiv API to conduct searches and fetch document summaries. By default, it will return the document summaries of the top-k results. It limits the Document content by doc_content_chars_max. Set doc_content_chars_max=None if you don’t want to limit the content size. Parameters top_k_results (int...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-4
See https://lukasschwab.me/arxiv.py/index.html#Search See https://lukasschwab.me/arxiv.py/index.html#Result It uses only the most informative fields of article meta information. Parameters query (str) – Return type str class langchain.utilities.BashProcess(strip_newlines=False, return_err_output=False, persistent=Fals...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-5
Parameters path (str) – Return type List[Dict[str, Any]] class langchain.utilities.BingSearchAPIWrapper(*, bing_subscription_key, bing_search_url, k=10)[source] Bases: pydantic.main.BaseModel Wrapper for Bing Search API. In order to set this up, follow instructions at: https://levelup.gitconnected.com/api-tutorial-ho...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-6
Parameters query (str) – Return type str class langchain.utilities.DuckDuckGoSearchAPIWrapper(*, k=10, region='wt-wt', safesearch='moderate', time='y', max_results=5)[source] Bases: pydantic.main.BaseModel Wrapper for DuckDuckGo Search API. Free and does not require any setup Parameters k (int) – region (Optional[st...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-7
Bases: pydantic.main.BaseModel Wrapper around Google Places API. To use, you should have the googlemaps python package installed,an API key for the google maps platform, and the enviroment variable β€˜β€™GPLACES_API_KEY’’ set with your API key , or pass β€˜gplaces_api_key’ as a named parameter to the constructor. By default,...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-8
TODO: DOCS for using it 1. Install google-api-python-client - If you don’t already have a Google account, sign up. - If you have never created a Google APIs Console project, read the Managing Projects page and create a project in the Google API Console. - Install the library using pip install google-api-python-client T...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-9
siterestrict (bool) – Return type None attribute google_api_key: Optional[str] = None attribute google_cse_id: Optional[str] = None attribute k: int = 10 attribute siterestrict: bool = False results(query, num_results)[source] Run query through GoogleSearch and return metadata. Parameters query (str) – The query ...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-10
type (Literal['news', 'search', 'places', 'images']) – tbs (Optional[str]) – serper_api_key (Optional[str]) – aiosession (Optional[aiohttp.client.ClientSession]) – result_key_for_type (dict) – Return type None attribute aiosession: Optional[aiohttp.client.ClientSession] = None attribute gl: str = 'us' attribute ...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-11
Wrapper around GraphQL API. To use, you should have the gql python package installed. This wrapper will use the GraphQL API to conduct queries. Parameters custom_headers (Optional[Dict[str, str]]) – graphql_endpoint (str) – gql_client (Any) – gql_function (Callable[[str], Any]) – Return type None attribute custom_h...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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 issu...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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', 'descr...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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/latest/modules/utilities.html
897ef9cfbf02-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] ...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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`...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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 proj...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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/latest/modules/utilities.html
897ef9cfbf02-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[d...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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 openweather...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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] = ...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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)[sou...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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Β  » ...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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: ...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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': '...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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) – R...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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 (Di...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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 ...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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/do...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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)[s...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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 supp...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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 ...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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 as...
https://api.python.langchain.com/en/latest/modules/utilities.html
897ef9cfbf02-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 acti...
https://api.python.langchain.com/en/latest/modules/utilities.html
dd38a45722f7-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(**kw...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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_stri...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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.ba...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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 ...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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 s...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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 select...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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 ...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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[[], st...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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.promp...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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 sele...
https://api.python.langchain.com/en/latest/modules/prompts.html
dd38a45722f7-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_v...
https://api.python.langchain.com/en/latest/modules/prompts.html
8e7952d3fdad-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.BaseTo...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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 ope...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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, retu...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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, ...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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, callback...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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 (l...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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[lang...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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.call...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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 Bin...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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_...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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) – pla...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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.Base...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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.b...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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....
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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_wrappe...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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_er...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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_mana...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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=Fals...
https://api.python.langchain.com/en/latest/modules/tools.html
8e7952d3fdad-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, ...
https://api.python.langchain.com/en/latest/modules/tools.html