id
stringlengths
14
16
text
stringlengths
29
2.73k
source
stringlengths
49
115
70fdaeb2ac0b-8
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. pydantic model langchain.utilities.PythonREPL[source]# Simulates a standalone Python REPL. field globals: Optional[Dict] [Optional] (alias '_globals')#...
https://python.langchain.com/en/latest/reference/modules/utilities.html
70fdaeb2ac0b-9
field headers: Optional[dict] = None# field k: int = 10# field params: dict [Optional]# field query_suffix: Optional[str] = ''# field searx_host: str = ''# field unsecure: bool = False# async aresults(query: str, num_results: int, engines: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) → L...
https://python.langchain.com/en/latest/reference/modules/utilities.html
70fdaeb2ac0b-10
} Return type Dict with the following keys run(query: str, engines: Optional[List[str]] = None, categories: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) → str[source]# Run query through Searx API and parse results. You can pass any other params to the searx query API. Parameters query – ...
https://python.langchain.com/en/latest/reference/modules/utilities.html
70fdaeb2ac0b-11
field aiosession: Optional[aiohttp.client.ClientSession] = None# field params: dict = {'engine': 'google', 'gl': 'us', 'google_domain': 'google.com', 'hl': 'en'}# field serpapi_api_key: Optional[str] = None# async aresults(query: str) → dict[source]# Use aiohttp to run query through SerpAPI and return the results async...
https://python.langchain.com/en/latest/reference/modules/utilities.html
70fdaeb2ac0b-12
POST to the URL and return the text asynchronously. async aput(url: str, data: Dict[str, Any], **kwargs: Any) → str[source]# PUT the URL and return the text asynchronously. delete(url: str, **kwargs: Any) → str[source]# DELETE the URL and return the text. get(url: str, **kwargs: Any) → str[source]# GET the URL and retu...
https://python.langchain.com/en/latest/reference/modules/utilities.html
70fdaeb2ac0b-13
Save your APP ID into WOLFRAM_ALPHA_APPID env variable pip install wolframalpha field wolfram_alpha_appid: Optional[str] = None# run(query: str) → str[source]# Run query through WolframAlpha and parse result. previous Agent Toolkits next Experimental Modules By Harrison Chase © Copyright 2023, Harrison Chase...
https://python.langchain.com/en/latest/reference/modules/utilities.html
5dae1c72a85d-0
.rst .pdf Output Parsers Output Parsers# pydantic model langchain.output_parsers.CommaSeparatedListOutputParser[source]# Parse out comma separated lists. get_format_instructions() → str[source]# Instructions on how the LLM output should be formatted. parse(text: str) → List[str][source]# Parse the output of an LLM call...
https://python.langchain.com/en/latest/reference/modules/output_parsers.html
5dae1c72a85d-1
field retry_chain: langchain.chains.llm.LLMChain [Required]# classmethod from_llm(llm: langchain.base_language.BaseLanguageModel, parser: langchain.schema.BaseOutputParser[langchain.output_parsers.fix.T], prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['completion', 'error', 'instruc...
https://python.langchain.com/en/latest/reference/modules/output_parsers.html
5dae1c72a85d-2
and parses it into some structure. Parameters text – output of language model Returns structured output pydantic model langchain.output_parsers.RegexDictParser[source]# Class to parse the output into a dictionary. field no_update_value: Optional[str] = None# field output_key_to_format: Dict[str, str] [Required]# field ...
https://python.langchain.com/en/latest/reference/modules/output_parsers.html
5dae1c72a85d-3
field retry_chain: langchain.chains.llm.LLMChain [Required]# classmethod from_llm(llm: langchain.base_language.BaseLanguageModel, parser: langchain.schema.BaseOutputParser[langchain.output_parsers.retry.T], prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['completion', 'prompt'], outp...
https://python.langchain.com/en/latest/reference/modules/output_parsers.html
5dae1c72a85d-4
that was raised to another language and telling it that the completion did not work, and raised the given error. Differs from RetryOutputParser in that this implementation provides the error that was raised back to the LLM, which in theory should give it more information on how to fix it. field parser: langchain.schema...
https://python.langchain.com/en/latest/reference/modules/output_parsers.html
5dae1c72a85d-5
The prompt is largely provided in the event the OutputParser wants to retry or fix the output in some way, and needs information from the prompt to do so. Parameters completion – output of language model prompt – prompt value Returns structured output pydantic model langchain.output_parsers.StructuredOutputParser[sourc...
https://python.langchain.com/en/latest/reference/modules/output_parsers.html
0d4c737e5152-0
.rst .pdf Docstore Docstore# Wrappers on top of docstores. class langchain.docstore.InMemoryDocstore(_dict: Dict[str, langchain.schema.Document])[source]# Simple in memory docstore in the form of a dict. add(texts: Dict[str, langchain.schema.Document]) → None[source]# Add texts to in memory dictionary. search(search: s...
https://python.langchain.com/en/latest/reference/modules/docstore.html
bb5236069ce5-0
.rst .pdf SerpAPI SerpAPI# For backwards compatiblity. pydantic model langchain.serpapi.SerpAPIWrapper[source]# 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 param...
https://python.langchain.com/en/latest/reference/modules/serpapi.html
f527a9930db1-0
.rst .pdf Experimental Modules Contents Autonomous Agents Generative Agents Experimental Modules# This module contains experimental modules and reproductions of existing work using LangChain primitives. Autonomous Agents# Here, we document the BabyAGI and AutoGPT classes from the langchain.experimental module. class ...
https://python.langchain.com/en/latest/reference/modules/experimental.html
f527a9930db1-1
Get the next task. property input_keys: List[str]# Input keys this chain expects. property output_keys: List[str]# Output keys this chain expects. prioritize_tasks(this_task_id: int, objective: str) → List[Dict][source]# Prioritize tasks. class langchain.experimental.AutoGPT(ai_name: str, memory: langchain.vectorstores...
https://python.langchain.com/en/latest/reference/modules/experimental.html
f527a9930db1-2
React to a given observation. generate_reaction(observation: str) → Tuple[bool, str][source]# React to a given observation. get_full_header(force_refresh: bool = False) → str[source]# Return a full header of the agent’s status, summary, and current time. get_summary(force_refresh: bool = False) → str[source]# Return a ...
https://python.langchain.com/en/latest/reference/modules/experimental.html
f527a9930db1-3
field traits: str = 'N/A'# Permanent traits to ascribe to the character. class langchain.experimental.GenerativeAgentMemory(*, llm: langchain.base_language.BaseLanguageModel, memory_retriever: langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever, verbose: bool = False, reflection_threshold: Opt...
https://python.langchain.com/en/latest/reference/modules/experimental.html
f527a9930db1-4
Return key-value pairs given the text input to the chain. field memory_retriever: langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever [Required]# The retriever to fetch related memories. property memory_variables: List[str]# Input keys this memory class will load dynamically. pause_to_reflect(...
https://python.langchain.com/en/latest/reference/modules/experimental.html
dc10ed6d93e1-0
.rst .pdf Chat Models Chat Models# pydantic model langchain.chat_models.AzureChatOpenAI[source]# Wrapper around Azure OpenAI Chat Completion API. To use this class you must have a deployed model on Azure OpenAI. Use deployment_name in the constructor to refer to the “Model deployment name” in the Azure portal. In addit...
https://python.langchain.com/en/latest/reference/modules/chat_models.html
dc10ed6d93e1-1
field verbose: bool [Optional]# Whether to print out response text. pydantic model langchain.chat_models.ChatGooglePalm[source]# Wrapper around Google’s PaLM Chat API. To use you must have the google.generativeai Python package installed and either: The GOOGLE_API_KEY` environment varaible set with your API key, or Pas...
https://python.langchain.com/en/latest/reference/modules/chat_models.html
dc10ed6d93e1-2
Example from langchain.chat_models import ChatOpenAI openai = ChatOpenAI(model_name="gpt-3.5-turbo") field max_retries: int = 6# Maximum number of retries to make when generating. field max_tokens: Optional[int] = None# Maximum number of tokens to generate. field model_kwargs: Dict[str, Any] [Optional]# Holds any model...
https://python.langchain.com/en/latest/reference/modules/chat_models.html
dc10ed6d93e1-3
Wrapper around OpenAI Chat large language models and PromptLayer. To use, you should have the openai and promptlayer python package installed, and the environment variable OPENAI_API_KEY and PROMPTLAYER_API_KEY set with your openAI API key and promptlayer key respectively. All parameters that can be passed to the OpenA...
https://python.langchain.com/en/latest/reference/modules/chat_models.html
521c8aa93adc-0
.rst .pdf Embeddings Embeddings# Wrappers around embedding modules. pydantic model langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding[source]# Wrapper for Aleph Alpha’s Asymmetric Embeddings AA provides you with an endpoint to embed a document and a query. The models were optimized to make the embeddings of doc...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-1
Parameters texts – The list of texts to embed. Returns List of embeddings, one for each text. embed_query(text: str) → List[float][source]# Call out to Aleph Alpha’s asymmetric, query embedding endpoint :param text: The text to embed. Returns Embeddings for the text. pydantic model langchain.embeddings.AlephAlphaSymmet...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-2
embed_documents(texts: List[str]) → List[List[float]][source]# Call out to Cohere’s embedding endpoint. Parameters texts – The list of texts to embed. Returns List of embeddings, one for each text. embed_query(text: str) → List[float][source]# Call out to Cohere’s embedding endpoint. Parameters text – The text to embed...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-3
Compute doc embeddings using a HuggingFace transformer model. Parameters texts – The list of texts to embed. Returns List of embeddings, one for each text. embed_query(text: str) → List[float][source]# Compute query embeddings using a HuggingFace transformer model. Parameters text – The text to embed. Returns Embedding...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-4
Parameters text – The text to embed. Returns Embeddings for the text. pydantic model langchain.embeddings.HuggingFaceInstructEmbeddings[source]# Wrapper around sentence_transformers embedding models. To use, you should have the sentence_transformers and InstructorEmbedding python packages installed. Example from langch...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-5
To use, you should have the llama-cpp-python library installed, and provide the path to the Llama model as a named parameter to the constructor. Check out: abetlen/llama-cpp-python Example from langchain.embeddings import LlamaCppEmbeddings llama = LlamaCppEmbeddings(model_path="/path/to/model.bin") field f16_kv: bool ...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-6
pydantic model langchain.embeddings.OpenAIEmbeddings[source]# Wrapper around OpenAI embedding models. To use, you should have the openai python package installed, and the environment variable OPENAI_API_KEY set with your API key or pass it as a named parameter to the constructor. Example from langchain.embeddings impor...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-7
Call out to OpenAI’s embedding endpoint for embedding search docs. Parameters texts – The list of texts to embed. chunk_size – The chunk size of embeddings. If None, will use the chunk size specified by the class. Returns List of embeddings, one for each text. embed_query(text: str) → List[float][source]# Call out to O...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-8
credentials from IMDS will be used. See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html field endpoint_kwargs: Optional[Dict] = None# Optional attributes passed to the invoke_endpoint function. See `boto3`_. docs for more info. .. _boto3: <https://boto3.amazonaws.com/v1/documentation/api...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-9
cloud like Paperspace, Coreweave, etc.). To use, you should have the runhouse python package installed. Example using a model load function:from langchain.embeddings import SelfHostedEmbeddings from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline import runhouse as rh gpu = rh.cluster(name="rh-a10x", ...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-10
field inference_kwargs: Any = None# Any kwargs to pass to the model’s inference function. embed_documents(texts: List[str]) → List[List[float]][source]# Compute doc embeddings using a HuggingFace transformer model. Parameters texts – The list of texts to embed.s Returns List of embeddings, one for each text. embed_quer...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-11
field model_id: str = 'sentence-transformers/all-mpnet-base-v2'# Model name to use. field model_load_fn: Callable = <function load_embedding_model># Function to load the model remotely on the server. field model_reqs: List[str] = ['./', 'sentence_transformers', 'torch']# Requirements to install on hardware to inference...
https://python.langchain.com/en/latest/reference/modules/embeddings.html
521c8aa93adc-12
embed_documents(texts: List[str]) → List[List[float]][source]# Compute doc embeddings using a HuggingFace instruct model. Parameters texts – The list of texts to embed. Returns List of embeddings, one for each text. embed_query(text: str) → List[float][source]# Compute query embeddings using a HuggingFace instruct mode...
https://python.langchain.com/en/latest/reference/modules/embeddings.html