id stringlengths 14 15 | text stringlengths 49 2.47k | source stringlengths 61 166 |
|---|---|---|
68b354b073e2-8 | lucene_filter: the Lucene algorithm decides whether to perform an exact
k-NN search with pre-filtering or an approximate search with modified
post-filtering. (deprecated, use efficient_filter)
efficient_filter: the Lucene Engine or Faiss Engine decides whether to
perform an exact k-NN search with pre-filtering or an ap... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
68b354b073e2-9 | 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 to
filter the resulting set of retrieved docs
Returns
List of Tuples o... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.opensearch_vector_search.OpenSearchVectorSearch.html |
a0ca72ca7669-0 | langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch¶
class langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch(collection: Collection[MongoDBDocumentType], embedding: Embeddings, *, index_name: str = 'default', text_key: str = 'text', embedding_key: str = 'embedding')[source]¶
Wrapper around MongoDB... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch.html |
a0ca72ca7669-1 | add_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch.html |
a0ca72ca7669-2 | Return MongoDB documents most similar to query.
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(query, *[, k, ...])
Return MongoDB documents most si... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch.html |
a0ca72ca7669-3 | Returns
List of IDs of the added texts.
Return type
List[str]
add_texts(texts: Iterable[str], metadatas: Optional[List[Dict[str, Any]]] = None, **kwargs: Any) → List[source]¶
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – O... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch.html |
a0ca72ca7669-4 | “similarity_score_threshold”.
search_kwargs (Optional[Dict]) – Keyword arguments to pass to the
search function. Can include things like:
k: Amount of documents to return (Default: 4)
score_threshold: Minimum relevance threshold
for similarity_score_threshold
fetch_k: Amount of documents to pass to MMR algorithm (Defau... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch.html |
a0ca72ca7669-5 | Return docs most similar to query using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embeddin... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch.html |
a0ca72ca7669-6 | This is intended to be a quick way to get started.
Example
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, pre_filter: Optional[dict] = None, post_filter_pipeline: Optional[List[Dict]] = None, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maxi... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch.html |
a0ca72ca7669-7 | 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[Document]¶
Re... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch.html |
a0ca72ca7669-8 | 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.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch.html |
f844cc084dd5-0 | langchain.vectorstores.starrocks.has_mul_sub_str¶
langchain.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 present in the string... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.starrocks.has_mul_sub_str.html |
3e263ee53a25-0 | langchain.vectorstores.utils.DistanceStrategy¶
class langchain.vectorstores.utils.DistanceStrategy(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Enumerator of the Distance strategies for calculating distances
between vectors.
EUCLIDEAN_DISTANCE = 'EUCLIDEAN_DISTANCE'¶
MAX... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.utils.DistanceStrategy.html |
2d6add52d6ed-0 | langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearchSettings¶
class langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearchSettings(endpoint: str, instance_id: str, username: str, password: str, datasource_name: str, embedding_index_name: str, field_name_mapping: Dict[str, str])[source]¶
... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearchSettings.html |
2d6add52d6ed-1 | Methods
__init__(endpoint, instance_id, username, ...)
__init__(endpoint: str, instance_id: str, username: str, password: str, datasource_name: str, embedding_index_name: str, field_name_mapping: Dict[str, str]) → None[source]¶
Examples using AlibabaCloudOpenSearchSettings¶
Alibaba Cloud OpenSearch | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearchSettings.html |
de1f81c95712-0 | langchain.vectorstores.awadb.AwaDB¶
class langchain.vectorstores.awadb.AwaDB(table_name: str = 'langchain_awadb', embedding: Optional[Embeddings] = None, log_and_data_dir: Optional[str] = None, client: Optional[awadb.Client] = None, **kwargs: Any)[source]¶
Interface implemented by AwaDB vector stores.
Initialize with A... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
de1f81c95712-1 | amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
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_... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
de1f81c95712-2 | similarity_search(query[, k, ...])
Return docs most similar to query.
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(query[, k, ...])
The most... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
de1f81c95712-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.vectorstores.awadb.AwaDB.html |
de1f81c95712-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.vectorstores.awadb.AwaDB.html |
de1f81c95712-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.vectorstores.awadb.AwaDB.html |
de1f81c95712-6 | True if deletion is successful.
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod from_documents(documents: List[Document], embedding: Optional[Embeddings] = None, table_name: str = 'langchain_awadb', log_and_data_dir: Optional[str] = None, client: Optional[awadb.Client] = None, **kwargs:... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
de1f81c95712-7 | table_name (str) – Name of the table to create.
log_and_data_dir (Optional[str]) – Directory of logging and persistence.
client (Optional[awadb.Client]) – AwaDB client
Returns
AwaDB vectorstore.
Return type
AwaDB
get(ids: Optional[List[str]] = None, text_in_page_content: Optional[str] = None, meta_filter: Optional[dict... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
de1f81c95712-8 | Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text 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... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
de1f81c95712-9 | Returns
List of Documents selected by maximal marginal relevance.
search(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, text_in_page_content: Optional[str] = None, meta_filter: Optional[dict] = None,... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
de1f81c95712-10 | k – Number of Documents to return. Defaults to 4.
text_in_page_content – Filter by the text in page_content of Document.
meta_filter – Filter by metadata. Defaults to None.
not_incude_fields_in_metadata – Not include meta fields of each document.
Returns
List of Documents which are the most similar to the query vector.... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
de1f81c95712-11 | 0 is dissimilar, 1 is the most similar.
update(ids: List[str], texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) → List[str][source]¶
Update the documents which have the specified ids.
Parameters
ids – The id list of the updating embedding vector.
texts – The texts of the updating documents.
... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.awadb.AwaDB.html |
2e966e8663a5-0 | langchain.vectorstores.usearch.USearch¶
class langchain.vectorstores.usearch.USearch(embedding: Embeddings, index: Any, docstore: Docstore, ids: List[str])[source]¶
Wrapper around USearch vector database.
To use, you should have the usearch python package installed.
Initialize with necessary components.
Attributes
embe... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.usearch.USearch.html |
2e966e8663a5-1 | Return docs most similar to embedding vector.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete([ids])
Delete by vector ID or other criteria.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[,... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.usearch.USearch.html |
2e966e8663a5-2 | 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.vectorstores.usearch.USearch.html |
2e966e8663a5-3 | 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.vectorstores.usearch.USearch.html |
2e966e8663a5-4 | 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.vectorstores.usearch.USearch.html |
2e966e8663a5-5 | Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[Dict]] = None, ids: Optional[ndarray] = None, metric: str = 'cos', **kwargs: Any) → USearch[source]¶
Construct USearch wrapper from raw documents.
This is a user friendl... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.usearch.USearch.html |
2e966e8663a5-6 | Return docs selected using the maximal marginal relevance.
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 pa... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.usearch.USearch.html |
2e966e8663a5-7 | 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 to
filter the resulting set of retrieved docs
Returns
List of Tuples of (doc, similarity_score)
similarity_search_wit... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.usearch.USearch.html |
f670d4db206f-0 | langchain.vectorstores.cassandra.Cassandra¶
class langchain.vectorstores.cassandra.Cassandra(embedding: Embeddings, session: Session, keyspace: str, table_name: str, ttl_seconds: Optional[int] = None)[source]¶
Wrapper around Cassandra embeddings platform.
There is no notion of a default table name, since each embedding... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.cassandra.Cassandra.html |
f670d4db206f-1 | 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.vectorstores.cassandra.Cassandra.html |
f670d4db206f-2 | max_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. :param embedding: Embedding to look up documents similar to. :param k: Number of Documents to return. :param fetch_... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.cassandra.Cassandra.html |
f670d4db206f-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.vectorstores.cassandra.Cassandra.html |
f670d4db206f-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.vectorstores.cassandra.Cassandra.html |
f670d4db206f-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.vectorstores.cassandra.Cassandra.html |
f670d4db206f-6 | Parameters
ids – List of ids to delete.
Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
delete_by_document_id(document_id: str) → None[source]¶
delete_collection() → None[source]¶
Just an alias for clear
(to better align with other VectorStore implementations... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.cassandra.Cassandra.html |
f670d4db206f-7 | Optional.
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 releva... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.cassandra.Cassandra.html |
f670d4db206f-8 | 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 to
filter the resulting set of retrieved docs
Returns
List of Tuples o... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.cassandra.Cassandra.html |
75ce0ab48bb3-0 | langchain.vectorstores.starrocks.get_named_result¶
langchain.vectorstores.starrocks.get_named_result(connection: Any, query: str) → List[dict[str, Any]][source]¶
Get a named result from a query.
:param connection: The connection to the database
:param query: The query to execute
Returns
The result of the query
Return t... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.starrocks.get_named_result.html |
20d815e360ad-0 | langchain.vectorstores.matching_engine.MatchingEngine¶
class langchain.vectorstores.matching_engine.MatchingEngine(project_id: str, index: MatchingEngineIndex, endpoint: MatchingEngineIndexEndpoint, embedding: Embeddings, gcs_client: storage.Client, gcs_bucket_name: str, credentials: Optional[Credentials] = None)[sourc... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
20d815e360ad-1 | The GCS client.
gcs_bucket_name¶
The GCS bucket name.
credentials¶
Created GCP credentials.
Type
Optional
Attributes
embeddings
Access the query embedding object if available.
Methods
__init__(project_id, index, endpoint, ...[, ...])
Vertex Matching Engine implementation of the vector store.
aadd_documents(documents, *... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
20d815e360ad-2 | delete([ids])
Delete by vector ID or other criteria.
from_components(project_id, region, ...[, ...])
Takes the object creation out of the constructor.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas])
Use from component... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
20d815e360ad-3 | operation, updating the index takes close to one hour.
project_id¶
The GCS project id.
index¶
The created index class. See
~:func:MatchingEngine.from_components.
endpoint¶
The created endpoint class. See
~:func:MatchingEngine.from_components.
embedding¶
A Embeddings that will be used for
embedding the text sent. If non... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
20d815e360ad-4 | 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.
async classmethod afrom_documents(documents: List[Document], embedding: Embeddings... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
20d815e360ad-5 | score_threshold: Minimum relevance threshold
for similarity_score_threshold
fetch_k: Amount of documents to pass to MMR algorithm (Default: 20)
lambda_mult: Diversity of results returned by MMR;
1 for minimum diversity and 0 for maximum. (Default: 0.5)
filter: Filter by document metadata
Returns
Retriever class for Vec... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
20d815e360ad-6 | Return docs most similar to query.
async asimilarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to embedding vector.
async asimilarity_search_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]]¶
Return docs most ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
20d815e360ad-7 | Returns
A configured MatchingEngine with the texts added to the index.
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
20d815e360ad-8 | fetch_k – Number of Documents to fetch to pass to MMR algorithm.
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(... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
20d815e360ad-9 | Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(*args: Any, **kwargs: Any) → List[Tuple[Document, float]]¶
Run similarity search with distance.
Examples using MatchingEngine¶
MatchingEngine | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html |
ef3c5bc993af-0 | langchain.vectorstores.elastic_vector_search.ElasticKnnSearch¶
class langchain.vectorstores.elastic_vector_search.ElasticKnnSearch(index_name: str, embedding: Embeddings, es_connection: Optional['Elasticsearch'] = None, es_cloud_id: Optional[str] = None, es_user: Optional[str] = None, es_password: Optional[str] = None,... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-1 | >>> es_search = ElasticKnnSearch('my_index', embedding)
>>> es_search.add_texts(['Hello world!', 'Another text'])
>>> results = es_search.knn_search('Hello')
[(Document(page_content='Hello world!', metadata={}), 0.9)]
Attributes
embeddings
Access the query embedding object if available.
Methods
__init__(index_name, emb... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-2 | Return docs most similar to query.
create_knn_index(mapping)
Create a new k-NN index in Elasticsearch.
delete([ids])
Delete by vector ID or other criteria.
from_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
from_texts(texts, embedding[, metadatas])
Create a new ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-3 | async aadd_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 texts.
Return type
List[str]
async aadd_texts(texts: Iterable[s... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-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.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-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.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-6 | Return docs most similar to query.
create_knn_index(mapping: Dict) → None[source]¶
Create a new k-NN index in Elasticsearch.
Parameters
mapping (Dict) – The mapping to use for the new index.
Returns
None
delete(ids: Optional[List[str]] = None, **kwargs: Any) → Optional[bool]¶
Delete by vector ID or other criteria.
Para... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-7 | **kwargs – Arbitrary keyword arguments.
Returns
A new ElasticKnnSearch instance.
knn_hybrid_search(query: Optional[str] = None, k: Optional[int] = 10, query_vector: Optional[List[float]] = None, model_id: Optional[str] = None, size: Optional[int] = 10, source: Optional[bool] = True, knn_boost: Optional[float] = 0.9, qu... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-8 | Returns
A list of tuples, where each tuple contains a Document object and a score.
knn_search(query: Optional[str] = None, k: Optional[int] = 10, query_vector: Optional[List[float]] = None, model_id: Optional[str] = None, size: Optional[int] = 10, source: Optional[bool] = True, fields: Optional[Union[List[Mapping[str, ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-9 | among selected documents.
Parameters
query – Text 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 that determines the degree
of diversity among the results with 0 corresponding
to max... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
ef3c5bc993af-10 | 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_with_relevance_scores(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Docume... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticKnnSearch.html |
4409720bb623-0 | langchain.vectorstores.usearch.dependable_usearch_import¶
langchain.vectorstores.usearch.dependable_usearch_import() → Any[source]¶
Import usearch if available, otherwise raise error. | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.usearch.dependable_usearch_import.html |
cf9dee3fb9db-0 | langchain.vectorstores.qdrant.QdrantException¶
class langchain.vectorstores.qdrant.QdrantException[source]¶
Base class for all the Qdrant related exceptions | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.qdrant.QdrantException.html |
56fadbda8d16-0 | langchain.vectorstores.alibabacloud_opensearch.create_metadata¶
langchain.vectorstores.alibabacloud_opensearch.create_metadata(fields: Dict[str, Any]) → Dict[str, Any][source]¶
Create metadata from fields.
Parameters
fields – The fields of the document. The fields must be a dict.
Returns
The metadata of the document. T... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.alibabacloud_opensearch.create_metadata.html |
7672cc63796e-0 | langchain.vectorstores.pgembedding.PGEmbedding¶
class langchain.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] = None)[source]¶
Vect... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.PGEmbedding.html |
7672cc63796e-1 | add_texts(texts[, metadatas, ids])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_mar... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.PGEmbedding.html |
7672cc63796e-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, filter])
Return docs most si... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.PGEmbedding.html |
7672cc63796e-3 | Returns
List of IDs of the added texts.
Return type
List[str]
add_embeddings(texts: List[str], embeddings: List[List[float]], metadatas: List[dict], ids: List[str], **kwargs: Any) → None[source]¶
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → Li... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.PGEmbedding.html |
7672cc63796e-4 | as_retriever(**kwargs: Any) → VectorStoreRetriever¶
Return VectorStoreRetriever initialized from this VectorStore.
Parameters
search_type (Optional[str]) – Defines the type of search that
the Retriever should perform.
Can be “similarity” (default), “mmr”, or
“similarity_score_threshold”.
search_kwargs (Optional[Dict]) ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.PGEmbedding.html |
7672cc63796e-5 | docsearch.as_retriever(search_kwargs={'k': 1})
# Use a filter to only retrieve documents from a specific paper
docsearch.as_retriever(
search_kwargs={'filter': {'paper_title':'GPT-4 Technical Report'}}
)
async asearch(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query u... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.PGEmbedding.html |
7672cc63796e-6 | Return type
Optional[bool]
delete_collection() → None[source]¶
drop_tables() → None[source]¶
classmethod from_documents(documents: List[Document], embedding: Embeddings, collection_name: str = 'langchain', ids: Optional[List[str]] = None, pre_delete_collection: bool = False, **kwargs: Any) → PGEmbedding[source]¶
Return... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.PGEmbedding.html |
7672cc63796e-7 | among selected documents.
Parameters
query – Text 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 that determines the degree
of diversity among the results with 0 corresponding
to max... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.PGEmbedding.html |
7672cc63796e-8 | Return docs most similar to query.
similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[dict] = None, **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 to return. De... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.PGEmbedding.html |
2be29a71300b-0 | langchain.vectorstores.utils.maximal_marginal_relevance¶
langchain.vectorstores.utils.maximal_marginal_relevance(query_embedding: ndarray, embedding_list: list, lambda_mult: float = 0.5, k: int = 4) → List[int][source]¶
Calculate maximal marginal relevance. | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.utils.maximal_marginal_relevance.html |
da81a8eccfc9-0 | langchain.vectorstores.vectara.VectaraRetriever¶
class langchain.vectorstores.vectara.VectaraRetriever[source]¶
Bases: VectorStoreRetriever
Retriever class for Vectara.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a val... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.vectara.VectaraRetriever.html |
da81a8eccfc9-1 | param vectorstore: Vectara [Required]¶
Vectara vectorstore.
async aadd_documents(documents: List[Document], **kwargs: Any) → List[str]¶
Add documents to vectorstore.
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, max_concurrency: Optional[int] = None) → List[O... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.vectara.VectaraRetriever.html |
da81a8eccfc9-2 | async astream(input: Input, config: Optional[RunnableConfig] = None) → AsyncIterator[Output]¶
batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, max_concurrency: Optional[int] = None) → List[Output]¶
bind(**kwargs: Any) → Runnable[Input, Output]¶
Bind arguments to a Runn... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.vectara.VectaraRetriever.html |
da81a8eccfc9-3 | 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.vectorstores.vectara.VectaraRetriever.html |
da81a8eccfc9-4 | 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_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Cal... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.vectara.VectaraRetriever.html |
da81a8eccfc9-5 | classmethod validate(value: Any) → Model¶
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.Runnable[~langchain.schema.runnable.Input, ~langchain.schema.runnable.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException]] = (<class 'Exception'>,)) → RunnableWithFallbacks[Input, Out... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.vectara.VectaraRetriever.html |
6d8dedc67eb5-0 | langchain.vectorstores.clickhouse.has_mul_sub_str¶
langchain.vectorstores.clickhouse.has_mul_sub_str(s: str, *args: Any) → bool[source]¶
Check if a string contains multiple substrings.
:param s: string to check.
:param *args: substrings to check.
Returns
True if all substrings are in the string, False otherwise. | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.clickhouse.has_mul_sub_str.html |
b9ed41e941d4-0 | langchain.vectorstores.faiss.FAISS¶
class langchain.vectorstores.faiss.FAISS(embedding_function: Callable, index: Any, docstore: Docstore, index_to_docstore_id: Dict[int, str], relevance_score_fn: Optional[Callable[[float], float]] = None, normalize_L2: bool = False, distance_strategy: DistanceStrategy = DistanceStrate... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
b9ed41e941d4-1 | Return docs selected using the maximal marginal relevance.
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 quer... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
b9ed41e941d4-2 | search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
serialize_to_bytes()
Serialize FAISS index, docstore, and index_to_docstore_id to bytes.
similarity_search(query[, k, filter, fetch_k])
Return docs most similar to query.
similarity_search_by_vector(embedding[, k, ...])
... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
b9ed41e941d4-3 | 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]
add_embeddings(text_embeddings: Iterable[Tuple[str, List[float]]], metadatas: Optional[List[dict]] = None, ids... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
b9ed41e941d4-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.vectorstores.faiss.FAISS.html |
b9ed41e941d4-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.vectorstores.faiss.FAISS.html |
b9ed41e941d4-6 | Returns
True if deletion is successful,
False otherwise, None if not implemented.
Return type
Optional[bool]
classmethod deserialize_from_bytes(serialized: bytes, embeddings: Embeddings, **kwargs: Any) → FAISS[source]¶
Deserialize FAISS index, docstore, and index_to_docstore_id from bytes.
classmethod from_documents(do... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
b9ed41e941d4-7 | from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
faiss = FAISS.from_texts(texts, embeddings)
classmethod load_local(folder_path: str, embeddings: Embeddings, index_name: str = 'index', **kwargs: Any) → FAISS[source]¶
Load FAISS index, docstore, and index_to_docstore_id from disk.
Parame... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
b9ed41e941d4-8 | Return docs selected using the maximal marginal relevance.
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 befor... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
b9ed41e941d4-9 | target – FAISS object you wish to merge into the current one
Returns
None.
save_local(folder_path: str, index_name: str = 'index') → None[source]¶
Save FAISS index, docstore, and index_to_docstore_id to disk.
Parameters
folder_path – folder path to save index, docstore,
and index_to_docstore_id to.
index_name – for sav... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
b9ed41e941d4-10 | k – Number of Documents to return. Defaults to 4.
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None.
fetch_k – (Optional[int]) Number of Documents to fetch before filtering.
Defaults to 20.
Returns
List of Documents most similar to the embedding.
similarity_search_with_relevance_scores(query: str... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
b9ed41e941d4-11 | L2 distance in float. Lower score represents more similarity.
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, filter: Optional[Dict[str, Any]] = None, fetch_k: int = 20, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Return docs most similar to query.
Parameters
embedding – Embedding ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html |
fa0e262c586c-0 | langchain.vectorstores.clickhouse.ClickhouseSettings¶
class langchain.vectorstores.clickhouse.ClickhouseSettings[source]¶
Bases: BaseSettings
ClickHouse Client Configuration
Attribute:
clickhouse_host (str)An URL to connect to MyScale backend.Defaults to ‘localhost’.
clickhouse_port (int) : URL port to connect with HTT... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.clickhouse.ClickhouseSettings.html |
fa0e262c586c-1 | Raises ValidationError if the input data cannot be parsed to form a valid model.
param column_map: Dict[str, str] = {'document': 'document', 'embedding': 'embedding', 'id': 'id', 'metadata': 'metadata', 'uuid': 'uuid'}¶
param database: str = 'default'¶
param host: str = 'localhost'¶
param index_param: Optional[Union[Li... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.clickhouse.ClickhouseSettings.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.