id
stringlengths
14
16
text
stringlengths
31
2.41k
source
stringlengths
53
121
32f9d2501d32-27
Parameters file_path (str) – path of the local file to store the messages. property messages: List[langchain.schema.BaseMessage] Retrieve the messages from the local file add_message(message)[source] Append the message to the record in the local file Parameters message (langchain.schema.BaseMessage) – Return type No...
https://api.python.langchain.com/en/latest/modules/memory.html
32f9d2501d32-28
See https://gomomento.com/ Parameters session_id (str) – cache_client (momento.CacheClient) – cache_name (str) – key_prefix (str) – ttl (Optional[timedelta]) – ensure_cache_exists (bool) – classmethod from_client_params(session_id, cache_name, ttl, *, configuration=None, auth_token=None, **kwargs)[source] Constr...
https://api.python.langchain.com/en/latest/modules/memory.html
32f9d2501d32-29
session_id (str) – arbitrary key that is used to store the messages of a single chat session. database_name (str) – name of the database to use collection_name (str) – name of the collection to use property messages: List[langchain.schema.BaseMessage] Retrieve the messages from MongoDB add_message(message)[source] Ap...
https://api.python.langchain.com/en/latest/modules/memory.html
32f9d2501d32-30
Delete a session Return type None async init()[source] Return type None load_memory_variables(values)[source] Return key-value pairs given the text input to the chain. If None, return all memories Parameters values (Dict[str, Any]) – Return type Dict[str, Any] save_context(inputs, outputs)[source] Save context from...
https://api.python.langchain.com/en/latest/modules/memory.html
32f9d2501d32-31
Nothing to clear, got a memory like a vault. Return type None load_memory_variables(inputs)[source] Load memory variables from memory. Parameters inputs (Dict[str, Any]) – Return type Dict[str, str] save_context(inputs, outputs)[source] Nothing should be saved or changed Parameters inputs (Dict[str, Any]) – outputs...
https://api.python.langchain.com/en/latest/modules/memory.html
32f9d2501d32-32
that TTL is extended by 3 days every time the entity is read back. Parameters session_id (str) – url (str) – key_prefix (str) – ttl (Optional[int]) – recall_ttl (Optional[int]) – args (Any) – redis_client (Any) – Return type None attribute key_prefix: str = 'memory_store' attribute recall_ttl: Optional[int] = 2...
https://api.python.langchain.com/en/latest/modules/memory.html
32f9d2501d32-33
property messages: List[langchain.schema.BaseMessage] Retrieve all messages from db add_message(message)[source] Append the message to the record in db Parameters message (langchain.schema.BaseMessage) – Return type None clear()[source] Clear session memory from db Return type None class langchain.memory.SQLiteEnti...
https://api.python.langchain.com/en/latest/modules/memory.html
32f9d2501d32-34
Simple memory for storing context or other bits of information that shouldn’t ever change between prompts. Parameters memories (Dict[str, Any]) – Return type None attribute memories: Dict[str, Any] = {} clear()[source] Nothing to clear, got a memory like a vault. Return type None load_memory_variables(inputs)[source...
https://api.python.langchain.com/en/latest/modules/memory.html
32f9d2501d32-35
attribute return_docs: bool = False Whether or not to return the result of querying the database directly. clear()[source] Nothing to clear. Return type None load_memory_variables(inputs)[source] Return history buffer. Parameters inputs (Dict[str, Any]) – Return type Dict[str, Union[List[langchain.schema.Document],...
https://api.python.langchain.com/en/latest/modules/memory.html
32f9d2501d32-36
properties. For more information on the zep-python package, see: https://github.com/getzep/zep-python Parameters session_id (str) – url (str) – Return type None property messages: List[langchain.schema.BaseMessage] Retrieve messages from Zep memory property zep_messages: List[Message] Retrieve summary from Zep memo...
https://api.python.langchain.com/en/latest/modules/memory.html
81b746c66a31-0
Vector Stores Wrappers on top of vector stores. class langchain.vectorstores.AlibabaCloudOpenSearch(embedding, config, **kwargs)[source] Bases: langchain.vectorstores.base.VectorStore Alibaba Cloud OpenSearch Vector Store Parameters embedding (langchain.embeddings.base.Embeddings) – config (langchain.vectorstores.al...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-1
score_threshold: Optional, a floating point value between 0 to 1 to filter the resulting set of retrieved docs search_filter (Optional[dict]) – kwargs (Any) – Returns List of Tuples of (doc, similarity_score) Return type List[Tuple[langchain.schema.Document, float]] similarity_search_by_vector(embedding, k=4, search_...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-2
metadatas (Optional[List[dict]]) – config (Optional[langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearchSettings]) – kwargs (Any) – Return type langchain.vectorstores.alibabacloud_opensearch.AlibabaCloudOpenSearch classmethod from_documents(documents, embedding, ids=None, config=None, **kwargs)[sour...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-3
vector store and opensearch instance configuration table field names: { β€˜id’: β€˜The id field name map of index document.’, β€˜document’: β€˜The text field name map of index document.’, β€˜embedding’: β€˜In the embedding field of the opensearch instance, the values must be in float16 multivalue type and separated by commas.’, β€˜m...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-4
collection_name is the name of the collection to use. (default: langchain) NOTE: This is not the name of the table, but the name of the collection.The tables will be created when initializing the store (if not exists) So, make sure the user has the right permissions to create tables. pre_delete_collection if True, will...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-5
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_with_score(query, k=4, filter=None)[source] Return docs most...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-6
Return VectorStore initialized from texts and embeddings. Postgres Connection string is required Either pass it as a parameter or set the PG_CONNECTION_STRING environment variable. Parameters texts (List[str]) – embedding (langchain.embeddings.base.Embeddings) – metadatas (Optional[List[dict]]) – embedding_dimension...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-7
user (str) – password (str) – Return type str class langchain.vectorstores.Annoy(embedding_function, index, metric, docstore, index_to_docstore_id)[source] Bases: langchain.vectorstores.base.VectorStore Wrapper around Annoy vector database. To use, you should have the annoy python package installed. Example from lan...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-8
Parameters query – Text to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. search_k (int) – inspect up to search_k nodes which defaults to n_trees * n if not provided embedding (List[float]) – Returns List of Documents most similar to the query and score for each Return type List[...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-9
Parameters embedding (List[float]) – Embedding to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. search_k (int) – inspect up to search_k nodes which defaults to n_trees * n if not provided kwargs (Any) – Returns List of Documents most similar to the embedding. Return type List[la...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-10
Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. Parameters embedding (List[float]) – Embedding to look up documents similar to. fetch_k (int) – Number of Documents to fetch to pass to MMR algorithm. k (int) – Number of Documents to return. Defaults to 4. lambda_mult ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-11
Parameters texts (List[str]) – List of documents to index. embedding (langchain.embeddings.base.Embeddings) – Embedding function to use. metadatas (Optional[List[dict]]) – List of metadata dictionaries to associate with documents. metric (str) – Metric to use for indexing. Defaults to β€œangular”. trees (int) – Number of...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-12
Return type langchain.vectorstores.annoy.Annoy This is a user friendly interface that: Creates an in memory docstore with provided embeddings Initializes the Annoy database This is intended to be a quick way to get started. Example from langchain import Annoy from langchain.embeddings import OpenAIEmbeddings embeddings...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-13
Example from langchain.vectorstores import AtlasDB from langchain.embeddings.openai import OpenAIEmbeddings embeddings = OpenAIEmbeddings() vectorstore = AtlasDB("my_project", embeddings.embed_query) Parameters name (str) – embedding_function (Optional[Embeddings]) – api_key (Optional[str]) – description (str) – is...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-14
List of documents most similar to the query text. Return type List[Document] classmethod from_texts(texts, embedding=None, metadatas=None, ids=None, name=None, api_key=None, description='A description for your project', is_public=True, reset_project_if_exists=False, index_kwargs=None, **kwargs)[source] Create an Atlas...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-15
api_key (str) – Your nomic API key, documents (List[Document]) – List of documents to add to the vectorstore. embedding (Optional[Embeddings]) – Embedding function. Defaults to None. ids (Optional[List[str]]) – Optional list of document IDs. If None, ids will be auto created description (str) – A description for your p...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-16
:param kwargs: vectorstore specific parameters. Returns List of ids from adding the texts into the vectorstore. Parameters texts (Iterable[str]) – metadatas (Optional[List[dict]]) – is_duplicate_texts (Optional[bool]) – kwargs (Any) – Return type List[str] load_local(table_name, **kwargs)[source] Parameters table_...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-17
Parameters embedding (Optional[List[float]]) – Embedding to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. scores (Optional[list]) – kwargs (Any) – Returns List of Documents most similar to the query vector. Return type List[langchain.schema.Document] create_table(table_name, **...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-18
kwargs (Any) – Returns AwaDB vectorstore. Return type AwaDB classmethod from_documents(documents, embedding=None, table_name='langchain_awadb', log_and_data_dir=None, client=None, **kwargs)[source] Create an AwaDB vectorstore from a list of documents. If a log_and_data_dir specified, the table will be persisted there...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-19
similarity_search(query, k=4, **kwargs)[source] Return docs most similar to query. Parameters query (str) – k (int) – kwargs (Any) – Return type List[langchain.schema.Document] vector_search(query, k=4, **kwargs)[source] Returns the most similar indexed documents to the query text. Parameters query (str) – The que...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-20
Parameters query (str) – Text to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. filters (Optional[str]) – Returns List of Documents most similar to the query and score for each Return type List[Tuple[langchain.schema.Document, float]] semantic_hybrid_search(query, k=4, **kwargs)[...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-21
kwargs (Any) – Return type langchain.vectorstores.azuresearch.AzureSearch class langchain.vectorstores.Cassandra(embedding, session, keyspace, table_name, ttl_seconds=None)[source] Bases: langchain.vectorstores.base.VectorStore Wrapper around Cassandra embeddings platform. There is no notion of a default table name, ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-22
Returns List of IDs of the added texts. Return type List[str] similarity_search_with_score_id_by_vector(embedding, k=4)[source] Return docs most similar to embedding vector. No support for filter query (on metadata) along with vector search. Parameters embedding (str) – Embedding to look up documents similar to. k (in...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-23
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. Defaults to 4. kwargs (Any) – Returns List of Documents most similar to the query vector. Return type List[langchain.schema.Document] similarity_search_...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-24
Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. :param query: Text to look up documents similar to. :param k: Number of Documents to return. :param fetch_k: Number of Documents to fetch to pass to MMR algorithm. :param lambda_mult: Number between 0 and 1 that determi...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-25
Bases: langchain.vectorstores.base.VectorStore Wrapper around ChromaDB embeddings platform. To use, you should have the chromadb python package installed. Example from langchain.vectorstores import Chroma from langchain.embeddings.openai import OpenAIEmbeddings embeddings = OpenAIEmbeddings() vectorstore = Chroma("lang...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-26
Return docs most similar to embedding vector. :param embedding: Embedding to look up documents similar to. :type embedding: str :param k: Number of Documents to return. Defaults to 4. :type k: int :param filter: Filter by metadata. Defaults to None. :type filter: Optional[Dict[str, str]] Returns List of Documents most ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-27
lambda_mult (float) – Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults to 0.5. filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None. kwargs (Any) – Returns List of Documents selected by ma...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-28
where (Optional[Where]) – A Where type dict used to filter results by. E.g. {β€œcolor” : β€œred”, β€œprice”: 4.20}. Optional. limit (Optional[int]) – The number of documents to return. Optional. offset (Optional[int]) – The offset to start returning results from. Useful for paging results with limit. Optional. where_document...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-29
collection_name (str) – Name of the collection to create. persist_directory (Optional[str]) – Directory to persist the collection. embedding (Optional[Embeddings]) – Embedding function. Defaults to None. metadatas (Optional[List[dict]]) – List of metadatas. Defaults to None. ids (Optional[List[str]]) – List of document...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-30
Bases: langchain.vectorstores.base.VectorStore Wrapper around ClickHouse vector database You need a clickhouse-connect python package, and a valid account to connect to ClickHouse. ClickHouse can not only search with simple vector indexes, it also supports complex query with multiple conditions, constraints and even su...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-31
Defaults to None. batch_size (int, optional) – Batchsize when transmitting data to ClickHouse. Defaults to 32. metadata (List[dict], optional) – metadata to texts. Defaults to None. into (Other keyword arguments will pass) – [clickhouse-connect](https://clickhouse.com/docs/en/integrations/python#clickhouse-connect-driv...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-32
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 (List[float]) – kwargs (Any) – Returns List of (Document, similarity) Return type List[Document] similarity_search_with_relevance_scores(query, k=4...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-33
index_param (list): index build parameter. index_query_params(dict): index query parameters. database (str) : Database name to find the table. Defaults to β€˜default’. table (str) : Table name to operate on. Defaults to β€˜vector_table’. metric (str)Metric to compute distance,supported are (β€˜angular’, β€˜euclidean’, β€˜manhatt...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-34
Show JSON schema{ "title": "ClickhouseSettings", "description": "ClickHouse Client Configuration\n\nAttribute:\n clickhouse_host (str) : An URL to connect to MyScale backend.\n Defaults to 'localhost'.\n clickhouse_port (int) : URL port to connect with HTTP. Defaults to 8443.\n us...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-35
"type": "object", "properties": { "host": { "title": "Host", "default": "localhost", "env_names": "{'clickhouse_host'}", "type": "string" }, "port": { "title": "Port", "default": 8123, "env_names": "{'clickhouse_port'}", "type"...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-36
"type": "string" } }, "column_map": { "title": "Column Map", "default": { "id": "id", "uuid": "uuid", "document": "document", "embedding": "embedding", "metadata": "metadata" }, "env_names": "{'clickhous...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-37
port (int) table (str) username (Optional[str]) attribute column_map: Dict[str, str] = {'document': 'document', 'embedding': 'embedding', 'id': 'id', 'metadata': 'metadata', 'uuid': 'uuid'} attribute database: str = 'default' attribute host: str = 'localhost' attribute index_param: Optional[Union[List, Dict]] = ["'L...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-38
To use, you should have the deeplake python package installed. Example from langchain.vectorstores import DeepLake from langchain.embeddings.openai import OpenAIEmbeddings embeddings = OpenAIEmbeddings() vectorstore = DeepLake("langchain_store", embeddings.embed_query) Parameters dataset_path (str) – token (Optional[s...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-39
... ) >>> # Run tql search: >>> data = vector_store.tql_search( ... tql_query="SELECT * WHERE id == <id>", ... exec_option="compute_engine", ... ) Parameters k (int) – Number of Documents to return. Defaults to 4. query (str) – Text to look up similar documents. **kwargs – Additional keyword arguments include: ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-40
similarity_search_by_vector(embedding, k=4, **kwargs)[source] Return docs most similar to embedding vector. Examples >>> # Search using an embedding >>> data = vector_store.similarity_search_by_vector( ... embedding=<your_embedding>, ... k=<num_items_to_return>, ... exec_option=<preferred_exec_option>, ... ) ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-41
runtime = {β€œdb_engine”: True} during dataset creation. distance_metric (str): L2 for Euclidean, L1 for Nuclear,max for L-infinity distance, cos for cosine similarity, β€˜dot’ for dot product. Defaults to L2. kwargs (Any) – Returns List of Documents most similar to the query vector. Return type List[Document] similarity_...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-42
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/modules/vectorstores.html
81b746c66a31-43
β€œpython”. - β€œpython” - Pure-python implementation running on the client. Can be used for data stored anywhere. WARNING: using this option with big datasets is discouraged due to potential memory issues. ”compute_engine” - Performant C++ implementation of the DeepLake Compute Engine. Runs on the client and can be used f...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-44
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 implementation running on the client. Can be used for data stored anywhere. WARNING: using this option with big datasets i...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-45
… 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/modules/vectorstores.html
81b746c66a31-46
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 Whether the delete operation was successful. Return type bool classmethod force_delete_by_path(path)[source] Force delete dataset by pa...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-47
β€œ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 a construction time/accuracy trade-off. Defaults to 200. ef (int) – param...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-48
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 the docarray package with version...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-49
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
81b746c66a31-50
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
81b746c66a31-51
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
81b746c66a31-52
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
81b746c66a31-53
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
81b746c66a31-54
filter the resulting set of retrieved docs 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, **kwa...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-55
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
81b746c66a31-56
Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND diversity 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 o...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-57
Return type List[langchain.schema.Document] merge_from(target)[source] Merge another FAISS object with the current one. 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_t...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-58
faiss = FAISS.from_embeddings(text_embedding_pairs, embeddings) Parameters text_embeddings (List[Tuple[str, List[float]]]) – embedding (langchain.embeddings.base.Embeddings) – metadatas (Optional[List[dict]]) – ids (Optional[List[str]]) – kwargs (Any) – Return type langchain.vectorstores.faiss.FAISS save_local(fol...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-59
- NOTE: The table will be created when initializing the store (if not exists) 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) – nd...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-60
Run similarity search with Hologres with distance. 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[lang...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-61
Return type List[Tuple[langchain.schema.Document, float]] 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 β€œEithe...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-62
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
81b746c66a31-63
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='vector', id_key='id', text_key='text')[source] Bases: langchain.vectorstores.base.VectorSto...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-64
kwargs (Any) – Returns List of documents most similar to the query. Return type List[langchain.schema.Document] classmethod from_texts(texts, embedding, metadatas=None, connection=None, vector_key='vector', id_key='id', text_key='text', **kwargs)[source] Return VectorStore initialized from texts and embeddings. Param...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-65
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. Parameters texts (Iterable[str]) – Iterable of strings to add to the vectorstore. metadatas (Optional[List[dict]]) – Optional list of meta...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-66
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 of the created index. endpoint_id (str) – The id of the created endpoint. credentials_path (Optional[str]) – (Optional) ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-67
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. Parameters texts (Iterable[str]) – The texts to embed, it is assumed that they all fit in memory. metadatas (Optional[List[dict]]) – Metadat...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-68
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 to None. timeout (int, optional) – How long to wait before timeout error. Defaults to None. kwargs (Any) – Collection.sear...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-69
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. param (dict) – The search params for the specified index. Defaults to None. expr ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-70
Returns Document results for search. Return type List[Document] max_marginal_relevance_search_by_vector(embedding, 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 embedding (str) – The embedding vector be...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-71
metadatas (Optional[List[dict]]) – Metadata for each text if it exists. Defaults to None. collection_name (str, optional) – Collection name to use. Defaults to β€œLangChainCollection”. connection_args (dict[str, Any], optional) – Connection args to use. Defaults to DEFAULT_MILVUS_CONNECTION. consistency_level (str, optio...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-72
Parameters texts (List[str]) – Text data. embedding (Embeddings) – Embedding function. metadatas (Optional[List[dict]]) – Metadata for each text if it exists. Defaults to None. collection_name (str, optional) – Collection name to use. Defaults to β€œLangChainCollection”. connection_args (dict[str, Any], optional) – Conne...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-73
distance_strategy (DistanceStrategy) – table_name (str) – 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 con...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-74
Parameters query (str) – Text to look up documents similar to. k (int) – Number of Documents to return. Defaults to 4. 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[langch...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-75
Return type langchain.vectorstores.singlestoredb.SingleStoreDBRetriever class langchain.vectorstores.Clarifai(user_id=None, app_id=None, pat=None, number_of_docs=None, api_base=None)[source] Bases: langchain.vectorstores.base.VectorStore Wrapper around Clarifai AI platform’s vector store. To use, you should have the c...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-76
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. None. (Defaults to) – namespace (Optional[str]) – kwargs (Any) – Returns List of documents most simmilar to the query text. Return type List[Document] simil...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-77
Returns Clarifai vectorstore. Return type Clarifai classmethod from_documents(documents, embedding=None, user_id=None, app_id=None, pat=None, number_of_docs=None, api_base=None, **kwargs)[source] Create a Clarifai vectorstore from a list of documents. Parameters user_id (str) – User ID. app_id (str) – App ID. document...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-78
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 ids to associate with the texts. bulk_size (int) – Bulk API request count; Default: 500 kwargs (Any) – ...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-79
subquery_clause: Query clause on the knn vector field; default: β€œmust” lucene_filter: the Lucene algorithm decides whether to perform an exact k-NN search with pre-filtering or an approximate search with modified post-filtering. Optional Args for Script Scoring Search:search_type: β€œscript_scoring”; default: β€œapproximat...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-80
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
81b746c66a31-81
space_type: β€œl2”, β€œl1”, β€œcosinesimil”, β€œlinf”, β€œinnerproduct”; default: β€œl2” ef_search: Size of the dynamic list used during k-NN searches. Higher values lead to more accurate but slower searches; default: 512 ef_construction: Size of the dynamic list used during k-NN graph creation. Higher values lead to more accurate...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-82
Parameters collection (Collection[MongoDBDocumentType]) – embedding (Embeddings) – index_name (str) – text_key (str) – embedding_key (str) – classmethod from_connection_string(connection_string, namespace, embedding, **kwargs)[source] Parameters connection_string (str) – namespace (str) – embedding (langchain.e...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-83
fields. post_filter_pipeline (Optional[List[Dict]]) – Optional Pipeline of MongoDB aggregation stages following the knnBeta search. Returns List of Documents most similar to the query and score for each Return type List[Tuple[langchain.schema.Document, float]] similarity_search(query, k=4, pre_filter=None, post_filter_...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-84
embedding (Embeddings) – metadatas (Optional[List[dict]]) – collection (Optional[Collection[MongoDBDocumentType]]) – kwargs (Any) – Return type MongoDBAtlasVectorSearch class langchain.vectorstores.MyScale(embedding, config=None, **kwargs)[source] Bases: langchain.vectorstores.base.VectorStore Wrapper around MySca...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-85
Create Myscale wrapper with existing texts Parameters embedding_function (Embeddings) – Function to extract text embedding 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...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-86
Perform a similarity search with MyScale by vectors 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. W...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-87
Bases: pydantic.env_settings.BaseSettings MyScale Client Configuration Attribute: myscale_host (str)An URL to connect to MyScale backend.Defaults to β€˜localhost’. 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...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-88
Show JSON schema{ "title": "MyScaleSettings", "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)...
https://api.python.langchain.com/en/latest/modules/vectorstores.html
81b746c66a31-89
}, "port": { "title": "Port", "default": 8443, "env_names": "{'myscale_port'}", "type": "integer" }, "username": { "title": "Username", "env_names": "{'myscale_username'}", "type": "string" }, "password": { "title": "P...
https://api.python.langchain.com/en/latest/modules/vectorstores.html