id stringlengths 14 16 | text stringlengths 36 2.73k | source stringlengths 49 117 |
|---|---|---|
fa678718cb2d-47 | Returns
Document results for search.
Return type
List[Document]
similarity_search_by_vector(embedding: List[float], k: int = 4, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) → List[langchain.schema.Document][source]#
Perform a similarity search against the query... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-48 | Defaults to None.
expr (str, optional) – Filtering expression. Defaults to None.
timeout (int, optional) – How long to wait before timeout error.
Defaults to None.
kwargs – Collection.search() keyword arguments.
Return type
List[float], List[Tuple[Document, any, any]]
similarity_search_with_score_by_vector(embedding: L... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-49 | To use, you should have both:
- the pymongo python package installed
- a connection string associated with a MongoDB Atlas Cluster having deployed an
Atlas Search index
Example
from langchain.vectorstores import MongoDBAtlasVectorSearch
from langchain.embeddings.openai import OpenAIEmbeddings
from pymongo import MongoC... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-50 | This is intended to be a quick way to get started.
Example
similarity_search(query: str, k: int = 4, pre_filter: Optional[dict] = None, post_filter_pipeline: Optional[List[Dict]] = None, **kwargs: Any) → List[langchain.schema.Document][source]#
Return MongoDB documents most similar to query.
Use the knnBeta Operator av... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-51 | Parameters
query – Text to look up documents similar to.
k – Optional Number of Documents to return. Defaults to 4.
pre_filter – Optional Dictionary of argument(s) to prefilter on document
fields.
post_filter_pipeline – Optional Pipeline of MongoDB aggregation stages
following the knnBeta search.
Returns
List of Docume... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-52 | Helper function: Drop data
escape_str(value: str) → str[source]#
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[Dict[Any, Any]]] = None, config: Optional[langchain.vectorstores.myscale.MyScaleSettings] = None, text_ids: Optional[Iterable[str]] = None, ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-53 | of SQL injection. When dealing with metadatas, remember to
use {self.metadata_column}.attribute instead of attribute
alone. The default name for it is metadata.
Returns
List of Documents
Return type
List[Document]
similarity_search_by_vector(embedding: List[float], k: int = 4, where_str: Optional[str] = None, **kwargs:... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-54 | List of documents most similar to the query text
and cosine distance in float for each.
Lower score represents more similarity.
Return type
List[Document]
pydantic settings langchain.vectorstores.MyScaleSettings[source]#
MyScale Client Configuration
Attribute:
myscale_host (str)An URL to connect to MyScale backend.Defa... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-55 | Show JSON schema{
"title": "MyScaleSettings",
"description": "MyScale Client Configuration\n\nAttribute:\n myscale_host (str) : An URL to connect to MyScale backend.\n Defaults to 'localhost'.\n myscale_port (int) : URL port to connect with HTTP. Defaults to 8443.\n username (str)... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-56 | },
"port": {
"title": "Port",
"default": 8443,
"env_names": "{'myscale_port'}",
"type": "integer"
},
"username": {
"title": "Username",
"env_names": "{'myscale_username'}",
"type": "string"
},
"password": {
"title": "P... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-57 | },
"table": {
"title": "Table",
"default": "langchain",
"env_names": "{'myscale_table'}",
"type": "string"
},
"metric": {
"title": "Metric",
"default": "cosine",
"env_names": "{'myscale_metric'}",
"type": "string"
}
},
... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-58 | Example
from langchain import OpenSearchVectorSearch
opensearch_vector_search = OpenSearchVectorSearch(
"http://localhost:9200",
"embeddings",
embedding_function
)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, bulk_size: int = 500, **kwargs: Any) → List[str][source]#
Run more texts... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-59 | search through Script Scoring and Painless Scripting.
Optional Args:vector_field: Document field embeddings are stored in. Defaults to
“vector_field”.
text_field: Document field the text of the document is stored in. Defaults
to “text”.
Optional Keyword Args for Approximate Search:engine: “nmslib”, “faiss”, “lucene”; d... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-60 | metadata_field: Document field that metadata is stored in. Defaults to
“metadata”.
Can be set to a special value “*” to include the entire document.
Optional Args for Approximate Search:search_type: “approximate_search”; default: “approximate_search”
boolean_filter: A Boolean filter consists of a Boolean query that
con... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-61 | k – Number of Documents to return. Defaults to 4.
Returns
List of Documents along with its scores most similar to the query.
Optional Args:same as similarity_search
class langchain.vectorstores.Pinecone(index: Any, embedding_function: Callable, text_key: str, namespace: Optional[str] = None)[source]#
Wrapper around Pin... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-62 | Load pinecone vectorstore from index name.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, batch_size: int = 32, text_key: str = 'text', index_name: Optional[str] = None, namespace: Optional[str] = None, *... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-63 | Returns
List of Documents most similar to the query and score for each
similarity_search_with_score(query: str, k: int = 4, filter: Optional[dict] = None, namespace: Optional[str] = None) → List[Tuple[langchain.schema.Document, float]][source]#
Return pinecone documents most similar to query, along with scores.
Paramet... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-64 | Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
ids – Optional list of ids to associate with the texts. Ids have to be
uuid-like strings.
batch_size – How many vectors upload per-request.
Default: 64
Returns
List of ids from adding the ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-65 | Construct Qdrant wrapper from a list of texts.
Parameters
texts – A list of texts to be indexed in Qdrant.
embedding – A subclass of Embeddings, responsible for text vectorization.
metadatas – An optional list of metadata. If provided it has to be of the same
length as a list of texts.
ids – Optional list of ids to ass... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-66 | collection_name – Name of the Qdrant collection to be used. If not provided,
it will be created randomly. Default: None
distance_func – Distance function. One of: “Cosine” / “Euclid” / “Dot”.
Default: “Cosine”
content_payload_key – A payload key used to store the content of the document.
Default: “page_content”
metadat... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-67 | init_from – Use data stored in another collection to initialize this collection
**kwargs – Additional arguments passed directly into REST client initialization
This is a user-friendly interface that:
1. Creates embeddings, one for each text
2. Initializes the Qdrant database as an in-memory docstore by default
(and ove... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-68 | Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
similarity_search(query: str, k: int = 4, filter: Optional[MetadataFilter] = None, search_params: Optional[common_types.SearchParams] = None, offset: int = 0, score_threshold: Optional[float] = None, consistency: Optional[common_types.Re... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-69 | Returns
List of Documents most similar to the query.
similarity_search_with_score(query: str, k: int = 4, filter: Optional[MetadataFilter] = None, search_params: Optional[common_types.SearchParams] = None, offset: int = 0, score_threshold: Optional[float] = None, consistency: Optional[common_types.ReadConsistency] = No... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-70 | distance in float for each.
Lower score represents more similarity.
class langchain.vectorstores.Redis(redis_url: str, index_name: str, embedding_function: typing.Callable, content_key: str = 'content', metadata_key: str = 'metadata', vector_key: str = 'content_vector', relevance_score_fn: typing.Optional[typing.Callab... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-71 | Returns
List of ids added to the vectorstore
Return type
List[str]
as_retriever(**kwargs: Any) → langchain.vectorstores.redis.RedisVectorStoreRetriever[source]#
static drop_index(index_name: str, delete_documents: bool, **kwargs: Any) → bool[source]#
Drop a Redis search index.
Parameters
index_name (str) – Name of the ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-72 | This is intended to be a quick way to get started.
.. rubric:: Example
classmethod from_texts_return_keys(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, index_name: Optional[str] = None, content_key: str = 'content', metadata_key: str = 'metadata', vector_key:... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-73 | k (int) – The number of documents to return. Default is 4.
score_threshold (float) – The minimum matching score required for a document
0.2. (to be considered a match. Defaults to) –
similarity (Because the similarity calculation algorithm is based on cosine) –
:param :
:param the smaller the angle:
:param the higher... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-74 | kwargs – vectorstore specific parameters
Returns
List of ids from adding the texts into the vectorstore.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, persist_path: Optional[str] = None, **kwargs: Any) →... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-75 | :param k: Number of Documents to return. Defaults to 4.
:param fetch_k: Number of Documents to fetch to pass to MMR algorithm.
:param lambda_mult: Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Retur... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-76 | Add more texts to the vectorstore.
Parameters
texts (Iterable[str]) – Iterable of strings/text to add to the vectorstore.
metadatas (Optional[List[dict]], optional) – Optional list of metadatas.
Defaults to None.
embeddings (Optional[List[List[float]]], optional) – Optional pre-generated
embeddings. Defaults to None.
R... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-77 | k (int) – The number of documents to return. Default is 4.
Returns
A list of documents that are most similar to the query text.
Return type
List[Document]
similarity_search_with_score(query: str, k: int = 4) → List[Tuple[langchain.schema.Document, float]][source]#
Return docs most similar to query. Uses cosine similari... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-78 | Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
kwargs – vectorstore specific parameters
Returns
List of ids from adding the texts into the vectorstore.
add_vectors(vectors: List[List[float]], documents: List[langchain.schema.Document])... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-79 | ```sql
CREATE FUNCTION match_documents_embeddings(query_embedding vector(1536),
match_count int)
RETURNS TABLE(id bigint,
content text,
metadata jsonb,
embedding vector(1536),
similarity float)
LANGUAGE plpgsql
AS $$
# variable_conflict use_column
BEGINRETURN query
SELECT
id,
content,
metadata,
embedding,
1 -(docstore.... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-80 | Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_by_vector_returning_embeddings(query: List[float], k: int) → List[Tuple[langchai... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-81 | Add texts data to an existing index.
create_index_if_not_exist(dim: int, distance_type: str, index_type: str, data_type: str, **kwargs: Any) → bool[source]#
static drop_index(index_name: str = 'langchain', **kwargs: Any) → bool[source]#
Drop an existing index.
Parameters
index_name (str) – Name of the index to drop.
Re... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-82 | Returns the most similar indexed documents to the query text.
Parameters
query (str) – The query text for which to find similar documents.
k (int) – The number of documents to return. Default is 4.
Returns
A list of documents that are most similar to the query text.
Return type
List[Document]
class langchain.vectorstor... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-83 | Return docs most similar to query.
similarity_search_with_score(query: str, k: int = 4, filter: Optional[TigrisFilter] = None) → List[Tuple[Document, float]][source]#
Run similarity search with Chroma with distance.
Parameters
query (str) – Query text to search for.
k (int) – Number of results to return. Defaults to 4.... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-84 | typesense_collection_name,
embedding.embed_query,
"text",
)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → List[str][source]#
Run more texts through the embedding and add to the vectorstore.
Parameters
texts – Iterable of strings to add ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-85 | protocol="http",
typesense_collection_name="langchain-memory",
)
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, typesense_client: Optional[Client] = None, typesense_client_params: Optional[dict] = None, typesense_collection_na... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-86 | .. rubric:: Example
from langchain.vectorstores import Vectara
vectorstore = Vectara(
vectara_customer_id=vectara_customer_id,
vectara_corpus_id=vectara_corpus_id,
vectara_api_key=vectara_api_key
)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) → List[str][source]#
Ru... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-87 | Return Vectara documents most similar to query, along with scores.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 5.
filter – 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.v... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-88 | Run more documents through the embeddings and add to the vectorstore.
Parameters
(List[Document] (documents) – Documents to add to the vectorstore.
Returns
List of IDs of the added texts.
Return type
List[str]
async aadd_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) → List[str][sour... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-89 | Return VectorStore initialized from texts and embeddings.
async amax_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[langchain.schema.Document][source]#
Return docs selected using the maximal marginal relevance.
async amax_marginal_relevance_search_by... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-90 | Return VectorStore initialized from documents and embeddings.
abstract classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → langchain.vectorstores.base.VST[source]#
Return VectorStore initialized from texts and embeddings.
max... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-91 | lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
search(query: str, search_type: str, **kwargs: Any) → List[langchain.sch... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-92 | Returns
List of Tuples of (doc, similarity_score)
class langchain.vectorstores.Weaviate(client: typing.Any, index_name: str, text_key: str, embedding: typing.Optional[langchain.embeddings.base.Embeddings] = None, attributes: typing.Optional[typing.List[str]] = None, relevance_score_fn: typing.Optional[typing.Callable[[... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-93 | weaviate = Weaviate.from_texts(
texts,
embeddings,
weaviate_url="http://localhost:8080"
)
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[langchain.schema.Document][source]#
Return docs selected using the maximal marginal relevance.
Ma... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-94 | Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
similarity_search(query: str, k: int = 4, **kwargs: Any) → List[langchain.schema.Document][source]#
Return docs most similar to query.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults t... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-95 | classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, collection_name: str = 'LangChainCollection', connection_args: dict[str, Any] = {}, consistency_level: str = 'Session', index_params: Optional[dict] = None, search_params: Optional[dict] = N... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
37669183a796-0 | .rst
.pdf
Agent Toolkits
Agent Toolkits#
Agent toolkits.
pydantic model langchain.agents.agent_toolkits.AzureCognitiveServicesToolkit[source]#
Toolkit for Azure Cognitive Services.
get_tools() → List[langchain.tools.base.BaseTool][source]#
Get the tools in the toolkit.
pydantic model langchain.agents.agent_toolkits.Fil... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-1 | get_tools() → List[langchain.tools.base.BaseTool][source]#
Get the tools in the toolkit.
pydantic model langchain.agents.agent_toolkits.NLAToolkit[source]#
Natural Language API Toolkit Definition.
field nla_tools: Sequence[langchain.agents.agent_toolkits.nla.tool.NLATool] [Required]#
List of API Endpoint Tools.
classme... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-2 | Instantiate the toolkit from an OpenAPI Spec URL
get_tools() → List[langchain.tools.base.BaseTool][source]#
Get the tools for all the API operations.
pydantic model langchain.agents.agent_toolkits.OpenAPIToolkit[source]#
Toolkit for interacting with a OpenAPI api.
field json_agent: langchain.agents.agent.AgentExecutor ... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-3 | field max_iterations: int = 5#
field powerbi: langchain.utilities.powerbi.PowerBIDataset [Required]#
get_tools() → List[langchain.tools.base.BaseTool][source]#
Get the tools in the toolkit.
pydantic model langchain.agents.agent_toolkits.SQLDatabaseToolkit[source]#
Toolkit for interacting with SQL databases.
field db: l... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-4 | Get the tools in the toolkit.
pydantic model langchain.agents.agent_toolkits.VectorStoreToolkit[source]#
Toolkit for interacting with a vector store.
field llm: langchain.base_language.BaseLanguageModel [Optional]#
field vectorstore_info: langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreInfo [Required]#
g... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-5 | langchain.agents.agent_toolkits.create_json_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.json.toolkit.JsonToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with JSON.\nYour goal... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-6 | you should ALWAYS follow up by using the `json_spec_list_keys` tool to see what keys exist at that path.\nDo not simply refer the user to the JSON or 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: str = 'Begin!"\n\nQuestion: {input}\nTh... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-7 | Construct a json agent from an LLM and tools. | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-8 | langchain.agents.agent_toolkits.create_openapi_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.openapi.toolkit.OpenAPIToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = "You are an agent designed to answer questions by m... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-9 | you should always think about what to do\nAction: the action to take, should be one of [{tool_names}]\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can repeat N times)\nThought: I now know the final answer\nFinal Answer: the final answer... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-10 | Construct a json agent from an LLM and tools.
langchain.agents.agent_toolkits.create_pandas_dataframe_agent(llm: langchain.base_language.BaseLanguageModel, df: Any, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: Optional[str] = None, suffix: Optional[str] = None, input_variable... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-11 | langchain.agents.agent_toolkits.create_pbi_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit], powerbi: Optional[langchain.utilities.powerbi.PowerBIDataset] = None, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManage... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-12 | you should always think about what to do\nAction: the action to take, should be one of [{tool_names}]\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can repeat N times)\nThought: I now know the final answer\nFinal Answer: the final answer... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-13 | Construct a pbi agent from an LLM and tools. | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-14 | langchain.agents.agent_toolkits.create_pbi_chat_agent(llm: langchain.chat_models.base.BaseChatModel, toolkit: Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit], powerbi: Optional[langchain.utilities.powerbi.PowerBIDataset] = None, callback_manager: Optional[langchain.callbacks.base.BaseCallbackMa... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-15 | (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\n\n{{{{input}}}}\n", examples: Optional[str] = None, input_variables: Optional[List[str]] = None, memory: Optional[langchain.memory.chat_memory.BaseChatMemory] = None, top_k: int = 10, verbose: bool = False, agent_... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-16 | 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.
langchain.agents.agent_toolkits.create_python_agent(llm: langchain.base_language.BaseLanguageModel, tool: langchain.tools.python.tool.PythonREPLTool, callback_manager: Optional[langchain... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-17 | Construct a python agent from an LLM and tool.
langchain.agents.agent_toolkits.create_spark_dataframe_agent(llm: langchain.llms.base.BaseLLM, df: Any, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = '\nYou are working with a spark dataframe in Python. The name of the dataf... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-18 | langchain.agents.agent_toolkits.create_spark_sql_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.spark_sql.toolkit.SparkSQLToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with Sp... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-19 | Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action 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: Optional[List[str]] = None, top_k: int = 10, max_iterations... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-20 | Construct a sql agent from an LLM and tools. | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-21 | langchain.agents.agent_toolkits.create_sql_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with a SQL datab... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-22 | to take, should be one of [{tool_names}]\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action 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: Optional[L... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-23 | Construct a sql agent from an LLM and tools.
langchain.agents.agent_toolkits.create_vectorstore_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: ... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
37669183a796-24 | Construct a vectorstore router agent from an LLM and tools.
previous
Tools
next
Utilities
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 11, 2023. | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
24db8f99ff8a-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 |
e56e9b3601d4-0 | .rst
.pdf
Retrievers
Retrievers#
pydantic model langchain.retrievers.ArxivRetriever[source]#
It is effectively a wrapper for ArxivAPIWrapper.
It wraps load() to get_relevant_documents().
It uses all ArxivAPIWrapper arguments without any change.
async aget_relevant_documents(query: str) → List[langchain.schema.Document]... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-1 | Wrapper around Azure Cognitive Search.
field aiosession: Optional[aiohttp.client.ClientSession] = None#
ClientSession, in case we want to reuse connection for better performance.
field api_key: str = ''#
API Key. Both Admin and Query keys work, but for reading data it’s
recommended to use a Query key.
field api_version... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-2 | Get documents relevant for a query.
Parameters
query – string to find relevant documents for
Returns
List of relevant documents
pydantic model langchain.retrievers.ContextualCompressionRetriever[source]#
Retriever that wraps a base retriever and compresses the results.
field base_compressor: langchain.retrievers.docume... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-3 | Returns
List of relevant documents
top_k: Optional[int]#
class langchain.retrievers.ElasticSearchBM25Retriever(client: Any, index_name: str)[source]#
Wrapper around Elasticsearch using BM25 as a retrieval method.
To connect to an Elasticsearch instance that requires login credentials,
including Elastic Cloud, use the E... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-4 | Parameters
query – string to find relevant documents for
Returns
List of relevant documents
classmethod create(elasticsearch_url: str, index_name: str, k1: float = 2.0, b: float = 0.75) → langchain.retrievers.elastic_search_bm25.ElasticSearchBM25Retriever[source]#
get_relevant_documents(query: str) → List[langchain.sch... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-5 | Parameters
retrievers – A list of retrievers to merge.
async aget_relevant_documents(query: str) → List[langchain.schema.Document][source]#
Asynchronously get the relevant documents for a given query.
Parameters
query – The query to search for.
Returns
A list of relevant documents.
async amerge_documents(query: str) → ... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-6 | field index: Any = None#
field sparse_encoder: Any = None#
field top_k: int = 4#
add_texts(texts: List[str], ids: Optional[List[str]] = None, metadatas: Optional[List[dict]] = None) → None[source]#
async aget_relevant_documents(query: str) → List[langchain.schema.Document][source]#
Get documents relevant for a query.
P... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-7 | field response_key: str = 'response'#
field url: str [Required]#
async aget_relevant_documents(query: str) → List[langchain.schema.Document][source]#
Get documents relevant for a query.
Parameters
query – string to find relevant documents for
Returns
List of relevant documents
get_relevant_documents(query: str) → List[... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-8 | The LLMChain for generating the vector store queries.
field search_kwargs: dict [Optional]#
Keyword arguments to pass in to the vector store search.
field search_type: str = 'similarity'#
The search type to perform on the vector store.
field structured_query_translator: langchain.chains.query_constructor.ir.Visitor [Re... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-9 | field tfidf_array: Any = None#
field vectorizer: Any = None#
async aget_relevant_documents(query: str) → List[langchain.schema.Document][source]#
Get documents relevant for a query.
Parameters
query – string to find relevant documents for
Returns
List of relevant documents
classmethod from_documents(documents: Iterable... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-10 | field other_score_keys: List[str] = []#
Other keys in the metadata to factor into the score, e.g. ‘importance’.
field search_kwargs: dict [Optional]#
Keyword arguments to pass to the vectorstore similarity search.
field vectorstore: langchain.vectorstores.base.VectorStore [Required]#
The vectorstore to store documents ... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-11 | Parameters
query – string to find relevant documents for
Returns
List of relevant documents
classmethod from_params(url: str, content_field: str, *, k: Optional[int] = None, metadata_fields: Union[Sequence[str], Literal['*']] = (), sources: Optional[Union[Sequence[str], Literal['*']]] = None, _filter: Optional[str] = N... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-12 | class langchain.retrievers.WeaviateHybridSearchRetriever(client: Any, index_name: str, text_key: str, alpha: float = 0.5, k: int = 4, attributes: Optional[List[str]] = None, create_schema_if_missing: bool = True)[source]#
class Config[source]#
Configuration for this pydantic object.
arbitrary_types_allowed = True#
extr... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
e56e9b3601d4-13 | Parameters
query – string to find relevant documents for
Returns
List of relevant documents
class langchain.retrievers.ZepRetriever(session_id: str, url: str, top_k: Optional[int] = None)[source]#
A Retriever implementation for the Zep long-term memory store. Search your
user’s long-term chat history with Zep.
Note: Yo... | https://python.langchain.com/en/latest/reference/modules/retrievers.html |
7cef05c07832-0 | .rst
.pdf
Text Splitter
Text Splitter#
Functionality for splitting text.
class langchain.text_splitter.CharacterTextSplitter(separator: str = '\n\n', **kwargs: Any)[source]#
Implementation of splitting text that looks at characters.
split_text(text: str) → List[str][source]#
Split incoming text and return chunks.
class... | https://python.langchain.com/en/latest/reference/modules/text_splitter.html |
7cef05c07832-1 | Attempts to split the text along Python syntax.
class langchain.text_splitter.RecursiveCharacterTextSplitter(separators: Optional[List[str]] = None, keep_separator: bool = True, **kwargs: Any)[source]#
Implementation of splitting text that looks at characters.
Recursively tries to split by different characters to find ... | https://python.langchain.com/en/latest/reference/modules/text_splitter.html |
7cef05c07832-2 | Interface for splitting text into chunks.
async atransform_documents(documents: Sequence[langchain.schema.Document], **kwargs: Any) → Sequence[langchain.schema.Document][source]#
Asynchronously transform a sequence of documents by splitting them.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None... | https://python.langchain.com/en/latest/reference/modules/text_splitter.html |
7cef05c07832-3 | Implementation of splitting text that looks at tokens.
split_text(text: str) → List[str][source]#
Split text into multiple components.
class langchain.text_splitter.Tokenizer(chunk_overlap: 'int', tokens_per_chunk: 'int', decode: 'Callable[[list[int]], str]', encode: 'Callable[[str], List[int]]')[source]#
chunk_overlap... | https://python.langchain.com/en/latest/reference/modules/text_splitter.html |
bdbf99f63d6a-0 | .rst
.pdf
PromptTemplates
PromptTemplates#
Prompt template classes.
pydantic model langchain.prompts.BaseChatPromptTemplate[source]#
format(**kwargs: Any) → str[source]#
Format the prompt with the inputs.
Parameters
kwargs – Any arguments to be passed to the prompt template.
Returns
A formatted string.
Example:
prompt.... | https://python.langchain.com/en/latest/reference/modules/prompts.html |
bdbf99f63d6a-1 | Example:
.. code-block:: python
prompt.save(file_path=”path/prompt.yaml”)
pydantic model langchain.prompts.ChatPromptTemplate[source]#
format(**kwargs: Any) → str[source]#
Format the prompt with the inputs.
Parameters
kwargs – Any arguments to be passed to the prompt template.
Returns
A formatted string.
Example:
promp... | https://python.langchain.com/en/latest/reference/modules/prompts.html |
bdbf99f63d6a-2 | field prefix: str = ''#
A prompt template string to put before the examples.
field suffix: str [Required]#
A prompt template string to put after the examples.
field template_format: str = 'f-string'#
The format of the prompt template. Options are: ‘f-string’, ‘jinja2’.
field validate_template: bool = True#
Whether or n... | https://python.langchain.com/en/latest/reference/modules/prompts.html |
bdbf99f63d6a-3 | A PromptTemplate to put after the examples.
field template_format: str = 'f-string'#
The format of the prompt template. Options are: ‘f-string’, ‘jinja2’.
field validate_template: bool = True#
Whether or not to try validating the template.
dict(**kwargs: Any) → Dict[source]#
Return a dictionary of the prompt.
format(**... | https://python.langchain.com/en/latest/reference/modules/prompts.html |
bdbf99f63d6a-4 | Parameters
kwargs – Any arguments to be passed to the prompt template.
Returns
A formatted string.
Example:
prompt.format(variable1="foo")
classmethod from_examples(examples: List[str], suffix: str, input_variables: List[str], example_separator: str = '\n\n', prefix: str = '', **kwargs: Any) → langchain.prompts.prompt.... | https://python.langchain.com/en/latest/reference/modules/prompts.html |
bdbf99f63d6a-5 | Create Chat Messages.
langchain.prompts.load_prompt(path: Union[str, pathlib.Path]) → langchain.prompts.base.BasePromptTemplate[source]#
Unified method for loading a prompt from LangChainHub or local fs.
previous
Prompts
next
Example Selector
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last ... | https://python.langchain.com/en/latest/reference/modules/prompts.html |
b7a7c0737c44-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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.