id
stringlengths
14
16
text
stringlengths
31
2.41k
source
stringlengths
53
121
2b28b54605b7-122
index_name (str) – content_key (str) – metadata_key (str) – kwargs (Any) – Return type langchain.vectorstores.tair.Tair class langchain.vectorstores.Tigris(client, embeddings, index_name)[source] Bases: langchain.vectorstores.base.VectorStore Parameters client (TigrisClient) – embeddings (Embeddings) – index_nam...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-123
filter (Optional[TigrisFilter]) – Filter by metadata. Defaults to None. Returns List of documents most similar to the querytext with distance in float. Return type List[Tuple[Document, float]] classmethod from_texts(texts, embedding, metadatas=None, ids=None, client=None, index_name=None, **kwargs)[source] Return Vect...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-124
typesense_client=typesense_client, embedding=embedding, typesense_collection_name=typesense_collection_name, text_key="text", ) Parameters typesense_client (Client) – embedding (Embeddings) – typesense_collection_name (Optional[str]) – text_key (str) – add_texts(texts, metadatas=None, ids=None, **kwargs...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-125
Minimum 10 results would be returned. filter (Optional[str]) – typesense filter_by expression to filter documents on kwargs (Any) – Returns List of Documents most similar to the query and score for each Return type List[langchain.schema.Document] classmethod from_client_params(embedding, *, host='localhost', port='810...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-126
typesense_client_params (Optional[dict]) – typesense_collection_name (Optional[str]) – text_key (str) – kwargs (Any) – Return type Typesense class langchain.vectorstores.Vectara(vectara_customer_id=None, vectara_corpus_id=None, vectara_api_key=None)[source] Bases: langchain.vectorstores.base.VectorStore Implementa...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-127
lambda_val (float) – lexical match parameter for hybrid search. filter (Optional[str]) – Dictionary of argument(s) to filter on metadata. For example a filter can be β€œdoc.rating > 3.0 and part.lang = β€˜deu’”} see https://docs.vectara.com/docs/search-apis/sql/filter-overview for more details. n_sentence_context (int) – n...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-128
.. rubric:: Example from langchain import Vectara vectara = Vectara.from_texts( texts, vectara_customer_id=customer_id, vectara_corpus_id=corpus_id, vectara_api_key=api_key, ) Parameters texts (List[str]) – embedding (Optional[langchain.embeddings.base.Embeddings]) – metadatas (Optional[List[dict]]) –...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-129
texts (Iterable[str]) – metadatas (Optional[List[dict]]) – kwargs (Any) – Return type List[str] add_documents(documents, **kwargs)[source] Run more documents through the embeddings and add to the vectorstore. Parameters (List[Document] (documents) – Documents to add to the vectorstore. documents (List[langchain.sch...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-130
kwargs (Any) – Return type List[langchain.schema.Document] similarity_search_with_relevance_scores(query, k=4, **kwargs)[source] Return docs and relevance scores in the range [0, 1]. 0 is dissimilar, 1 is most similar. Parameters query (str) – input text k (int) – Number of Documents to return. Defaults to 4. **kwarg...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-131
Return type List[langchain.schema.Document] async asimilarity_search_by_vector(embedding, k=4, **kwargs)[source] Return docs most similar to embedding vector. Parameters embedding (List[float]) – k (int) – kwargs (Any) – Return type List[langchain.schema.Document] max_marginal_relevance_search(query, k=4, fetch_k=2...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-132
Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. Parameters embedding (List[float]) – Embedding to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. fetch_k (int) – Number o...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-133
kwargs (Any) – Return type langchain.vectorstores.base.VST abstract classmethod from_texts(texts, embedding, metadatas=None, **kwargs)[source] Return VectorStore initialized from texts and embeddings. Parameters texts (List[str]) – embedding (langchain.embeddings.base.Embeddings) – metadatas (Optional[List[dict]]) ...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-134
embedding (Optional[Embeddings]) – attributes (Optional[List[str]]) – relevance_score_fn (Optional[Callable[[float], float]]) – by_text (bool) – add_texts(texts, metadatas=None, **kwargs)[source] Upload texts with metadata (properties) to Weaviate. Parameters texts (Iterable[str]) – metadatas (Optional[List[dict]...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-135
Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. Parameters query (str) – Text to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. fetch_k (int) – Number of Documents to fe...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
2b28b54605b7-136
text and cosine distance in float for each. Lower score represents more similarity. Parameters query (str) – k (int) – kwargs (Any) – Return type List[Tuple[langchain.schema.Document, float]] classmethod from_texts(texts, embedding, metadatas=None, **kwargs)[source] Construct Weaviate wrapper from raw documents. Th...
https://api.python.langchain.com/en/stable/modules/vectorstores.html
0344f06df581-0
Agent Toolkits Agent toolkits.
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-1
langchain.agents.agent_toolkits.create_json_agent(llm, toolkit, callback_manager=None, prefix='You are an agent designed to interact with JSON.\nYour goal is to return a final answer by interacting with the JSON.\nYou have access to the following tools which help you learn more about the JSON you are interacting with.\...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-2
a section of the JSON, as this is not a valid answer. Keep digging until you find the answer and explicitly return it.\n', suffix='Begin!"\n\nQuestion: {input}\nThought: I should look at the keys that exist in data to see what I have access to\n{agent_scratchpad}', format_instructions='Use the following format:\n\nQues...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-3
Construct a json agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.json.toolkit.JsonToolkit) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (str) – suffix (str) – format_instructions (str) – inpu...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-4
langchain.agents.agent_toolkits.create_sql_agent(llm, toolkit, agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION, callback_manager=None, prefix='You are an agent designed to interact with a SQL database.\nGiven an input question, create a syntactically correct {dialect} query to run, then look at the results of the quer...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-5
max_iterations=15, max_execution_time=None, early_stopping_method='force', verbose=False, agent_executor_kwargs=None, **kwargs)[source]
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-6
Construct a sql agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit) – agent_type (langchain.agents.agent_types.AgentType) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefi...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-7
langchain.agents.agent_toolkits.create_openapi_agent(llm, toolkit, callback_manager=None, prefix="You are an agent designed to answer questions by making web requests to an API given the openapi spec.\n\nIf the question does not seem related to the API, return I don't know. Do not make up an answer.\nOnly use informati...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-8
Input/Observation can repeat N times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question', input_variables=None, max_iterations=15, max_execution_time=None, early_stopping_method='force', verbose=False, return_intermediate_steps=False, agent_executor_kwargs=None, **kwar...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-9
Construct a json agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.openapi.toolkit.OpenAPIToolkit) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (str) – suffix (str) – format_instructions (str) –...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-10
langchain.agents.agent_toolkits.create_pbi_agent(llm, toolkit, powerbi=None, callback_manager=None, prefix='You are an agent designed to help users interact with a PowerBI Dataset.\n\nAgent has access to a tool that can write a query based on the question and then run those against PowerBI, Microsofts business intellig...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-11
know the final answer\nFinal Answer: the final answer to the original input question', examples=None, input_variables=None, top_k=10, verbose=False, agent_executor_kwargs=None, **kwargs)[source]
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-12
Construct a pbi agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit]) – powerbi (Optional[langchain.utilities.powerbi.PowerBIDataset]) – callback_manager (Optional[langchain.callbacks.base.BaseCallb...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-13
Return type langchain.agents.agent.AgentExecutor langchain.agents.agent_toolkits.create_pbi_chat_agent(llm, toolkit, powerbi=None, callback_manager=None, output_parser=None, prefix='Assistant is a large language model built to help users interact with a PowerBI Dataset.\n\nAssistant has access to a tool that can write ...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-14
Construct a pbi agent from an Chat LLM and tools. If you supply only a toolkit and no powerbi dataset, the same LLM is used for both. Parameters llm (langchain.chat_models.base.BaseChatModel) – toolkit (Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit]) – powerbi (Optional[langchain.utilities.p...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-15
Construct a python agent from an LLM and tool. Parameters llm (langchain.base_language.BaseLanguageModel) – tool (langchain.tools.python.tool.PythonREPLTool) – agent_type (langchain.agents.agent_types.AgentType) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – verbose (bool) – prefix (...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-16
class langchain.agents.agent_toolkits.JsonToolkit(*, spec)[source] Bases: langchain.agents.agent_toolkits.base.BaseToolkit Toolkit for interacting with a JSON spec. Parameters spec (langchain.tools.json.tool.JsonSpec) – Return type None attribute spec: langchain.tools.json.tool.JsonSpec [Required] get_tools()[source...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-17
get_tools()[source] Get the tools in the toolkit. Return type List[langchain.tools.base.BaseTool] class langchain.agents.agent_toolkits.NLAToolkit(*, nla_tools)[source] Bases: langchain.agents.agent_toolkits.base.BaseToolkit Natural Language API Toolkit Definition. Parameters nla_tools (Sequence[langchain.agents.agen...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-18
Instantiate the toolkit by creating tools for each operation. Parameters llm (langchain.base_language.BaseLanguageModel) – spec (langchain.utilities.openapi.OpenAPISpec) – requests (Optional[langchain.requests.Requests]) – verbose (bool) – kwargs (Any) – Return type langchain.agents.agent_toolkits.nla.toolkit.NLAT...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-19
attribute examples: Optional[str] = None attribute llm: langchain.base_language.BaseLanguageModel [Required] attribute max_iterations: int = 5 attribute powerbi: langchain.utilities.powerbi.PowerBIDataset [Required] get_tools()[source] Get the tools in the toolkit. Return type List[langchain.tools.base.BaseTool] c...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-20
Toolkit for interacting with a vector store. Parameters vectorstore_info (langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreInfo) – llm (langchain.base_language.BaseLanguageModel) – Return type None attribute llm: langchain.base_language.BaseLanguageModel [Optional] attribute vectorstore_info: langchain...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-21
Bases: pydantic.main.BaseModel Information about a vectorstore. Parameters vectorstore (langchain.vectorstores.base.VectorStore) – name (str) – description (str) – Return type None attribute description: str [Required] attribute name: str [Required] attribute vectorstore: langchain.vectorstores.base.VectorStore [R...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-22
agent_type (langchain.agents.agent_types.AgentType) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (Optional[str]) – suffix (Optional[str]) – input_variables (Optional[List[str]]) – verbose (bool) – return_intermediate_steps (bool) – max_iterations (Optional[int]) – max_exe...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-23
max_iterations (Optional[int]) – max_execution_time (Optional[float]) – early_stopping_method (str) – agent_executor_kwargs (Optional[Dict[str, Any]]) – kwargs (Dict[str, Any]) – Return type langchain.agents.agent.AgentExecutor
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-24
langchain.agents.agent_toolkits.create_spark_sql_agent(llm, toolkit, callback_manager=None, prefix='You are an agent designed to interact with Spark SQL.\nGiven an input question, create a syntactically correct Spark SQL query to run, then look at the results of the query and return the answer.\nUnless the user specifi...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-25
Answer: the final answer to the original input question', input_variables=None, top_k=10, max_iterations=15, max_execution_time=None, early_stopping_method='force', verbose=False, agent_executor_kwargs=None, **kwargs)[source]
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-26
Construct a sql agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.spark_sql.toolkit.SparkSQLToolkit) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (str) – suffix (str) – format_instructions (str)...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-27
Create a toolkit from a ZapierNLAWrapper. Parameters zapier_nla_wrapper (langchain.utilities.zapier.ZapierNLAWrapper) – Return type langchain.agents.agent_toolkits.zapier.toolkit.ZapierToolkit classmethod from_zapier_nla_wrapper(zapier_nla_wrapper)[source] Create a toolkit from a ZapierNLAWrapper. Parameters zapier_n...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-28
get_tools()[source] Get the tools in the toolkit. Return type List[langchain.tools.base.BaseTool] class langchain.agents.agent_toolkits.FileManagementToolkit(*, root_dir=None, selected_tools=None)[source] Bases: langchain.agents.agent_toolkits.base.BaseToolkit Toolkit for interacting with a Local Files. Parameters ro...
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
0344f06df581-29
class langchain.agents.agent_toolkits.AzureCognitiveServicesToolkit[source] Bases: langchain.agents.agent_toolkits.base.BaseToolkit Toolkit for Azure Cognitive Services. Return type None get_tools()[source] Get the tools in the toolkit. Return type List[langchain.tools.base.BaseTool]
https://api.python.langchain.com/en/stable/modules/agent_toolkits.html
fcfdf074c66a-0
Output Parsers class langchain.output_parsers.BooleanOutputParser(*, true_val='YES', false_val='NO')[source] Bases: langchain.schema.BaseOutputParser[bool] Parameters true_val (str) – false_val (str) – Return type None attribute false_val: str = 'NO' attribute true_val: str = 'YES' parse(text)[source] Parse the ...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-1
Parameters text (str) – Return type List[str] class langchain.output_parsers.DatetimeOutputParser(*, format='%Y-%m-%dT%H:%M:%S.%fZ')[source] Bases: langchain.schema.BaseOutputParser[datetime.datetime] Parameters format (str) – Return type None attribute format: str = '%Y-%m-%dT%H:%M:%S.%fZ' get_format_instructions(...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-2
Bases: langchain.schema.BaseOutputParser Parameters guard (Any) – api (Optional[Callable]) – args (Any) – kwargs (Any) – Return type None attribute api: Optional[Callable] = None attribute args: Any = None attribute guard: Any = None attribute kwargs: Any = None classmethod from_pydantic(output_class, num_reask...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-3
str parse(text)[source] Parse the output of an LLM call. A method which takes in a string (assumed output of a language model ) and parses it into some structure. Parameters text (str) – output of language model Returns structured output Return type Dict class langchain.output_parsers.ListOutputParser[source] Bases: ...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-4
attribute retry_chain: langchain.chains.llm.LLMChain [Required] classmethod from_llm(llm, parser, prompt=PromptTemplate(input_variables=['completion', 'error', 'instructions'], output_parser=None, partial_variables={}, template='Instructions:\n--------------\n{instructions}\n--------------\nCompletion:\n--------------...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-5
Return type None attribute pydantic_object: Type[langchain.output_parsers.pydantic.T] [Required] get_format_instructions()[source] Instructions on how the LLM output should be formatted. Return type str parse(text)[source] Parse the output of an LLM call. A method which takes in a string (assumed output of a languag...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-6
default_output_key (Optional[str]) – Return type None attribute default_output_key: Optional[str] = None attribute output_keys: List[str] [Required] attribute regex: str [Required] parse(text)[source] Parse the output of an LLM call. Parameters text (str) – Return type Dict[str, str] class langchain.output_parser...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-7
attribute retry_chain: langchain.chains.llm.LLMChain [Required] classmethod from_llm(llm, parser, prompt=PromptTemplate(input_variables=['completion', 'prompt'], output_parser=None, partial_variables={}, template='Prompt:\n{prompt}\nCompletion:\n{completion}\n\nAbove, the Completion did not satisfy the constraints giv...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-8
Returns structured output Return type langchain.output_parsers.retry.T class langchain.output_parsers.RetryWithErrorOutputParser(*, parser, retry_chain)[source] Bases: langchain.schema.BaseOutputParser[langchain.output_parsers.retry.T] Wraps a parser and tries to fix parsing errors. Does this by passing the original p...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-9
get_format_instructions()[source] Instructions on how the LLM output should be formatted. Return type str parse(completion)[source] Parse the output of an LLM call. A method which takes in a string (assumed output of a language model ) and parses it into some structure. Parameters text – output of language model comp...
https://api.python.langchain.com/en/stable/modules/output_parsers.html
fcfdf074c66a-10
str parse(text)[source] Parse the output of an LLM call. A method which takes in a string (assumed output of a language model ) and parses it into some structure. Parameters text (str) – output of language model Returns structured output Return type Any
https://api.python.langchain.com/en/stable/modules/output_parsers.html
4f5128845410-0
Embeddings Wrappers around embedding modules. class langchain.embeddings.OpenAIEmbeddings(*, client=None, model='text-embedding-ada-002', deployment='text-embedding-ada-002', openai_api_version=None, openai_api_base=None, openai_api_type=None, openai_proxy=None, embedding_ctx_length=8191, openai_api_key=None, openai_o...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-1
from langchain.embeddings.openai import OpenAIEmbeddings embeddings = OpenAIEmbeddings( deployment="your-embeddings-deployment-name", model="your-embeddings-model-name", openai_api_base="https://your-endpoint.openai.azure.com/", openai_api_type="azure", ) text = "This is a test query." query_result = em...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-2
The model name to pass to tiktoken when using this class. Tiktoken is used to count the number of tokens in documents to constrain them to be under a certain limit. By default, when set to None, this will be the same as the embedding model name. However, there are some cases where you may want to use this Embedding cla...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-3
Return type List[List[float]] embed_query(text)[source] Call out to OpenAI’s embedding endpoint for embedding query text. Parameters text (str) – The text to embed. Returns Embedding for the text. Return type List[float] class langchain.embeddings.HuggingFaceEmbeddings(*, client=None, model_name='sentence-transformers...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-4
Model name to use. embed_documents(texts)[source] Compute doc embeddings using a HuggingFace transformer model. 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] Compute query embeddings using a HuggingFace...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-5
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 Cohere’s embedding endpoint. Parameters text (str) – The text to embed. Returns Embeddings for the text. Return type List[float] class langchain....
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-6
es_password (Optional[str]) – (str, optional): Elasticsearch password. Return type langchain.embeddings.elasticsearch.ElasticsearchEmbeddings Example from langchain.embeddings import ElasticsearchEmbeddings # Define the model ID and input field name (if different from default) model_id = "your_model_id" # Optional, onl...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-7
Example from elasticsearch import Elasticsearch from langchain.embeddings import ElasticsearchEmbeddings # Define the model ID and input field name (if different from default) model_id = "your_model_id" # Optional, only if different from 'text_field' input_field = "your_input_field" # Create Elasticsearch connection es...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-8
Bases: pydantic.main.BaseModel, langchain.embeddings.base.Embeddings Wrapper around llama.cpp embedding models. 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: https://github.com/abetlen/llama-cpp-python Example ...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-9
Number of threads to use. If None, the number of threads is automatically determined. attribute seed: int = -1 Seed. If -1, a random seed is used. attribute use_mlock: bool = False Force system to keep model in RAM. attribute vocab_only: bool = False Only load the vocabulary, no weights. embed_documents(texts)[sourc...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-10
) Parameters client (Any) – repo_id (str) – task (Optional[str]) – model_kwargs (Optional[dict]) – huggingfacehub_api_token (Optional[str]) – Return type None attribute model_kwargs: Optional[dict] = None Key word arguments to pass to the model. attribute repo_id: str = 'sentence-transformers/all-mpnet-base-v2' ...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-11
embed (Any) – model_id (str) – Return type None attribute model_id: str = 'damo/nlp_corom_sentence-embedding_english-base' Model name to use. embed_documents(texts)[source] Compute doc embeddings using a modelscope embedding model. Parameters texts (List[str]) – The list of texts to embed. Returns List of embedding...
https://api.python.langchain.com/en/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
4f5128845410-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/stable/modules/embeddings.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html
6d859eadd4b9-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/stable/modules/utilities.html