Return docs most similar to query.
static delete(ids: Optional[List[str]] = None, **kwargs: Any) → bool[source]¶
Delete a Redis entry.
Parameters
ids – List of ids (keys) to delete.
Returns
Whether or not the deletions were successful.
Return type
bool
static drop_index(index_name: str, delete_documents: bool, **kwargs: Any) → bool[source]¶
Drop a Redis search index.
Parameters
index_name (str) – Name of the index to drop.
delete_documents (bool) – Whether to drop the associated documents.
Returns
Whether or not the drop was successful.
Return type
bool
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
classmethod from_existing_index(embedding: Embeddings, index_name: str, content_key: str = 'content', metadata_key: str = 'metadata', vector_key: str = 'content_vector', **kwargs: Any) → Redis[source]¶
Connect to an existing Redis index.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, index_name: Optional[str] = None, content_key: str = 'content', metadata_key: str = 'metadata', vector_key: str = 'content_vector', **kwargs: Any) → Redis[source]¶
Create a Redis vectorstore from raw documents.
This is a user-friendly interface that:
1. Embeds documents.
2. Creates a new index for the embeddings in Redis.
3. Adds the documents to the newly created Redis index.
This is intended to be a quick way to get started.
Example
from langchain.vectorstores import Redis
from langchain.embeddings import OpenAIEmbeddings