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