id stringlengths 14 16 | text stringlengths 4 1.28k | source stringlengths 54 121 |
|---|---|---|
4a1bad429950-89 | **kwargs – Additional keyword arguments.
kwargs (Any) –
Returns
List[Documents] - A list of documents.
Return type
List[langchain.schema.Document]
max_marginal_relevance_search(query, k=4, fetch_k=20, lambda_mult=0.5, exec_option=None, **kwargs)[source]
Return docs selected using maximal marginal relevance.
Maximal m... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-90 | k (int) – Number of Documents to return. Defaults to 4.
fetch_k (int) – Number of Documents for MMR algorithm.
lambda_mult (float) – Value between 0 and 1. 0 corresponds
to maximum diversity and 1 to minimum.
Defaults to 0.5.
exec_option (str) – Supports 3 ways to perform searching.
- “python” - Pure-python implementat... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-91 | for data stored in the Deep Lake Managed Database. To store
datasets in this database, specify
runtime = {“db_engine”: True} during dataset creation.
**kwargs – Additional keyword arguments
kwargs (Any) –
Returns
List of Documents selected by maximal marginal relevance.
Raises
ValueError – when MRR search is on but em... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-92 | … embedding_function = <embedding_function_for_query>,
… k = <number_of_items_to_return>,
… 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 data... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-93 | In-memory path of the form mem://path/to/dataset which doesn’tsave the dataset, but keeps it in memory instead.
Should be used only for testing as it does not persist.
texts (List[Document]) – List of documents to add.
embedding (Optional[Embeddings]) – Embedding function. Defaults to None.
Note, in other places, it is... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-94 | Delete the entities in the dataset.
Parameters
ids (Optional[List[str]], optional) – The document_ids to delete.
Defaults to None.
filter (Optional[Dict[str, str]], optional) – The filter to delete by.
Defaults to None.
delete_all (Optional[bool], optional) – Whether to drop the dataset.
Defaults to None.
Returns
Wheth... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-95 | Wrapper around HnswLib storage.
To use it, you should have the docarray package with version >=0.32.0 installed.
You can install it with pip install “langchain[docarray]”.
Parameters
doc_index (BaseDocIndex) –
embedding (langchain.embeddings.base.Embeddings) –
classmethod from_params(embedding, work_dir, n_dim, dist_... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-96 | dist_metric (str) – Distance metric for DocArrayHnswSearch can be one of:
“cosine”, “ip”, and “l2”. Defaults to “cosine”.
max_elements (int) – Maximum number of vectors that can be stored.
Defaults to 1024.
index (bool) – Whether an index should be built for this field.
Defaults to True.
ef_construction (int) – defines... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-97 | **kwargs – Other keyword arguments to be passed to the get_doc_cls method.
kwargs (Any) –
Return type
langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch
classmethod from_texts(texts, embedding, metadatas=None, work_dir=None, n_dim=None, **kwargs)[source]
Create an DocArrayHnswSearch store and insert data.
Parame... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-98 | DocArrayHnswSearch Vector Store
Return type
langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch
class langchain.vectorstores.DocArrayInMemorySearch(doc_index, embedding)[source]
Bases: langchain.vectorstores.docarray.base.DocArrayIndex
Wrapper around in-memory storage for exact search.
To use it, you should have t... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-99 | Can be one of: “cosine_sim”, “euclidean_dist” and “sqeuclidean_dist”.
Defaults to “cosine_sim”.
**kwargs – Other keyword arguments to be passed to the get_doc_cls method.
kwargs (Any) –
Return type
langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch
classmethod from_texts(texts, embedding, metadatas=None,... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-100 | Defaults to “cosine_sim”.
kwargs (Any) –
Returns
DocArrayInMemorySearch Vector Store
Return type
langchain.vectorstores.docarray.in_memory.DocArrayInMemorySearch
class langchain.vectorstores.ElasticVectorSearch(elasticsearch_url, index_name, embedding, *, ssl_verify=None)[source]
Bases: langchain.vectorstores.base.Ve... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-101 | embedding=embedding
)
To connect to an Elasticsearch instance that requires login credentials,
including Elastic Cloud, use the Elasticsearch URL format
https://username:password@es_host:9243. For example, to connect to Elastic
Cloud, create the Elasticsearch URL with the required authentication details and
pass it to ... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-102 | 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 langchain import ElasticVectorSearch
from langchain.embeddings import OpenAIEmbeddings
embedding = OpenAIEmbeddings()
elastic_host = "cluster_id.region_id.gcp.c... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-103 | abstract base class, such as OpenAIEmbeddings()
ssl_verify (Optional[Dict[str, Any]]) –
Raises
ValueError – If the elasticsearch python package is not installed.
add_texts(texts, metadatas=None, refresh_indices=True, ids=None, **kwargs)[source]
Run more texts through the embeddings and add to the vectorstore.
Paramet... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-104 | Return docs most similar to query.
Parameters
query (str) – Text to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
filter (Optional[dict]) –
kwargs (Any) –
Returns
List of Documents most similar to the query.
Return type
List[langchain.schema.Document]
similarity_search_with_sco... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-105 | classmethod from_texts(texts, embedding, metadatas=None, elasticsearch_url=None, index_name=None, refresh_indices=True, **kwargs)[source]
Construct ElasticVectorSearch wrapper from raw documents.
This is a user-friendly interface that:
Embeds documents.
Creates a new index for the embeddings in the Elasticsearch insta... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-106 | elasticsearch_url (Optional[str]) –
index_name (Optional[str]) –
refresh_indices (bool) –
kwargs (Any) –
Return type
langchain.vectorstores.elastic_vector_search.ElasticVectorSearch
create_index(client, index_name, mapping)[source]
Parameters
client (Any) –
index_name (str) –
mapping (Dict) –
Return type
None
c... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-107 | Return type
None
class langchain.vectorstores.FAISS(embedding_function, index, docstore, index_to_docstore_id, relevance_score_fn=<function _default_relevance_score_fn>, normalize_L2=False)[source]
Bases: langchain.vectorstores.base.VectorStore
Wrapper around FAISS vector database.
To use, you should have the faiss py... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-108 | Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) – Iterable of strings to add to the vectorstore.
metadatas (Optional[List[dict]]) – Optional list of metadatas associated with the texts.
ids (Optional[List[str]]) – Optional list of unique IDs.
kwargs (Any) –
Returns
Li... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-109 | kwargs (Any) –
Returns
List of ids from adding the texts into the vectorstore.
Return type
List[str]
similarity_search_with_score_by_vector(embedding, k=4, filter=None, fetch_k=20, **kwargs)[source]
Return docs most similar to query.
Parameters
embedding (List[float]) – Embedding vector to look up documents similar t... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-110 | kwargs (Any) –
Returns
List of documents most similar to the query text and L2 distance
in float for each. Lower score represents more similarity.
Return type
List[Tuple[langchain.schema.Document, float]]
similarity_search_with_score(query, k=4, filter=None, fetch_k=20, **kwargs)[source]
Return docs most similar to q... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-111 | Return type
List[Tuple[langchain.schema.Document, float]]
similarity_search_by_vector(embedding, k=4, filter=None, fetch_k=20, **kwargs)[source]
Return docs most similar to embedding vector.
Parameters
embedding (List[float]) – Embedding to look up documents similar to.
k (int) – Number of Documents to return. Default... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-112 | Return docs most similar to query.
Parameters
query (str) – Text to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
filter (Optional[Dict[str, Any]]) – (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
fetch_k (int) – (Optional[int]) Number of Documents to fetch bef... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-113 | among selected documents.
Parameters
embedding (List[float]) – Embedding to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
fetch_k (int) – Number of Documents to fetch before filtering to
pass to MMR algorithm.
lambda_mult (float) – Number between 0 and 1 that determines the degre... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-114 | Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query (str) – Text to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
fetch_k (int) – Number of Documents to fe... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-115 | Add the target FAISS to the current one.
Parameters
target (langchain.vectorstores.faiss.FAISS) – FAISS object you wish to merge into the current one
Returns
None.
Return type
None
classmethod from_texts(texts, embedding, metadatas=None, ids=None, **kwargs)[source]
Construct FAISS wrapper from raw documents.
This is a... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-116 | ids (Optional[List[str]]) –
kwargs (Any) –
Return type
langchain.vectorstores.faiss.FAISS
classmethod from_embeddings(text_embeddings, embedding, metadatas=None, ids=None, **kwargs)[source]
Construct FAISS wrapper from raw documents.
This is a user friendly interface that:
Embeds documents.
Creates an in memory docs... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-117 | metadatas (Optional[List[dict]]) –
ids (Optional[List[str]]) –
kwargs (Any) –
Return type
langchain.vectorstores.faiss.FAISS
save_local(folder_path, index_name='index')[source]
Save FAISS index, docstore, and index_to_docstore_id to disk.
Parameters
folder_path (str) – folder path to save index, docstore,
and index... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-118 | and index_to_docstore_id from.
embeddings (langchain.embeddings.base.Embeddings) – Embeddings to use when generating queries
index_name (str) – for saving with a specific index file name
Return type
langchain.vectorstores.faiss.FAISS
class langchain.vectorstores.Hologres(connection_string, embedding_function, ndims=153... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-119 | So, make sure the user has the right permissions to create tables.
pre_delete_table if True, will delete the table if it exists.(default: False)
- Useful for testing.
Parameters
connection_string (str) –
embedding_function (Embeddings) –
ndims (int) –
table_name (str) –
pre_delete_table (bool) –
logger (Optional[l... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-120 | metadatas (List[dict]) – List of metadatas associated with the texts.
kwargs (Any) – vectorstore specific parameters
ids (List[str]) –
Return type
None
add_texts(texts, metadatas=None, ids=None, **kwargs)[source]
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) – Iter... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-121 | 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.
kwargs (Any) –
Returns
List of Documents most similar to the query.
Return type
List[langchain.schema.Document]
similarity_search_by_vector(... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-122 | List[langchain.schema.Document]
similarity_search_with_score(query, k=4, filter=None)[source]
Return docs most similar to query.
Parameters
query (str) – Text to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to Non... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-123 | classmethod from_texts(texts, embedding, metadatas=None, ndims=1536, table_name='langchain_pg_embedding', ids=None, pre_delete_table=False, **kwargs)[source]
Return VectorStore initialized from texts and embeddings.
Postgres connection string is required
“Either pass it as a parameter
or set the HOLOGRES_CONNECTION_ST... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-124 | classmethod from_embeddings(text_embeddings, embedding, metadatas=None, ndims=1536, table_name='langchain_pg_embedding', ids=None, pre_delete_table=False, **kwargs)[source]
Construct Hologres wrapper from raw documents and pre-
generated embeddings.
Return VectorStore initialized from documents and embeddings.
Postgre... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-125 | metadatas (Optional[List[dict]]) –
ndims (int) –
table_name (str) –
ids (Optional[List[str]]) –
pre_delete_table (bool) –
kwargs (Any) –
Return type
langchain.vectorstores.hologres.Hologres
classmethod from_existing_index(embedding, ndims=1536, table_name='langchain_pg_embedding', pre_delete_table=False, **kwargs... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-126 | classmethod get_connection_string(kwargs)[source]
Parameters
kwargs (Dict[str, Any]) –
Return type
str
classmethod from_documents(documents, embedding, ndims=1536, table_name='langchain_pg_embedding', ids=None, pre_delete_collection=False, **kwargs)[source]
Return VectorStore initialized from documents and embedding... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-127 | classmethod connection_string_from_db_params(host, port, database, user, password)[source]
Return connection string from database parameters.
Parameters
host (str) –
port (int) –
database (str) –
user (str) –
password (str) –
Return type
str
class langchain.vectorstores.LanceDB(connection, embedding, vector_key='... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-128 | Parameters
connection (Any) –
embedding (Embeddings) –
vector_key (Optional[str]) –
id_key (Optional[str]) –
text_key (Optional[str]) –
add_texts(texts, metadatas=None, ids=None, **kwargs)[source]
Turn texts into embedding and add it to the database
Parameters
texts (Iterable[str]) – Iterable of strings to add to... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-129 | Return documents most similar to the query
Parameters
query (str) – String to query the vectorstore with.
k (int) – Number of documents to return.
kwargs (Any) –
Returns
List of documents most similar to the query.
Return type
List[langchain.schema.Document]
classmethod from_texts(texts, embedding, metadatas=None, con... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-130 | kwargs (Any) –
Return type
langchain.vectorstores.lancedb.LanceDB
class langchain.vectorstores.MatchingEngine(project_id, index, endpoint, embedding, gcs_client, gcs_bucket_name, credentials=None)[source]
Bases: langchain.vectorstores.base.VectorStore
Vertex Matching Engine implementation of the vector store.
While t... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-131 | index (MatchingEngineIndex) –
endpoint (MatchingEngineIndexEndpoint) –
embedding (Embeddings) –
gcs_client (storage.Client) –
gcs_bucket_name (str) –
credentials (Optional[Credentials]) –
add_texts(texts, metadatas=None, **kwargs)[source]
Run more texts through the embeddings and add to the vectorstore.
Paramete... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-132 | Return docs most similar to query.
Parameters
query (str) – The string that will be used to search for similar documents.
k (int) – The amount of neighbors that will be retrieved.
kwargs (Any) –
Returns
A list of k matching documents.
Return type
List[langchain.schema.Document]
classmethod from_texts(texts, embedding,... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-133 | Parameters
project_id (str) – The GCP project id.
region (str) – The default location making the API calls. It must have
regional. (the same location as the GCS bucket and must be) –
gcs_bucket_name (str) – The location where the vectors will be stored in
created. (order for the index to be) –
index_id (str) – The id... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-134 | class langchain.vectorstores.Milvus(embedding_function, collection_name='LangChainCollection', connection_args=None, consistency_level='Session', index_params=None, search_params=None, drop_old=False)[source]
Bases: langchain.vectorstores.base.VectorStore
Wrapper around the Milvus vector database.
Parameters
embedding... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-135 | in creating a new Collection. The data of the first entity decides
the schema of the new collection, the dim is extracted from the first
embedding and the columns are decided by the first metadata dict.
Metada keys will need to be present for all inserted values. At
the moment there is no None equivalent in Milvus.
Par... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-136 | Return type
List[str]
similarity_search(query, k=4, param=None, expr=None, timeout=None, **kwargs)[source]
Perform a similarity search against the query string.
Parameters
query (str) – The text to search.
k (int, optional) – How many results to return. Defaults to 4.
param (dict, optional) – The search params for the... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-137 | Perform a similarity search against the query string.
Parameters
embedding (List[float]) – The embedding vector to search.
k (int, optional) – How many results to return. Defaults to 4.
param (dict, optional) – The search params for the index type.
Defaults to None.
expr (str, optional) – Filtering expression. Defaults... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-138 | documentation found here:
https://milvus.io/api-reference/pymilvus/v2.2.6/Collection/search().md
Parameters
query (str) – The text being searched.
k (int, optional) – The amount of results ot return. Defaults to 4.
param (dict) – The search params for the specified index.
Defaults to None.
expr (str, optional) – Filter... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-139 | For more information about the search parameters, take a look at the pymilvus
documentation found here:
https://milvus.io/api-reference/pymilvus/v2.2.6/Collection/search().md
Parameters
embedding (List[float]) – The embedding vector being searched.
k (int, optional) – The amount of results ot return. Defaults to 4.
par... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-140 | List[Tuple[Document, float]]
max_marginal_relevance_search(query, k=4, fetch_k=20, lambda_mult=0.5, param=None, expr=None, timeout=None, **kwargs)[source]
Perform a search and return results that are reordered by MMR.
Parameters
query (str) – The text being searched.
k (int, optional) – How many results to give. Defau... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-141 | 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 (Any) – Collection.search() keyword arguments.
Returns
Document results for search.
Return type
List[Document]
max_marginal_relevance_search_by_vecto... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-142 | Defaults to 20.
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
param (dict, optional) – The search params for the specified index.
Defaults to None.
expr (str, optional) – Filter... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-143 | Return type
List[Document]
classmethod from_texts(texts, embedding, metadatas=None, collection_name='LangChainCollection', connection_args={'host': 'localhost', 'password': '', 'port': '19530', 'secure': False, 'user': ''}, consistency_level='Session', index_params=None, search_params=None, drop_old=False, **kwargs)[so... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-144 | to DEFAULT_MILVUS_CONNECTION.
consistency_level (str, optional) – Which consistency level to use. Defaults
to “Session”.
index_params (Optional[dict], optional) – Which index_params to use. Defaults
to None.
search_params (Optional[dict], optional) – Which search params to use.
Defaults to None.
drop_old (Optional[bool... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-145 | embedding_function (Embeddings) –
collection_name (str) –
connection_args (Optional[dict[str, Any]]) –
consistency_level (str) –
index_params (Optional[dict]) –
search_params (Optional[dict]) –
drop_old (Optional[bool]) –
classmethod from_texts(texts, embedding, metadatas=None, collection_name='LangChainCollecti... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-146 | “LangChainCollection”.
connection_args (dict[str, Any], optional) – Connection args to use. Defaults
to DEFAULT_MILVUS_CONNECTION.
consistency_level (str, optional) – Which consistency level to use. Defaults
to “Session”.
index_params (Optional[dict], optional) – Which index_params to use.
Defaults to None.
search_para... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-147 | Return type
Zilliz
class langchain.vectorstores.SingleStoreDB(embedding, *, distance_strategy=DistanceStrategy.DOT_PRODUCT, table_name='embeddings', content_field='content', metadata_field='metadata', vector_field='vector', pool_size=5, max_overflow=10, timeout=30, **kwargs)[source]
Bases: langchain.vectorstores.base.... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-148 | content_field (str) –
metadata_field (str) –
vector_field (str) –
pool_size (int) –
max_overflow (int) –
timeout (float) –
kwargs (Any) –
vector_field
Pass the rest of the kwargs to the connection.
connection_kwargs
Add program name and version to connection attributes.
add_texts(texts, metadatas=None, embeddi... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-149 | Returns
empty list
Return type
List[str]
similarity_search(query, k=4, filter=None, **kwargs)[source]
Returns the most similar indexed documents to the query text.
Uses cosine similarity.
Parameters
query (str) – The query text for which to find similar documents.
k (int) – The number of documents to return. Default i... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-150 | filter (Optional[dict]) – A dictionary of metadata fields and values to filter by.
Defaults to None.
Returns
List of Documents most similar to the query and score for each
Return type
List[Tuple[langchain.schema.Document, float]]
classmethod from_texts(texts, embedding, metadatas=None, distance_strategy=DistanceStrateg... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-151 | Parameters
texts (List[str]) –
embedding (langchain.embeddings.base.Embeddings) –
metadatas (Optional[List[dict]]) –
distance_strategy (langchain.vectorstores.singlestoredb.DistanceStrategy) –
table_name (str) –
content_field (str) –
metadata_field (str) –
vector_field (str) –
pool_size (int) –
max_overflow (i... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-152 | Bases: langchain.vectorstores.base.VectorStore
Wrapper around Clarifai AI platform’s vector store.
To use, you should have the clarifai python package installed.
Example
from langchain.vectorstores import Clarifai
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = Cla... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-153 | Make sure you are using a base workflow that is compatible with text
(such as Language Understanding).
Parameters
texts (Iterable[str]) – Texts to add to the vectorstore.
metadatas (Optional[List[dict]], optional) – Optional list of metadatas.
ids (Optional[List[str]], optional) – Optional list of IDs.
kwargs (Any) –
... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-154 | namespace (Optional[str]) –
kwargs (Any) –
Returns
List of documents most simmilar to the query text.
Return type
List[Document]
similarity_search(query, k=4, **kwargs)[source]
Run similarity search using Clarifai.
Parameters
query (str) – Text to look up documents similar to.
k (int) – Number of Documents to return... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-155 | user_id (str) – User ID.
app_id (str) – App ID.
texts (List[str]) – List of texts to add.
pat (Optional[str]) – Personal access token. Defaults to None.
number_of_docs (Optional[int]) – Number of documents to return
None. (Defaults to) –
api_base (Optional[str]) – API base. Defaults to None.
metadatas (Optional[List[d... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-156 | Parameters
user_id (str) – User ID.
app_id (str) – App ID.
documents (List[Document]) – List of documents to add.
pat (Optional[str]) – Personal access token. Defaults to None.
number_of_docs (Optional[int]) – Number of documents to return
None. (during vector search. Defaults to) –
api_base (Optional[str]) – API base... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-157 | from langchain import OpenSearchVectorSearch
opensearch_vector_search = OpenSearchVectorSearch(
"http://localhost:9200",
"embeddings",
embedding_function
)
Parameters
opensearch_url (str) –
index_name (str) –
embedding_function (Embeddings) –
kwargs (Any) –
add_texts(texts, metadatas=None, ids=None, bul... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-158 | kwargs (Any) –
Returns
List of ids from adding the texts into the vectorstore.
Return type
List[str]
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”.
similarity_search(query, k=4, **kwa... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-159 | “vector_field”.
text_field: Document field the text of the document is stored in. Defaults
to “text”.
metadata_field: Document field that metadata is stored in. Defaults to
“metadata”.
Can be set to a special value “*” to include the entire document.
Optional Args for Approximate Search:search_type: “approximate_search... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-160 | space_type: “l2”, “l1”, “linf”, “cosinesimil”, “innerproduct”,
“hammingbit”; default: “l2”
pre_filter: script_score query to pre-filter documents before identifying
nearest neighbors; default: {“match_all”: {}}
Optional Args for Painless Scripting Search:search_type: “painless_scripting”; default: “approximate_search”
... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-161 | Parameters
query (str) – Text to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
kwargs (Any) –
Returns
List of Documents along with its scores most similar to the query.
Return type
List[Tuple[langchain.schema.Document, float]]
Optional Args:same as similarity_search
max_marginal... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-162 | Defaults to 20.
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.
kwargs (Any) –
Returns
List of Documents selected by maximal marginal relevance.
Return type
list[langchain.schem... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-163 | )
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/modules/vectorstores.html |
4a1bad429950-164 | Higher values lead to more accurate graph but slower indexing speed;
default: 512
m: Number of bidirectional links created for each new element. Large impact
on memory consumption. Between 2 and 100; default: 16
Keyword Args for Script Scoring or Painless Scripting:is_appx_search: False
Parameters
texts (List[str]) –
... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-165 | To use, you should have both:
- the pymongo python package installed
- a connection string associated with a MongoDB Atlas Cluster having deployed an
Atlas Search index
Example
from langchain.vectorstores import MongoDBAtlasVectorSearch
from langchain.embeddings.openai import OpenAIEmbeddings
from pymongo import MongoC... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-166 | namespace (str) –
embedding (langchain.embeddings.base.Embeddings) –
kwargs (Any) –
Return type
langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch
add_texts(texts, metadatas=None, **kwargs)[source]
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) – Iterab... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-167 | This feature is in early access and available only for evaluation purposes, to
validate functionality, and to gather feedback from a small closed group of
early access users. It is not recommended for production deployments as we
may introduce breaking changes.
For more: https://www.mongodb.com/docs/atlas/atlas-search/... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-168 | similarity_search(query, k=4, pre_filter=None, post_filter_pipeline=None, **kwargs)[source]
Return MongoDB documents most similar to query.
Use the knnBeta Operator available in MongoDB Atlas Search
This feature is in early access and available only for evaluation purposes, to
validate functionality, and to gather fee... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-169 | following the knnBeta search.
kwargs (Any) –
Returns
List of Documents most similar to the query and score for each
Return type
List[langchain.schema.Document]
classmethod from_texts(texts, embedding, metadatas=None, collection=None, **kwargs)[source]
Construct MongoDBAtlasVectorSearch wrapper from raw documents.
Thi... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-170 | Return type
MongoDBAtlasVectorSearch
class langchain.vectorstores.MyScale(embedding, config=None, **kwargs)[source]
Bases: langchain.vectorstores.base.VectorStore
Wrapper around MyScale vector database
You need a clickhouse-connect python package, and a valid account
to connect to MyScale.
MyScale can not only search ... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-171 | Return type
str
add_texts(texts, metadatas=None, batch_size=32, ids=None, **kwargs)[source]
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) – Iterable of strings to add to the vectorstore.
ids (Optional[Iterable[str]]) – Optional list of ids to associate with the text... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-172 | texts (Iterable[str]) – List or tuple of strings to be added
config (MyScaleSettings, Optional) – Myscale configuration
text_ids (Optional[Iterable], optional) – IDs for the texts.
Defaults to None.
batch_size (int, optional) – Batchsize when transmitting data to MyScale.
Defaults to 32.
metadata (List[dict], optional)... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-173 | Perform a similarity search with MyScale
Parameters
query (str) – query string
k (int, optional) – Top K neighbors to retrieve. Defaults to 4.
where_str (Optional[str], optional) – where condition string.
Defaults to None.
NOTE – Please do not let end-user to fill this and always be aware
of SQL injection. When dealing... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-174 | where_str (Optional[str], optional) – where condition string.
Defaults to None.
NOTE – Please do not let end-user to fill this and always be aware
of SQL injection. When dealing with metadatas, remember to
use {self.metadata_column}.attribute instead of attribute
alone. The default name for it is metadata.
embedding (L... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-175 | Defaults to None.
NOTE – Please do not let end-user to fill this and always be aware
of SQL injection. When dealing with metadatas, remember to
use {self.metadata_column}.attribute instead of attribute
alone. The default name for it is metadata.
kwargs (Any) –
Returns
List of documents most similar to the query text
a... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-176 | myscale_port (int) : URL port to connect with HTTP. Defaults to 8443.
username (str) : Username to login. Defaults to None.
password (str) : Password to login. Defaults to None.
index_type (str): index type string.
index_param (dict): index build parameter.
database (str) : Database name to find the table. Defaults to ... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-177 | {‘id’: ‘text_id’,
‘vector’: ‘text_embedding’,
‘text’: ‘text_plain’,
‘metadata’: ‘metadata_dictionary_in_json’,
}
Defaults to identity map.
Show JSON schema{
"title": "MyScaleSettings", | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-178 | "description": "MyScale Client Configuration\n\nAttribute:\n myscale_host (str) : An URL to connect to MyScale backend.\n Defaults to 'localhost'.\n myscale_port (int) : URL port to connect with HTTP. Defaults to 8443.\n username (str) : Username to login. Defaults to None.\n passwor... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-179 | Defaults to 'vector_table'.\n metric (str) : Metric to compute distance,\n supported are ('l2', 'cosine', 'ip'). Defaults to 'cosine'.\n column_map (Dict) : Column type map to project column name onto langchain\n semantics. Must have keys: `text`, `id`, `vector`,\n ... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-180 | .. code-block:: python\n\n {\n 'id': 'text_id',\n 'vector': 'text_embedding',\n 'text': 'text_plain',\n 'metadata': | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-181 | 'metadata': 'metadata_dictionary_in_json',\n }\n\n Defaults to identity map.", | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-182 | "type": "object",
"properties": {
"host": {
"title": "Host",
"default": "localhost",
"env_names": "{'myscale_host'}",
"type": "string"
},
"port": {
"title": "Port",
"default": 8443,
"env_names": "{'myscale_port'}",
"type": "int... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-183 | "title": "Index Type",
"default": "IVFFLAT",
"env_names": "{'myscale_index_type'}",
"type": "string"
},
"index_param": {
"title": "Index Param",
"env_names": "{'myscale_index_param'}",
"type": "object",
"additionalProperties": {
"typ... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-184 | }
},
"database": {
"title": "Database",
"default": "default",
"env_names": "{'myscale_database'}",
"type": "string"
},
"table": {
"title": "Table",
"default": "langchain",
"env_names": "{'myscale_table'}",
"type": "string"
... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-185 | column_map (Dict[str, str])
database (str)
host (str)
index_param (Optional[Dict[str, str]])
index_type (str)
metric (str)
password (Optional[str])
port (int)
table (str)
username (Optional[str])
attribute column_map: Dict[str, str] = {'id': 'id', 'metadata': 'metadata', 'text': 'text', 'vector': 'vector'}
attribute d... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-186 | attribute username: Optional[str] = None
class langchain.vectorstores.Pinecone(index, embedding_function, text_key, namespace=None)[source]
Bases: langchain.vectorstores.base.VectorStore
Wrapper around Pinecone vector database.
To use, you should have the pinecone-client python package installed.
Example
from langcha... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-187 | namespace (Optional[str]) –
add_texts(texts, metadatas=None, ids=None, namespace=None, batch_size=32, **kwargs)[source]
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) – Iterable of strings to add to the vectorstore.
metadatas (Optional[List[dict]]) – Optional list o... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
4a1bad429950-188 | Parameters
query (str) – Text to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
filter (Optional[dict]) – Dictionary of argument(s) to filter on metadata
namespace (Optional[str]) – Namespace to search in. Default will search in ‘’ namespace.
Returns
List of Documents most similar... | https://api.python.langchain.com/en/latest/modules/vectorstores.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.