id
stringlengths
14
15
text
stringlengths
13
2.7k
source
stringlengths
60
181
92ceb8f88a34-4
To mark a field as configurable, see the configurable_fields and configurable_alternatives methods. Parameters include – A list of fields to include in the config schema. Returns A pydantic model that can be used to validate config. configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', pr...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vectara.VectaraRetriever.html
92ceb8f88a34-5
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vectara.VectaraRetriever.html
92ceb8f88a34-6
This method allows to get an output schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate output. get_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[D...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vectara.VectaraRetriever.html
92ceb8f88a34-7
classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vectara.VectaraRetriever.html
92ceb8f88a34-8
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of stream, which calls invoke. Subclasses should override t...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vectara.VectaraRetriever.html
92ceb8f88a34-9
fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶ Bind lifecycle listeners to a Runnable, returning a new Runnable. on_start: Called before the runnable starts running, with the Run ...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vectara.VectaraRetriever.html
92ceb8f88a34-10
property OutputType: Type[langchain_core.runnables.utils.Output]¶ The type of output this runnable produces specified as a type annotation. allowed_search_types: ClassVar[Collection[str]] = ('similarity', 'similarity_score_threshold', 'mmr')¶ property config_specs: List[langchain_core.runnables.utils.ConfigurableFieldS...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vectara.VectaraRetriever.html
53efc7a045d0-0
langchain_community.vectorstores.pgembedding.PGEmbedding¶ class langchain_community.vectorstores.pgembedding.PGEmbedding(connection_string: str, embedding_function: Embeddings, collection_name: str = 'langchain', collection_metadata: Optional[dict] = None, pre_delete_collection: bool = False, logger: Optional[Logger] =...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
53efc7a045d0-1
add_texts(texts[, metadatas, ids]) Run more texts through the embeddings and add to the vectorstore. adelete([ids]) Delete by vector ID or other criteria. afrom_documents(documents, embedding, **kwargs) Return VectorStore initialized from documents and embeddings. afrom_texts(texts, embedding[, metadatas]) Return Vecto...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
53efc7a045d0-2
from_texts(texts, embedding[, metadatas, ...]) Return VectorStore initialized from texts and embeddings. get_collection(session) get_connection_string(kwargs) max_marginal_relevance_search(query[, k, ...]) Return docs selected using the maximal marginal relevance. max_marginal_relevance_search_by_vector(...) Return doc...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
53efc7a045d0-3
Run more texts through the embeddings and add to the vectorstore. add_documents(documents: List[Document], **kwargs: Any) → List[str]¶ 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 text...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
53efc7a045d0-4
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[Document]¶ Return docs selected using the maximal marginal relevance. async amax_marginal_relevance_search_by_vector(embedding: List[f...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
53efc7a045d0-5
) # Fetch more documents for the MMR algorithm to consider # But only return the top 5 docsearch.as_retriever( search_type="mmr", search_kwargs={'k': 5, 'fetch_k': 50} ) # Only retrieve documents that have a relevance score # Above a certain threshold docsearch.as_retriever( search_type="similarity_score_th...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
53efc7a045d0-6
**kwargs – kwargs to be passed to similarity search. Should include: score_threshold: Optional, a floating point value between 0 to 1 to filter the resulting set of retrieved docs Returns List of Tuples of (doc, similarity_score) async asimilarity_search_with_score(*args: Any, **kwargs: Any) → List[Tuple[Document, floa...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
53efc7a045d0-7
Return VectorStore initialized from documents and embeddings. classmethod from_embeddings(text_embeddings: List[Tuple[str, List[float]]], embedding: Embeddings, metadatas: Optional[List[dict]] = None, collection_name: str = 'langchain', ids: Optional[List[str]] = None, pre_delete_collection: bool = False, **kwargs: Any...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
53efc7a045d0-8
Defaults to 0.5. Returns List of Documents selected by maximal marginal relevance. max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶ Return docs selected using the maximal marginal relevance. Maximal marginal relevan...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
53efc7a045d0-9
Returns List of Documents most similar to the query vector. similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶ Return docs and relevance scores in the range [0, 1]. 0 is dissimilar, 1 is most similar. Parameters query – input text k – Number of Documents to re...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.pgembedding.PGEmbedding.html
d495ad859a13-0
langchain_community.vectorstores.redis.filters.RedisFilter¶ class langchain_community.vectorstores.redis.filters.RedisFilter[source]¶ Collection of RedisFilterFields. Methods __init__() num(field) tag(field) text(field) __init__()¶ static num(field: str) → RedisNum[source]¶ static tag(field: str) → RedisTag[source]¶ st...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.filters.RedisFilter.html
18b2f6200cf6-0
langchain_community.vectorstores.milvus.Milvus¶ class langchain_community.vectorstores.milvus.Milvus(embedding_function: Embeddings, collection_name: str = 'LangChainCollection', connection_args: Optional[dict[str, Any]] = None, consistency_level: str = 'Session', index_params: Optional[dict] = None, search_params: Opt...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-1
drop_old (Optional[bool]) – Whether to drop the current collection. Defaults to False. primary_field (str) – Name of the primary key field. Defaults to “pk”. text_field (str) – Name of the text field. Defaults to “text”. vector_field (str) – Name of the vector field. Defaults to “vector”. The connection args used for t...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-2
server_pem_path (str): If use tls one-way authentication, need towrite the server.pem path. server_name (str): If use tls, need to write the common name. Example from langchain_community.vectorstores import Milvus from langchain_community.embeddings import OpenAIEmbeddings embedding = OpenAIEmbeddings() # Connect to a ...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-3
Return docs selected using the maximal marginal relevance. as_retriever(**kwargs) Return VectorStoreRetriever initialized from this VectorStore. asearch(query, search_type, **kwargs) Return docs most similar to query using specified search type. asimilarity_search(query[, k]) Return docs most similar to query. asimilar...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-4
similarity_search_with_score(query[, k, ...]) Perform a search on a query string and return results with score. similarity_search_with_score_by_vector(embedding) Perform a search on a query string and return results with score. __init__(embedding_function: Embeddings, collection_name: str = 'LangChainCollection', conne...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-5
Returns List of IDs of the added texts. Return type List[str] add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, timeout: Optional[int] = None, batch_size: int = 1000, **kwargs: Any) → List[str][source]¶ Insert text data into Milvus. Inserting data when the collection has not be made yet will resul...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-6
Return VectorStore initialized from documents and embeddings. async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶ Return VectorStore initialized from texts and embeddings. async amax_marginal_relevance_search(query: str, k: int = 4, fetch_...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-7
Return type VectorStoreRetriever Examples: # Retrieve more documents with higher diversity # Useful if your dataset has many similar documents docsearch.as_retriever( search_type="mmr", search_kwargs={'k': 6, 'lambda_mult': 0.25} ) # Fetch more documents for the MMR algorithm to consider # But only return the t...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-8
Return docs and relevance scores in the range [0, 1], asynchronously. 0 is dissimilar, 1 is most similar. Parameters query – input text k – Number of Documents to return. Defaults to 4. **kwargs – kwargs to be passed to similarity search. Should include: score_threshold: Optional, a floating point value between 0 to 1 ...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-9
Parameters texts (List[str]) – Text data. embedding (Embeddings) – Embedding function. metadatas (Optional[List[dict]]) – Metadata for each text if it exists. Defaults to None. collection_name (str, optional) – Collection name to use. Defaults to “LangChainCollection”. connection_args (dict[str, Any], optional) – Conne...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-10
to maximum diversity and 1 to minimum diversity. Defaults to 0.5 param (dict, optional) – The search params for the specified index. 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.sea...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-11
Return docs most similar to query using specified search type. similarity_search(query: str, k: int = 4, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) → List[Document][source]¶ Perform a similarity search against the query string. Parameters query (str) – The te...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-12
Returns Document results for search. Return type List[Document] similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶ Return docs and relevance scores in the range [0, 1]. 0 is dissimilar, 1 is most similar. Parameters query – input text k – Number of Documents t...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
18b2f6200cf6-13
Return type List[float], List[Tuple[Document, any, any]] similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶ Perform a search on a query string and retur...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.milvus.Milvus.html
4f43eff18ea5-0
langchain_community.vectorstores.utils.filter_complex_metadata¶ langchain_community.vectorstores.utils.filter_complex_metadata(documents: ~typing.List[~langchain_core.documents.base.Document], *, allowed_types: ~typing.Tuple[~typing.Type, ...] = (<class 'str'>, <class 'bool'>, <class 'int'>, <class 'float'>)) → List[Do...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.utils.filter_complex_metadata.html
c2abb3686047-0
langchain_community.vectorstores.meilisearch.Meilisearch¶ class langchain_community.vectorstores.meilisearch.Meilisearch(embedding: Embeddings, client: Optional[Client] = None, url: Optional[str] = None, api_key: Optional[str] = None, index_name: str = 'langchain-demo', text_key: str = 'text', metadata_key: str = 'meta...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-1
Initialize with Meilisearch client. aadd_documents(documents, **kwargs) Run more documents through the embeddings and add to the vectorstore. aadd_texts(texts[, metadatas]) Run more texts through the embeddings and add to the vectorstore. add_documents(documents, **kwargs) Run more documents through the embeddings and ...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-2
Return VectorStore initialized from documents and embeddings. from_texts(texts, embedding[, metadatas, ...]) Construct Meilisearch wrapper from raw documents. max_marginal_relevance_search(query[, k, ...]) Return docs selected using the maximal marginal relevance. max_marginal_relevance_search_by_vector(...) Return doc...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-3
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]¶ Run more texts through the embeddings and add to the vectorstore. add_documents(documents: List[Document], **kwargs: Any) → List[str]¶ Run more documen...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-4
Return VectorStore initialized from documents and embeddings. async classmethod afrom_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) → VST¶ Return VectorStore initialized from texts and embeddings. async amax_marginal_relevance_search(query: str, k: int = 4, fetch_...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-5
Return type VectorStoreRetriever Examples: # Retrieve more documents with higher diversity # Useful if your dataset has many similar documents docsearch.as_retriever( search_type="mmr", search_kwargs={'k': 6, 'lambda_mult': 0.25} ) # Fetch more documents for the MMR algorithm to consider # But only return the t...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-6
Return docs and relevance scores in the range [0, 1], asynchronously. 0 is dissimilar, 1 is most similar. Parameters query – input text k – Number of Documents to return. Defaults to 4. **kwargs – kwargs to be passed to similarity search. Should include: score_threshold: Optional, a floating point value between 0 to 1 ...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-7
Embeds documents. Adds the documents to a provided Meilisearch index. This is intended to be a quick way to get started. Example from langchain_community.vectorstores import Meilisearch from langchain_community.embeddings import OpenAIEmbeddings import meilisearch # The environment should be the one specified next to t...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-8
Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. Parameters embedding – Embedding to look up documents similar to. k – Number of Documents to return. Defaults to 4. fetch_k – Number of Documents to fetch to pass to MMR algorithm. lambda_mult – Number between 0 and 1 t...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-9
Defaults to None. Returns List of Documents most similar to the queryvector and score for each. Return type List[Document] similarity_search_by_vector_with_scores(embedding: List[float], k: int = 4, filter: Optional[Dict[str, Any]] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶ Return meilisearch docume...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
c2abb3686047-10
Parameters query (str) – Query text for which to find similar documents. k (int) – Number of documents to return. Defaults to 4. filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None. Returns List of Documents most similar to the query text and score for each. Return type List[Document] Examples usin...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.meilisearch.Meilisearch.html
a40afea48839-0
langchain_community.vectorstores.qdrant.sync_call_fallback¶ langchain_community.vectorstores.qdrant.sync_call_fallback(method: Callable) → Callable[source]¶ Decorator to call the synchronous method of the class if the async method is not implemented. This decorator might be only used for the methods that are defined as...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.qdrant.sync_call_fallback.html
2e653be0f124-0
langchain_community.vectorstores.redis.filters.RedisText¶ class langchain_community.vectorstores.redis.filters.RedisText(field: str)[source]¶ A RedisFilterField representing a text field in a Redis index. Attributes OPERATORS OPERATOR_MAP SUPPORTED_VAL_TYPES escaper Methods __init__(field) equals(other) __init__(field:...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.filters.RedisText.html
b10985a84b18-0
langchain_community.vectorstores.neo4j_vector.sort_by_index_name¶ langchain_community.vectorstores.neo4j_vector.sort_by_index_name(lst: List[Dict[str, Any]], index_name: str) → List[Dict[str, Any]][source]¶ Sort first element to match the index_name if exists
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.neo4j_vector.sort_by_index_name.html
af3b043d2d7d-0
langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch¶ class langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch(opensearch_url: str, index_name: str, embedding_function: Embeddings, **kwargs: Any)[source]¶ Amazon OpenSearch Vector Engine vector store. Example fro...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-1
amax_marginal_relevance_search_by_vector(...) Return docs selected using the maximal marginal relevance. as_retriever(**kwargs) Return VectorStoreRetriever initialized from this VectorStore. asearch(query, search_type, **kwargs) Return docs most similar to query using specified search type. asimilarity_search(query[, k...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-2
similarity_search_with_score(query[, k]) Return docs and it's scores most similar to query. __init__(opensearch_url: str, index_name: str, embedding_function: Embeddings, **kwargs: Any)[source]¶ Initialize with necessary components. async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶ Run more do...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-3
Returns List of ids from adding the texts into the vectorstore. 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”. add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, i...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-4
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[Document]¶ Return docs selected using the maximal marginal relevance. async amax_marginal_relevance_search_by_vector(embedding: List[f...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-5
) # Fetch more documents for the MMR algorithm to consider # But only return the top 5 docsearch.as_retriever( search_type="mmr", search_kwargs={'k': 5, 'fetch_k': 50} ) # Only retrieve documents that have a relevance score # Above a certain threshold docsearch.as_retriever( search_type="similarity_score_th...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-6
**kwargs – kwargs to be passed to similarity search. Should include: score_threshold: Optional, a floating point value between 0 to 1 to filter the resulting set of retrieved docs Returns List of Tuples of (doc, similarity_score) async asimilarity_search_with_score(*args: Any, **kwargs: Any) → List[Tuple[Document, floa...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-7
) OpenSearch by default supports Approximate Search powered by nmslib, faiss and lucene engines recommended for large datasets. Also supports brute force search through Script Scoring and Painless Scripting. Optional Args:vector_field: Document field embeddings are stored in. Defaults to “vector_field”. text_field: Doc...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-8
texts, embeddings, opensearch_url="http://localhost:9200" ) OpenSearch by default supports Approximate Search powered by nmslib, faiss and lucene engines recommended for large datasets. Also supports brute force search through Script Scoring and Painless Scripting. Optional Args:vector_field: Document field emb...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-9
k – Number of Documents to return. Defaults to 4. fetch_k – Number of Documents to fetch to pass to MMR algorithm. Defaults to 20. 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...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-10
k – Number of Documents to return. Defaults to 4. Returns List of Documents most similar to the query. 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”. metadata_field: Document field tha...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
af3b043d2d7d-11
pre_filter: script_score query to pre-filter documents before identifying nearest neighbors; default: {“match_all”: {}} similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶ Return docs most similar to embedding vector. Parameters embedding – Embedding to look up documents sim...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html
02822b6db74a-0
langchain_community.vectorstores.annoy.Annoy¶ class langchain_community.vectorstores.annoy.Annoy(embedding_function: Callable, index: Any, metric: str, docstore: Docstore, index_to_docstore_id: Dict[int, str])[source]¶ Annoy vector store. To use, you should have the annoy python package installed. Example from langchai...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-1
Return VectorStoreRetriever initialized from this VectorStore. asearch(query, search_type, **kwargs) Return docs most similar to query using specified search type. asimilarity_search(query[, k]) Return docs most similar to query. asimilarity_search_by_vector(embedding[, k]) Return docs most similar to embedding vector....
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-2
similarity_search_by_index(docstore_index[, ...]) Return docs most similar to docstore_index. similarity_search_by_vector(embedding[, k, ...]) Return docs most similar to embedding vector. similarity_search_with_relevance_scores(query) Return docs and relevance scores in the range [0, 1]. similarity_search_with_score(q...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-3
Returns List of IDs of the added texts. Return type List[str] add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) → List[str][source]¶ Run more texts through the embeddings and add to the vectorstore. Parameters texts – Iterable of strings to add to the vectorstore. metadatas – Option...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-4
Return docs selected using the maximal marginal relevance. async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶ Return docs selected using the maximal marginal relevance. as_retriever(**kwargs: Any) → VectorStore...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-5
search_kwargs={'k': 5, 'fetch_k': 50} ) # Only retrieve documents that have a relevance score # Above a certain threshold docsearch.as_retriever( search_type="similarity_score_threshold", search_kwargs={'score_threshold': 0.8} ) # Only get the single most similar document from the dataset docsearch.as_retriever...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-6
Returns List of Tuples of (doc, similarity_score) async asimilarity_search_with_score(*args: Any, **kwargs: Any) → List[Tuple[Document, float]]¶ Run similarity search with distance asynchronously. delete(ids: Optional[List[str]] = None, **kwargs: Any) → Optional[bool]¶ Delete by vector ID or other criteria. Parameters ...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-7
embeddings = OpenAIEmbeddings() text_embeddings = embeddings.embed_documents(texts) text_embedding_pairs = list(zip(texts, text_embeddings)) db = Annoy.from_embeddings(text_embedding_pairs, embeddings) classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, metric: str = ...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-8
embeddings – Embeddings to use when generating queries. max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document][source]¶ Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND ...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-9
Turns annoy results into a list of documents and scores. Parameters idxs – List of indices of the documents in the index. dists – List of distances of the documents in the index. Returns List of Documents and scores. save_local(folder_path: str, prefault: bool = False) → None[source]¶ Save Annoy index, docstore, and in...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-10
Returns List of Documents most similar to the embedding. similarity_search_by_vector(embedding: List[float], k: int = 4, search_k: int = - 1, **kwargs: Any) → List[Document][source]¶ Return docs most similar to embedding vector. Parameters embedding – Embedding to look up documents similar to. k – Number of Documents t...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
02822b6db74a-11
Returns List of Documents most similar to the query and score for each similarity_search_with_score_by_index(docstore_index: int, k: int = 4, search_k: int = - 1) → List[Tuple[Document, float]][source]¶ Return docs most similar to query. Parameters query – Text to look up documents similar to. k – Number of Documents t...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.annoy.Annoy.html
f9b38d6e9222-0
langchain_community.vectorstores.redis.base.Redis¶ class langchain_community.vectorstores.redis.base.Redis(redis_url: str, index_name: str, embedding: Embeddings, index_schema: Optional[Union[Dict[str, str], str, PathLike]] = None, vector_schema: Optional[Dict[str, Union[str, int]]] = None, relevance_score_fn: Optional...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-1
Initialize, create index, and load Documentsfrom langchain_community.vectorstores import Redis from langchain_community.embeddings import OpenAIEmbeddings rds = Redis.from_documents( documents, # a list of Document objects from loaders or created embeddings, # an Embeddings object redis_url="redis://localho...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-2
) Advanced examples: Custom vector schema can be supplied to change the way that Redis creates the underlying vector schema. This is useful for production use cases where you want to optimize the vector schema for your use case. ex. using HNSW instead of FLAT (knn) which is the default vector_schema = { "algorithm"...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-3
rds = Redis.from_texts( texts, # a list of strings metadata, # a list of metadata dicts embeddings, # an Embeddings object index_schema="path/to/index_schema.yaml", # can also be a dictionary redis_url="redis://localhost:6379", ) When connecting to an existing index where a custom schema has been ap...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-4
Return docs selected using the maximal marginal relevance. as_retriever(**kwargs) Return VectorStoreRetriever initialized from this VectorStore. asearch(query, search_type, **kwargs) Return docs most similar to query using specified search type. asimilarity_search(query[, k]) Return docs most similar to query. asimilar...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-5
Run similarity search between a query vector and the indexed vectors. similarity_search_limit_score(query[, k, ...]) [Deprecated] Returns the most similar indexed documents to the query text within the score_threshold range. similarity_search_with_relevance_scores(query) Return docs and relevance scores in the range [...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-6
Returns List of IDs of the added texts. Return type List[str] add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, embeddings: Optional[List[List[float]]] = None, batch_size: int = 1000, clean_metadata: bool = True, **kwargs: Any) → List[str][source]¶ Add more texts to the vectorstore. Parameters tex...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-7
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[Document]¶ Return docs selected using the maximal marginal relevance. async amax_marginal_relevance_search_by_vector(embedding: List[f...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-8
) # Fetch more documents for the MMR algorithm to consider # But only return the top 5 docsearch.as_retriever( search_type="mmr", search_kwargs={'k': 5, 'fetch_k': 50} ) # Only retrieve documents that have a relevance score # Above a certain threshold docsearch.as_retriever( search_type="similarity_score_th...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-9
**kwargs – kwargs to be passed to similarity search. Should include: score_threshold: Optional, a floating point value between 0 to 1 to filter the resulting set of retrieved docs Returns List of Tuples of (doc, similarity_score) async asimilarity_search_with_score(*args: Any, **kwargs: Any) → List[Tuple[Document, floa...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-10
from langchain_community.embeddings import OpenAIEmbeddings embeddings = OpenAIEmbeddings() # must pass in schema and key_prefix from another index existing_rds = Redis.from_existing_index( embeddings, index_name="my-index", schema=rds.schema, # schema dumped from another index key_prefix=rds.key_prefix...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-11
Adds the documents to the newly created Redis index. This method will generate schema based on the metadata passed in if the index_schema is not defined. If the index_schema is defined, it will compare against the generated schema and warn if there are differences. If you are purposefully defining the schema for the me...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-12
Returns Redis VectorStore instance. Return type Redis Raises ValueError – If the number of metadatas does not match the number of texts. ImportError – If the redis python package is not installed. classmethod from_texts_return_keys(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, index_n...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-13
Parameters texts (List[str]) – List of texts to add to the vectorstore. embedding (Embeddings) – Embeddings to use for the vectorstore. metadatas (Optional[List[dict]], optional) – Optional list of metadata dicts to add to the vectorstore. Defaults to None. index_name (Optional[str], optional) – Optional name of the in...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-14
lambda_mult (float) – 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. filter (RedisFilterExpression, optional) – Optional metadata filter. Defaults to None. return_metadata (bool, optional) – Whether ...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-15
Return docs most similar to query using specified search type. similarity_search(query: str, k: int = 4, filter: Optional[RedisFilterExpression] = None, return_metadata: bool = True, distance_threshold: Optional[float] = None, **kwargs: Any) → List[Document][source]¶ Run similarity search Parameters query (str) – The q...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-16
Return type List[Document] similarity_search_limit_score(query: str, k: int = 4, score_threshold: float = 0.2, **kwargs: Any) → List[Document][source]¶ [Deprecated] Returns the most similar indexed documents to the query text within the score_threshold range. Deprecated: Use similarity_search with distance_threshold i...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
f9b38d6e9222-17
similarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶ Return docs and relevance scores in the range [0, 1]. 0 is dissimilar, 1 is most similar. Parameters query – input text k – Number of Documents to return. Defaults to 4. **kwargs – kwargs to be passed to simil...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.base.Redis.html
544e60d72574-0
langchain_community.vectorstores.vespa.VespaStore¶ class langchain_community.vectorstores.vespa.VespaStore(app: Any, embedding_function: Optional[Embeddings] = None, page_content_field: Optional[str] = None, embedding_field: Optional[str] = None, input_field: Optional[str] = None, metadata_fields: Optional[List[str]] =...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vespa.VespaStore.html
544e60d72574-1
Run more texts through the embeddings and add to the vectorstore. add_documents(documents, **kwargs) Run more documents through the embeddings and add to the vectorstore. add_texts(texts[, metadatas, ids]) Add texts to the vectorstore. adelete([ids]) Delete by vector ID or other criteria. afrom_documents(documents, emb...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vespa.VespaStore.html
544e60d72574-2
Return docs selected using the maximal marginal relevance. max_marginal_relevance_search_by_vector(...) Return docs selected using the maximal marginal relevance. search(query, search_type, **kwargs) Return docs most similar to query using specified search type. similarity_search(query[, k]) Return docs most similar to...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vespa.VespaStore.html
544e60d72574-3
Parameters (List[Document] (documents) – Documents to add to the vectorstore. Returns List of IDs of the added texts. Return type List[str] add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → List[str][source]¶ Add texts to the vectorstore. Parameter...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vespa.VespaStore.html
544e60d72574-4
Return docs selected using the maximal marginal relevance. async amax_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document]¶ Return docs selected using the maximal marginal relevance. as_retriever(**kwargs: Any) → VectorStore...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vespa.VespaStore.html
544e60d72574-5
search_kwargs={'k': 5, 'fetch_k': 50} ) # Only retrieve documents that have a relevance score # Above a certain threshold docsearch.as_retriever( search_type="similarity_score_threshold", search_kwargs={'score_threshold': 0.8} ) # Only get the single most similar document from the dataset docsearch.as_retriever...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vespa.VespaStore.html
544e60d72574-6
Returns List of Tuples of (doc, similarity_score) async asimilarity_search_with_score(*args: Any, **kwargs: Any) → List[Tuple[Document, float]]¶ Run similarity search with distance asynchronously. delete(ids: Optional[List[str]] = None, **kwargs: Any) → Optional[bool][source]¶ Delete by vector ID or other criteria. Par...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vespa.VespaStore.html
544e60d72574-7
Defaults to 0.5. Returns List of Documents selected by maximal marginal relevance. max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document][source]¶ Return docs selected using the maximal marginal relevance. Maximal marginal...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vespa.VespaStore.html
544e60d72574-8
Performs similarity search from a embeddings vector. Parameters query_embedding – Embeddings vector to search for. k – Number of results to return. custom_query – Use this custom query instead default query (kwargs) kwargs – other vector store specific parameters Returns List of ids from adding the texts into the vecto...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.vespa.VespaStore.html
5c3a5c757b6f-0
langchain_community.vectorstores.starrocks.has_mul_sub_str¶ langchain_community.vectorstores.starrocks.has_mul_sub_str(s: str, *args: Any) → bool[source]¶ Check if a string has multiple substrings. :param s: The string to check :param *args: The substrings to check for in the string Returns True if all substrings are p...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.starrocks.has_mul_sub_str.html
802f106f7aae-0
langchain_community.vectorstores.redis.filters.RedisFilterOperator¶ class langchain_community.vectorstores.redis.filters.RedisFilterOperator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶ RedisFilterOperator enumerator is used to create RedisFilterExpressions. EQ = 1¶ NE =...
https://api.python.langchain.com/en/latest/vectorstores/langchain_community.vectorstores.redis.filters.RedisFilterOperator.html