id
stringlengths
14
15
text
stringlengths
44
2.47k
source
stringlengths
61
181
971c4a934c21-0
langchain.vectorstores.redis.schema.TextFieldSchema¶ class langchain.vectorstores.redis.schema.TextFieldSchema[source]¶ Bases: RedisField 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 valid model. param name: str [Requ...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.schema.TextFieldSchema.html
971c4a934c21-1
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.redis.schema.TextFieldSchema.html
971c4a934c21-2
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.redis.schema.TextFieldSchema.html
b9b90a7a5d31-0
langchain.vectorstores.llm_rails.LLMRails¶ class langchain.vectorstores.llm_rails.LLMRails(datastore_id: Optional[str] = None, api_key: Optional[str] = None)[source]¶ Implementation of Vector Store using LLMRails (https://llmrails.com/). .. rubric:: Example from langchain.vectorstores import LLMRails vectorstore = LLMR...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.llm_rails.LLMRails.html
b9b90a7a5d31-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]) Del...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.llm_rails.LLMRails.html
b9b90a7a5d31-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.llm_rails.LLMRails.html
b9b90a7a5d31-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) → LLMRailsRet...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.llm_rails.LLMRails.html
b9b90a7a5d31-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.llm_rails.LLMRails.html
b9b90a7a5d31-5
Return VectorStore initialized from documents and embeddings. classmethod from_texts(texts: List[str], embedding: Optional[Embeddings] = None, metadatas: Optional[List[dict]] = None, **kwargs: Any) → LLMRails[source]¶ Construct LLMRails wrapper from raw documents. This is intended to be a quick way to get started. .. r...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.llm_rails.LLMRails.html
b9b90a7a5d31-6
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 that determines the degree of diversity among the results with 0 correspondi...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.llm_rails.LLMRails.html
b9b90a7a5d31-7
**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 = 5) → List[Tuple[Document, float]][source...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.llm_rails.LLMRails.html
0c465b961455-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
0c465b961455-1
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, **kwargs) Run mor...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html
0c465b961455-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
0c465b961455-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
0c465b961455-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
0c465b961455-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
0c465b961455-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
0c465b961455-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
0c465b961455-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
0c465b961455-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¶ Google Vertex AI MatchingEngine
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.matching_engine.MatchingEngine.html
b69adba194bc-0
langchain.vectorstores.elasticsearch.BaseRetrievalStrategy¶ class langchain.vectorstores.elasticsearch.BaseRetrievalStrategy[source]¶ Base class for Elasticsearch retrieval strategies. Methods __init__() before_index_setup(client, text_field, ...) Executes before the index is created. index(dims_length, vector_query_fi...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elasticsearch.BaseRetrievalStrategy.html
b69adba194bc-1
Executes when a search is performed on the store. Parameters query_vector – The query vector, or None if not using vector-based query. query – The text query, or None if not using text-based query. k – The total number of results to retrieve. fetch_k – The number of results to fetch initially. vector_query_field – The ...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.elasticsearch.BaseRetrievalStrategy.html
61e04b4db801-0
langchain.vectorstores.typesense.Typesense¶ class langchain.vectorstores.typesense.Typesense(typesense_client: Client, embedding: Embeddings, *, typesense_collection_name: Optional[str] = None, text_key: str = 'text')[source]¶ Typesense vector store. To use, you should have the typesense python package installed. Examp...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html
61e04b4db801-1
Run more documents through the embeddings and add to the vectorstore. add_texts(texts[, metadatas, ids]) Run more texts through the embedding and add to the vectorstore. afrom_documents(documents, embedding, **kwargs) Return VectorStore initialized from documents and embeddings. afrom_texts(texts, embedding[, metadatas...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html
61e04b4db801-2
search(query, search_type, **kwargs) Return docs most similar to query using specified search type. similarity_search(query[, k, filter]) Return typesense documents most similar to query. similarity_search_by_vector(embedding[, k]) Return docs most similar to embedding vector. similarity_search_with_relevance_scores(qu...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html
61e04b4db801-3
Run more texts through the embedding 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 ids to associate with the texts. Returns List of ids from adding the texts into the vectorstore. asy...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html
61e04b4db801-4
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 maximum. (Default: 0.5) filter: Filter by doc...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html
61e04b4db801-5
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.typesense.Typesense.html
61e04b4db801-6
Return VectorStore initialized from documents and embeddings. classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, typesense_client: Optional[Client] = None, typesense_client_params: Optional[dict] = None, typesense_collection_name: Opt...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html
61e04b4db801-7
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 maximum diversity and 1 to minimum diversity. Defaults to 0.5. Returns List of Documen...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.typesense.Typesense.html
61e04b4db801-8
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.typesense.Typesense.html
2d4bcfdd97a5-0
langchain.vectorstores.marqo.Marqo¶ class langchain.vectorstores.marqo.Marqo(client: marqo.Client, index_name: str, add_documents_settings: Optional[Dict[str, Any]] = None, searchable_attributes: Optional[List[str]] = None, page_content_builder: Optional[Callable[[Dict[str, Any]], str]] = None)[source]¶ Marqo vector st...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
2d4bcfdd97a5-1
add_texts(texts[, metadatas]) Upload texts with metadata (properties) to Marqo. 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_relevance_searc...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
2d4bcfdd97a5-2
get_number_of_documents() Helper to see the number of documents in the index marqo_bulk_similarity_search(queries[, k]) Return documents from Marqo using a bulk search, exposes Marqo's output directly marqo_similarity_search(query[, k]) Return documents from Marqo exposing Marqo's output directly max_marginal_relevance...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
2d4bcfdd97a5-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.marqo.Marqo.html
2d4bcfdd97a5-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.marqo.Marqo.html
2d4bcfdd97a5-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.marqo.Marqo.html
2d4bcfdd97a5-6
queries. Parameters queries (Iterable[Union[str, Dict[str, float]]]) – An iterable of queries to bulk (execute in) – of (queries in the list can be strings or dictionaries) – queries. (weighted) – k (int, optional) – The number of documents to return for each query. 4. (Defaults to) – Returns A list of results for ...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
2d4bcfdd97a5-7
Return VectorStore initialized from documents. Note that Marqo does not need embeddings, we retain the parameter to adhere to the Liskov substitution principle. Parameters documents (List[Document]) – Input documents embedding (Any, optional) – Embeddings (not required). Defaults to None. Returns A Marqo vectorstore Re...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
2d4bcfdd97a5-8
texts (List[str]) – A list of texts to index into marqo upon creation. embedding (Any, optional) – Embeddings (not required). Defaults to None. index_name (str, optional) – The name of the index to use, if none is None. (accompany the texts. Defaults to) – url (str, optional) – The URL for Marqo. Defaults to “http://l...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
2d4bcfdd97a5-9
List[Dict[str, str]] get_number_of_documents() → int[source]¶ Helper to see the number of documents in the index Returns The number of documents Return type int marqo_bulk_similarity_search(queries: Iterable[Union[str, Dict[str, float]]], k: int = 4) → Dict[str, List[Dict[str, List[Dict[str, str]]]]][source]¶ Return do...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
2d4bcfdd97a5-10
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 maximum diversity and 1 to minimum diversity. Defaults to 0.5. Returns List of Documen...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
2d4bcfdd97a5-11
query. (as a string or a weighted) – k (int, optional) – The number of documents to return. Defaults to 4. Returns k documents ordered from best to worst match. Return type List[Document] similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Document]¶ Return docs most similar to embedd...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
2d4bcfdd97a5-12
ordered by descending score. Return type List[Tuple[Document, float]] Examples using Marqo¶ Marqo
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.marqo.Marqo.html
72c67befc536-0
langchain.vectorstores.annoy.dependable_annoy_import¶ langchain.vectorstores.annoy.dependable_annoy_import() → Any[source]¶ Import annoy if available, otherwise raise error.
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.annoy.dependable_annoy_import.html
f9c4294d6272-0
langchain.vectorstores.llm_rails.ModelChoices¶ class langchain.vectorstores.llm_rails.ModelChoices(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶ embedding_english_v1 = 'embedding-english-v1'¶ embedding_multi_v1 = 'embedding-multi-v1'¶
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.llm_rails.ModelChoices.html
bfb80cfcb25e-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
83a9f7c70144-0
langchain.vectorstores.rocksetdb.Rockset¶ class langchain.vectorstores.rocksetdb.Rockset(client: Any, embeddings: Embeddings, collection_name: str, text_key: str, embedding_key: str, workspace: str = 'commons')[source]¶ Rockset vector store. To use, you should have the rockset python package installed. Note that to use...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.rocksetdb.Rockset.html
83a9f7c70144-1
Attributes embeddings Access the query embedding object if available. Methods __init__(client, embeddings, ...[, workspace]) Initialize with Rockset client. :param client: Rockset client object :param collection: Rockset collection to insert docs / query :param embeddings: Langchain Embeddings object to use to generate...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.rocksetdb.Rockset.html
83a9f7c70144-2
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]) Delete by vector ID or other criteria. delete_texts(ids) Delete a ...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.rocksetdb.Rockset.html
83a9f7c70144-3
Initialize with Rockset client. :param client: Rockset client object :param collection: Rockset collection to insert docs / query :param embeddings: Langchain Embeddings object to use to generate embedding for given text. Parameters text_key – column in Rockset collection to use to store the text embedding_key – column...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.rocksetdb.Rockset.html
83a9f7c70144-4
ids: Optional list of ids to associate with the texts. batch_size: Send documents in batches to rockset. Returns List of ids from adding the texts into the vectorstore. async classmethod afrom_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶ Return VectorStore initialized from documents...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.rocksetdb.Rockset.html
83a9f7c70144-5
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 VectorStore. Return type VectorStoreRetriever Examples: # Retrieve more documen...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.rocksetdb.Rockset.html
83a9f7c70144-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.rocksetdb.Rockset.html
83a9f7c70144-7
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.rocksetdb.Rockset.html
83a9f7c70144-8
Same as similarity_search_with_relevance_scores but doesn’t return the scores. similarity_search_by_vector(embedding: List[float], k: int = 4, distance_func: DistanceFunction = DistanceFunction.COSINE_SIM, where_str: Optional[str] = None, **kwargs: Any) → List[Document][source]¶ Accepts a query_embedding (vector), and ...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.rocksetdb.Rockset.html
83a9f7c70144-9
List of documents with their relevance score Return type List[Tuple[Document, float]] similarity_search_with_score(*args: Any, **kwargs: Any) → List[Tuple[Document, float]]¶ Run similarity search with distance. Examples using Rockset¶ Rockset
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.rocksetdb.Rockset.html
2cc9c88256e8-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
2cc9c88256e8-1
Return VectorStore initialized from texts and embeddings. 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...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html
2cc9c88256e8-2
save_local(folder_path[, index_name]) Save FAISS index, docstore, and index_to_docstore_id to disk. 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, fi...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html
2cc9c88256e8-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.faiss.FAISS.html
2cc9c88256e8-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
2cc9c88256e8-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
2cc9c88256e8-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
2cc9c88256e8-7
from langchain.vectorstores import FAISS 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, a...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html
2cc9c88256e8-8
Defaults to 0.5. Returns List of Documents selected by maximal marginal relevance. max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[Dict[str, Any]] = None, **kwargs: Any) → List[Document][source]¶ Return docs selected using the max...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html
2cc9c88256e8-9
of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults to 0.5. Returns List of Documents and similarity scores selected by maximal marginalrelevance and score for each. merge_from(target: FAISS) → None[source]¶ Merge another FAISS object with the current one. Add t...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html
2cc9c88256e8-10
Defaults to 20. Returns List of Documents most similar to the query. similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[Dict[str, Any]] = None, fetch_k: int = 20, **kwargs: Any) → List[Document][source]¶ Return docs most similar to embedding vector. Parameters embedding – Embedding to look...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html
2cc9c88256e8-11
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 query text with L2 distance in float. Lower score represents ...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html
2cc9c88256e8-12
SQL Caching Ensemble Retriever Custom agent with tool retrieval Select by maximal marginal relevance (MMR) First we add a step to load memory
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.faiss.FAISS.html
280a7b5b8c97-0
langchain.vectorstores.pgembedding.QueryResult¶ class langchain.vectorstores.pgembedding.QueryResult[source]¶ Result from a query. Attributes EmbeddingStore distance Methods __init__() __init__()¶
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pgembedding.QueryResult.html
8474db3cc818-0
langchain.vectorstores.pinecone.Pinecone¶ class langchain.vectorstores.pinecone.Pinecone(index: Any, embedding: Union[Embeddings, Callable], text_key: str, namespace: Optional[str] = None, distance_strategy: Optional[DistanceStrategy] = DistanceStrategy.COSINE)[source]¶ Pinecone vector store. To use, you should have th...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html
8474db3cc818-1
Return VectorStore initialized from texts and embeddings. 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...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html
8474db3cc818-2
Return docs most similar to embedding vector. similarity_search_by_vector_with_score(...) Return pinecone documents most similar to embedding, along with scores. similarity_search_with_relevance_scores(query) Return docs and relevance scores in the range [0, 1]. similarity_search_with_score(query[, k, ...]) Return pine...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html
8474db3cc818-3
Run more texts through the embeddings and add to the vectorstore. Upsert optimization is done by chunking the embeddings and upserting them. This is done to avoid memory issues and optimize using HTTP based embeddings. For OpenAI embeddings, use pool_threads>4 when constructing the pinecone.Index, embedding_chunk_size>...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html
8474db3cc818-4
Return docs selected using the maximal marginal relevance. 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 “s...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html
8474db3cc818-5
) # Only get the single most similar document from the dataset 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, **kwa...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html
8474db3cc818-6
Load pinecone vectorstore from index name. classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, batch_size: int = 32, text_key: str = 'text', namespace: Optional[str] = None, index_name: Optional[str] = None, upsert_kwargs: Optional[dic...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html
8474db3cc818-7
Returns Pinecone Index instance. max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[dict] = None, namespace: Optional[str] = None, **kwargs: Any) → List[Document][source]¶ Return docs selected using the maximal marginal relevance. Maximal marginal relevan...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html
8474db3cc818-8
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. similarity_search(query: str, k: int = 4, filter: Optional[dict] = None, namespace: Optional[str] = None...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.pinecone.Pinecone.html
8474db3cc818-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.pinecone.Pinecone.html
122a5a31c361-0
langchain.vectorstores.lancedb.LanceDB¶ class langchain.vectorstores.lancedb.LanceDB(connection: Any, embedding: Embeddings, vector_key: Optional[str] = 'vector', id_key: Optional[str] = 'id', text_key: Optional[str] = 'text')[source]¶ LanceDB vector store. To use, you should have lancedb python package installed. Exam...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html
122a5a31c361-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.lancedb.LanceDB.html
122a5a31c361-2
Initialize with Lance DB connection 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...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html
122a5a31c361-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.lancedb.LanceDB.html
122a5a31c361-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.lancedb.LanceDB.html
122a5a31c361-5
Returns True if deletion is successful, False otherwise, None if not implemented. Return type Optional[bool] 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...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html
122a5a31c361-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.lancedb.LanceDB.html
122a5a31c361-7
**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(*args: Any, **kwargs: Any) → List[Tuple[Document, float]]¶ Ru...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.lancedb.LanceDB.html
faceda03cab8-0
langchain.vectorstores.qdrant.sync_call_fallback¶ langchain.vectorstores.qdrant.sync_call_fallback(method: Callable) → Callable[source]¶ Decorator to call the synchronous method of the class if the async method is not implemented. This decorator might be only used for the methods that are defined as async in the class.
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.qdrant.sync_call_fallback.html
97e650375853-0
langchain.vectorstores.utils.filter_complex_metadata¶ langchain.vectorstores.utils.filter_complex_metadata(documents: ~typing.List[~langchain.schema.document.Document], *, allowed_types: ~typing.Tuple[~typing.Type, ...] = (<class 'str'>, <class 'bool'>, <class 'int'>, <class 'float'>)) → List[Document][source]¶ Filter ...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.utils.filter_complex_metadata.html
8004b0899ce4-0
langchain.vectorstores.chroma.Chroma¶ class langchain.vectorstores.chroma.Chroma(collection_name: str = 'langchain', embedding_function: Optional[Embeddings] = None, persist_directory: Optional[str] = None, client_settings: Optional[chromadb.config.Settings] = None, collection_metadata: Optional[Dict] = None, client: O...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html
8004b0899ce4-1
amax_marginal_relevance_search_by_vector(...) Return docs selected using the maximal marginal relevance. as_retriever(**kwargs) Return VectorStoreRetriever initialized from this VectorStore. asearch(query, search_type, **kwargs) Return docs most similar to query using specified search type. asimilarity_search(query[, k...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html
8004b0899ce4-2
Return docs and relevance scores in the range [0, 1]. similarity_search_with_score(query[, k, ...]) Run similarity search with Chroma with distance. update_document(document_id, document) Update a document in the collection. update_documents(ids, documents) Update a document in the collection. __init__(collection_name:...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html
8004b0899ce4-3
Run more texts through the embeddings and add to the vectorstore. 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. Returns List of IDs of the added texts. Return type L...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html
8004b0899ce4-4
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.chroma.Chroma.html
8004b0899ce4-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.chroma.Chroma.html
8004b0899ce4-6
embedding (Optional[Embeddings]) – Embedding function. Defaults to None. client_settings (Optional[chromadb.config.Settings]) – Chroma client settings collection_metadata (Optional[Dict]) – Collection configurations. Defaults to None. Returns Chroma vectorstore. Return type Chroma classmethod from_texts(texts: List[str...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html
8004b0899ce4-7
Defaults to None. Returns Chroma vectorstore. Return type Chroma get(ids: Optional[OneOrMany[ID]] = None, where: Optional[Where] = None, limit: Optional[int] = None, offset: Optional[int] = None, where_document: Optional[WhereDocument] = None, include: Optional[List[str]] = None) → Dict[str, Any][source]¶ Gets the coll...
https://api.python.langchain.com/en/latest/vectorstores/langchain.vectorstores.chroma.Chroma.html