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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.