id stringlengths 14 15 | text stringlengths 44 2.47k | source stringlengths 61 181 |
|---|---|---|
8004b0899ce4-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.
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None.... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
8004b0899ce4-9 | Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any) → List[Document][source]¶
Run similarity search with Chroma.
Parameters
query (str) – Query text to search for.
k (int) – Number of results to return. Defaults... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
8004b0899ce4-10 | 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 cosine distance in float for each.
Lower score represents more similarity.
Return type
List[Tuple[Document, float]]
similarity_se... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
8004b0899ce4-11 | Update a document in the collection.
Parameters
document_id (str) – ID of the document to update.
document (Document) – Document to update.
update_documents(ids: List[str], documents: List[Document]) → None[source]¶
Update a document in the collection.
Parameters
ids (List[str]) – List of ids of the document to update.... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html |
6446da80a62a-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 Apache Cassandra(R) for vector-store workloads.
To use it, you need a recent installation of th... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.cassandra.Cassandra.html |
6446da80a62a-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.cassandra.Cassandra.html |
6446da80a62a-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 |
6446da80a62a-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 |
6446da80a62a-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 |
6446da80a62a-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 |
6446da80a62a-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 |
6446da80a62a-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, filter: Optional[Dict[str, str]] = None, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal ma... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.cassandra.Cassandra.html |
6446da80a62a-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.cassandra.Cassandra.html |
6446da80a62a-9 | Return docs most similar to embedding vector.
Parameters
embedding (str) – Embedding to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
Returns
List of (Document, score, id), the most similar to the query vector.
Examples using Cassandra¶
Cassandra | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.cassandra.Cassandra.html |
f28d539a1723-0 | langchain.vectorstores.deeplake.DeepLake¶
class langchain.vectorstores.deeplake.DeepLake(dataset_path: str = './deeplake/', token: Optional[str] = None, embedding: Optional[Embeddings] = None, embedding_function: Optional[Embeddings] = None, read_only: bool = False, ingestion_batch_size: int = 1000, num_workers: int = ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-1 | >>> data = DeepLake(
... path = "hub://org_id/dataset_name",
... runtime = {"tensor_db": True},
... )
Parameters
dataset_path (str) – Path to existing dataset or where to create
a new one. Defaults to _LANGCHAIN_DEFAULT_DEEPLAKE_PATH.
token (str, optional) – Activeloop token, for fetching credentials
to t... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-2 | or connected to Deep Lake. Not for in-memory or local datasets.
tensor_db - Hosted Managed Tensor Database that isresponsible for storage and query execution. Only for data stored in
the Deep Lake Managed Database. Use runtime = {“db_engine”: True}
during dataset creation.
runtime (Dict, optional) – Parameters for crea... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-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.vectorstores.deeplake.DeepLake.html |
f28d539a1723-4 | Run similarity search with Deep Lake with distance returned.
__init__(dataset_path: str = './deeplake/', token: Optional[str] = None, embedding: Optional[Embeddings] = None, embedding_function: Optional[Embeddings] = None, read_only: bool = False, ingestion_batch_size: int = 1000, num_workers: int = 0, verbose: bool = ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-5 | into batches. Batch size is the size of each batch.
Default is 1000.
num_workers (int) – Number of workers to use during data ingestion.
Default is 0.
verbose (bool) – Print dataset summary after each operation.
Default is True.
exec_option (str, optional) – DeepLakeVectorStore supports 3 ways to perform
searching - “p... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-6 | 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.deeplake.DeepLake.html |
f28d539a1723-7 | 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.deeplake.DeepLake.html |
f28d539a1723-8 | 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.deeplake.DeepLake.html |
f28d539a1723-9 | Return docs most similar to query.
delete(ids: Optional[List[str]] = None, **kwargs: Any) → bool[source]¶
Delete the entities in the dataset.
Parameters
ids (Optional[List[str]], optional) – The document_ids to delete.
Defaults to None.
**kwargs – Other keyword arguments that subclasses might use.
- filter (Optional[Di... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-10 | … exec_option = <preferred_exec_option>,
… )
Parameters
dataset_path (str) –
The full path to the dataset. Can be:
Deep Lake cloud path of the form hub://username/dataset_name.To write to Deep Lake cloud datasets,
ensure that you are logged in to Deep Lake
(use ‘activeloop login’ from command line)
AWS S3 path ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-11 | among selected documents.
Examples:
>>> # Search using an embedding
>>> data = vector_store.max_marginal_relevance_search(
… query = <query_to_search>,
… embedding_function = <embedding_function_for_query>,
… k = <number_of_items_to_return>,
… exec_option = <preferred_exec_option>,
… )
Param... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-12 | ValueError – when MRR search is on but embedding function is
not specified.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, exec_option: Optional[str] = None, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marg... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-13 | with in-memory or local datasets.
”tensor_db” - Performant, fully-hosted Managed Tensor Database.Responsible for storage and query execution. Only available for
data stored in the Deep Lake Managed Database. To store datasets
in this database, specify runtime = {“db_engine”: True}
during dataset creation.
**kwargs – Ad... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-14 | - Dict: Key-value search on tensors of htype json,
(sample must satisfy all key-value filters)
Dict = {“tensor_1”: {“key”: value}, “tensor_2”: {“key”: value}}
Function: Compatible with deeplake.filter.
Defaults to None.
exec_option (str): Supports 3 ways to perform searching.’python’, ‘compute_engine’, or ‘tensor_db’. ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-15 | Dict = {“tensor_name_1”: {“key”: value},
”tensor_name_2”: {“key”: value}}
Function - Any function compatible withdeeplake.filter.
Defaults to None.
exec_option (str): Options for search execution include”python”, “compute_engine”, or “tensor_db”. Defaults to
“python”.
- “python” - Pure-python implementation running on ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-16 | **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_with_score(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document,... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
f28d539a1723-17 | any data stored in or connected to Deep Lake. It cannot be used
with in-memory or local datasets.
”tensor_db” - Performant, fully-hosted Managed Tensor Database.Responsible for storage and query execution. Only available for
data stored in the Deep Lake Managed Database. To store datasets
in this database, specify runt... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.deeplake.DeepLake.html |
8356e5489a84-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 |
cf142b7caa71-0 | langchain.vectorstores.elastic_vector_search.ElasticVectorSearch¶
class langchain.vectorstores.elastic_vector_search.ElasticVectorSearch(elasticsearch_url: str, index_name: str, embedding: Embeddings, *, ssl_verify: Optional[Dict[str, Any]] = None)[source]¶
ElasticVectorSearch uses the brute force method of searching o... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticVectorSearch.html |
cf142b7caa71-1 | Log in to the Elastic Cloud console at https://cloud.elastic.co
Go to “Security” > “Users”
Locate the “elastic” user and click “Edit”
Click “Reset password”
Follow the prompts to reset the password
The format for Elastic Cloud URLs is
https://username:password@cluster_id.region_id.gcp.cloud.es.io:9243.
Example
from lan... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticVectorSearch.html |
cf142b7caa71-2 | Run more documents through the embeddings and add to the vectorstore.
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[, met... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticVectorSearch.html |
cf142b7caa71-3 | search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k, filter])
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 doc... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticVectorSearch.html |
cf142b7caa71-4 | Run more texts through the embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metadatas – Optional list of metadatas associated with the texts.
ids – Optional list of unique IDs.
refresh_indices – bool to refresh ElasticSearch indices
Returns
List of ids from adding... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticVectorSearch.html |
cf142b7caa71-5 | 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 (Default: 20)
lambda_mult: Diversity of results returned by MMR;
1 for minimum diversity and 0 for max... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticVectorSearch.html |
cf142b7caa71-6 | 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.elastic_vector_search.ElasticVectorSearch.html |
cf142b7caa71-7 | Example
from langchain.vectorstores import ElasticVectorSearch
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
elastic_vector_search = ElasticVectorSearch.from_texts(
texts,
embeddings,
elasticsearch_url="http://localhost:9200"
)
max_marginal_relevance_search(query: str, k:... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticVectorSearch.html |
cf142b7caa71-8 | 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]¶
Return docs most similar to query using specified search type.
sim... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticVectorSearch.html |
cf142b7caa71-9 | Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4, filter: Optional[dict] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Return docs most similar to query.
:param query: Text to look up documents similar to.
:param k: Number of Documents to return. Def... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elastic_vector_search.ElasticVectorSearch.html |
4f734679744d-0 | langchain.vectorstores.redis.filters.RedisFilterField¶
class langchain.vectorstores.redis.filters.RedisFilterField(field: str)[source]¶
Attributes
OPERATORS
escaper
Methods
__init__(field)
equals(other)
__init__(field: str)[source]¶
equals(other: RedisFilterField) → bool[source]¶ | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.filters.RedisFilterField.html |
7ce724826545-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 |
7fde3cf3a6e9-0 | langchain.vectorstores.bageldb.Bagel¶
class langchain.vectorstores.bageldb.Bagel(cluster_name: str = 'langchain', client_settings: Optional[bagel.config.Settings] = None, embedding_function: Optional[Embeddings] = None, cluster_metadata: Optional[Dict] = None, client: Optional[bagel.Client] = None, relevance_score_fn: ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.bageldb.Bagel.html |
7fde3cf3a6e9-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.bageldb.Bagel.html |
7fde3cf3a6e9-2 | similarity_search_with_score(query[, k, where])
Run a similarity search with BagelDB and return documents with their corresponding similarity scores.
update_document(document_id, document)
Update a document in the cluster.
__init__(cluster_name: str = 'langchain', client_settings: Optional[bagel.config.Settings] = None... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.bageldb.Bagel.html |
7fde3cf3a6e9-3 | metadata to the BagelDB cluster.
Parameters
texts (Iterable[str]) – Texts to be added.
embeddings (Optional[List[float]]) – List of embeddingvectors
metadatas (Optional[List[dict]]) – Optional list of metadatas.
ids (Optional[List[str]]) – List of unique ID for the texts.
Returns
List of unique ID representing the adde... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.bageldb.Bagel.html |
7fde3cf3a6e9-4 | 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 (Default: 20)
lambda_mult: Diversity... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.bageldb.Bagel.html |
7fde3cf3a6e9-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.bageldb.Bagel.html |
7fde3cf3a6e9-6 | cluster_metadata (Optional[Dict]) – Metadata associated with the
Bagel cluster. Defaults to None.
Returns
Bagel vectorstore.
Return type
Bagel
classmethod from_texts(texts: List[str], embedding: Optional[Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, cluster_name: str = 'la... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.bageldb.Bagel.html |
7fde3cf3a6e9-7 | Gets the collection.
max_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.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Paramet... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.bageldb.Bagel.html |
7fde3cf3a6e9-8 | Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 5, where: Optional[Dict[str, str]] = None, **kwargs: Any) → List[Document][source]¶
Run a similarity search with BagelDB.
Parameters
query (str) – The query text to search for similar documents/texts.
k (int) – The num... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.bageldb.Bagel.html |
7fde3cf3a6e9-9 | Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 5, where: Optional[Dict[str, str]] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Run a similarity search with BagelDB and return documents with their
corresponding similarity scores.
Parameters
query (st... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.bageldb.Bagel.html |
54fd13d560d4-0 | langchain.vectorstores.redis.base.RedisVectorStoreRetriever¶
class langchain.vectorstores.redis.base.RedisVectorStoreRetriever[source]¶
Bases: VectorStoreRetriever
Retriever for Redis VectorStore.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data ca... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.base.RedisVectorStoreRetriever.html |
54fd13d560d4-1 | Default implementation of abatch, which calls ainvoke N times.
Subclasses should override this method if they can batch more efficiently.
add_documents(documents: List[Document], **kwargs: Any) → List[str][source]¶
Add documents to vectorstore.
async aget_relevant_documents(query: str, *, callbacks: Callbacks = None, t... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.base.RedisVectorStoreRetriever.html |
54fd13d560d4-2 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.base.RedisVectorStoreRetriever.html |
54fd13d560d4-3 | Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.base.RedisVectorStoreRetriever.html |
54fd13d560d4-4 | namespace is [“langchain”, “llms”, “openai”]
get_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶
Retrieve documents relevant to a query.
:param query: string to fi... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.base.RedisVectorStoreRetriever.html |
54fd13d560d4-5 | classmethod lc_id() → List[str]¶
A unique identifier for this class for serialization purposes.
The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with e... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.base.RedisVectorStoreRetriever.html |
54fd13d560d4-6 | classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on fields based on this Model, globalns and localns.
classmethod validate(value: Any) → Model¶
with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶
Bind config to a Runnable, returning a new Runna... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.base.RedisVectorStoreRetriever.html |
3fd81c659800-0 | langchain.vectorstores.redis.filters.RedisNum¶
class langchain.vectorstores.redis.filters.RedisNum(field: str)[source]¶
A RedisFilterField representing a numeric field in a Redis index.
Attributes
OPERATORS
OPERATOR_MAP
escaper
Methods
__init__(field)
equals(other)
__init__(field: str)¶
equals(other: RedisFilterField) ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.filters.RedisNum.html |
6e6089a3afb0-0 | langchain.vectorstores.xata.XataVectorStore¶
class langchain.vectorstores.xata.XataVectorStore(api_key: str, db_url: str, embedding: Embeddings, table_name: str)[source]¶
Xata vector store.
It assumes you have a Xata database
created with the right schema. See the guide at:
https://integrations.langchain.com/vectorstor... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.xata.XataVectorStore.html |
6e6089a3afb0-1 | 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.
asimilarity_search_with_relevance_scores(query)
Return docs most similar to query.
delete([ids, dele... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.xata.XataVectorStore.html |
6e6089a3afb0-2 | 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]¶
Run... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.xata.XataVectorStore.html |
6e6089a3afb0-3 | 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.xata.XataVectorStore.html |
6e6089a3afb0-4 | )
# 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.xata.XataVectorStore.html |
6e6089a3afb0-5 | ids – List of ids to delete.
delete_all – Delete all records in the table.
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[... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.xata.XataVectorStore.html |
6e6089a3afb0-6 | 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.vectorstores.xata.XataVectorStore.html |
6e6089a3afb0-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.xata.XataVectorStore.html |
861e51ec4589-0 | langchain.vectorstores.azuresearch.AzureSearchVectorStoreRetriever¶
class langchain.vectorstores.azuresearch.AzureSearchVectorStoreRetriever[source]¶
Bases: BaseRetriever
Retriever that uses Azure Cognitive Search.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.azuresearch.AzureSearchVectorStoreRetriever.html |
861e51ec4589-1 | Subclasses should override this method if they can batch more efficiently.
async aget_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶
Asynchronously get documents ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.azuresearch.AzureSearchVectorStoreRetriever.html |
861e51ec4589-2 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.azuresearch.AzureSearchVectorStoreRetriever.html |
861e51ec4589-3 | Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.azuresearch.AzureSearchVectorStoreRetriever.html |
861e51ec4589-4 | namespace is [“langchain”, “llms”, “openai”]
get_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) → List[Document]¶
Retrieve documents relevant to a query.
:param query: string to fi... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.azuresearch.AzureSearchVectorStoreRetriever.html |
861e51ec4589-5 | classmethod lc_id() → List[str]¶
A unique identifier for this class for serialization purposes.
The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with e... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.azuresearch.AzureSearchVectorStoreRetriever.html |
861e51ec4589-6 | classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on fields based on this Model, globalns and localns.
classmethod validate(value: Any) → Model¶
with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶
Bind config to a Runnable, returning a new Runna... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.azuresearch.AzureSearchVectorStoreRetriever.html |
689d00d83914-0 | langchain.vectorstores.pgvector.PGVector¶
class langchain.vectorstores.pgvector.PGVector(connection_string: str, embedding_function: Embeddings, collection_name: str = 'langchain', collection_metadata: Optional[dict] = None, distance_strategy: DistanceStrategy = DistanceStrategy.COSINE, pre_delete_collection: bool = Fa... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-1 | Methods
__init__(connection_string, embedding_function)
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... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-2 | Delete vectors by ids or uuids.
delete_collection()
drop_tables()
from_documents(documents, embedding[, ...])
Return VectorStore initialized from documents and embeddings.
from_embeddings(text_embeddings, embedding)
Construct PGVector wrapper from raw documents and pre- generated embeddings.
from_existing_index(embeddi... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-3 | Return docs most similar to query.
similarity_search_with_score_by_vector(embedding)
__init__(connection_string: str, embedding_function: Embeddings, collection_name: str = 'langchain', collection_metadata: Optional[dict] = None, distance_strategy: DistanceStrategy = DistanceStrategy.COSINE, pre_delete_collection: bool... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-4 | kwargs – vectorstore specific parameters
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 embeddings and add to the vectorstore.
Parameters
texts – Iterable of strings to add to the vectorstore.
metada... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-5 | the Retriever should perform.
Can be “similarity” (default), “mmr”, or
“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... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-6 | 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 using specified search type.
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) → List[Document]¶
Return docs most similar to q... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-7 | Return VectorStore initialized from documents and embeddings.
Postgres connection string is required
“Either pass it as a parameter
or set the PGVECTOR_CONNECTION_STRING environment variable.
classmethod from_embeddings(text_embeddings: List[Tuple[str, List[float]]], embedding: Embeddings, metadatas: Optional[List[dict... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-8 | Return VectorStore initialized from texts and embeddings.
Postgres connection string is required
“Either pass it as a parameter
or set the PGVECTOR_CONNECTION_STRING environment variable.
get_collection(session: Session) → Optional['CollectionStore'][source]¶
classmethod get_connection_string(kwargs: Dict[str, Any]) → ... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-9 | Maximal marginal relevance optimizes for similarity to query AND diversityamong selected documents.
Parameters
embedding (str) – Text to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
fetch_k (int) – Number of Documents to fetch to pass to MMR algorithm.
Defaults to 20.
lambda_mul... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-10 | Returns
List of Documents selected by maximal marginalrelevance to the query and score for each.
Return type
List[Tuple[Document, float]]
max_marginal_relevance_search_with_score_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[Dict[str, str]] = None, **kwargs:... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-11 | Parameters
query (str) – Query text to search for.
k (int) – Number of results 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.
similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[dict] =... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
689d00d83914-12 | filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None.
Returns
List of Documents most similar to the query and score for each.
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, filter: Optional[dict] = None) → List[Tuple[Document, float]][source]¶
Examples using PGVector¶
PGV... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgvector.PGVector.html |
445b0f546413-0 | langchain.vectorstores.scann.dependable_scann_import¶
langchain.vectorstores.scann.dependable_scann_import() → Any[source]¶
Import scann if available, otherwise raise error. | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.scann.dependable_scann_import.html |
22422b7bea80-0 | langchain.vectorstores.neo4j_vector.Neo4jVector¶
class langchain.vectorstores.neo4j_vector.Neo4jVector(embedding: Embeddings, *, search_type: SearchType = SearchType.VECTOR, username: Optional[str] = None, password: Optional[str] = None, url: Optional[str] = None, keyword_index_name: Optional[str] = 'keyword', database... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.neo4j_vector.Neo4jVector.html |
22422b7bea80-1 | documents=docs,
url=url
username=username,
password=password,
)
Attributes
embeddings
Access the query embedding object if available.
Methods
__init__(embedding, *[, search_type, ...])
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.neo4j_vector.Neo4jVector.html |
22422b7bea80-2 | Return docs most similar to query.
create_new_index()
This method constructs a Cypher query and executes it to create a new vector index in Neo4j.
create_new_keyword_index([text_node_properties])
This method constructs a Cypher query and executes it to create a new full text index in Neo4j.
delete([ids])
Delete by vect... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.neo4j_vector.Neo4jVector.html |
22422b7bea80-3 | 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 docs most similar to query.
similarity_search_with_score_by_vector(embedding)
Per... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.neo4j_vector.Neo4jVector.html |
22422b7bea80-4 | 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.neo4j_vector.Neo4jVector.html |
22422b7bea80-5 | 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.neo4j_vector.Neo4jVector.html |
22422b7bea80-6 | )
# 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.neo4j_vector.Neo4jVector.html |
22422b7bea80-7 | This method constructs a Cypher query and executes it
to create a new full text index in Neo4j.
delete(ids: Optional[List[str]] = None, **kwargs: Any) → Optional[bool]¶
Delete by vector ID or other criteria.
Parameters
ids – List of ids to delete.
**kwargs – Other keyword arguments that subclasses might use.
Returns
Tr... | https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.neo4j_vector.Neo4jVector.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.