langchain_community.vectorstores.redis.base.RedisVectorStoreRetriever

Note

RedisVectorStoreRetriever implements the standard Runnable Interface. 🏃

class langchain_community.vectorstores.redis.base.RedisVectorStoreRetriever[source]

Bases: VectorStoreRetriever

Retriever for Redis VectorStore.

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 metadata: Optional[Dict[str, Any]] = None

Optional metadata associated with the retriever. Defaults to None This metadata will be associated with each call to this retriever, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a retriever with its use case.

param search_kwargs: Dict[str, Any] = {'distance_threshold': None, 'k': 4, 'score_threshold': 0.9}

Default search kwargs.

param search_type: str = 'similarity'

Type of search to perform. Can be either ‘similarity’, ‘similarity_distance_threshold’, ‘similarity_score_threshold’

param tags: Optional[List[str]] = None

Optional list of tags associated with the retriever. Defaults to None These tags will be associated with each call to this retriever, and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a retriever with its use case.

param vectorstore: Redis [Required]

Redis VectorStore.

async aadd_documents(documents: List[Document], **kwargs: Any) List[str][source]

Add documents to vectorstore.

Parameters
  • documents (List[Document]) –

  • kwargs (Any) –

Return type

List[str]

add_documents(documents: List[Document], **kwargs: Any) List[str][source]

Add documents to vectorstore.

Parameters
  • documents (List[Document]) –

  • kwargs (Any) –

Return type

List[str]

async aget_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) List[Document]

[Deprecated] Asynchronously get documents relevant to a query.

Users should favor using .ainvoke or .abatch rather than aget_relevant_documents directly.

Parameters
  • query (str) – string to find relevant documents for

  • callbacks (Callbacks) – Callback manager or list of callbacks

  • tags (Optional[List[str]]) – Optional list of tags associated with the retriever. Defaults to None These tags will be associated with each call to this retriever, and passed as arguments to the handlers defined in callbacks.

  • metadata (Optional[Dict[str, Any]]) – Optional metadata associated with the retriever. Defaults to None This metadata will be associated with each call to this retriever, and passed as arguments to the handlers defined in callbacks.

  • run_name (Optional[str]) – Optional name for the run.

  • kwargs (Any) –

Returns

List of relevant documents

Return type

List[Document]

Notes

Deprecated since version langchain-core==0.1.46: Use ainvoke instead.

get_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwargs: Any) List[Document]

[Deprecated] Retrieve documents relevant to a query.

Users should favor using .invoke or .batch rather than get_relevant_documents directly.

Parameters
  • query (str) – string to find relevant documents for

  • callbacks (Callbacks) – Callback manager or list of callbacks

  • tags (Optional[List[str]]) – Optional list of tags associated with the retriever. Defaults to None These tags will be associated with each call to this retriever, and passed as arguments to the handlers defined in callbacks.

  • metadata (Optional[Dict[str, Any]]) – Optional metadata associated with the retriever. Defaults to None This metadata will be associated with each call to this retriever, and passed as arguments to the handlers defined in callbacks.

  • run_name (Optional[str]) – Optional name for the run.

  • kwargs (Any) –

Returns

List of relevant documents

Return type

List[Document]

Notes

Deprecated since version langchain-core==0.1.46: Use invoke instead.

allowed_search_types: ClassVar[Collection[str]] = ['similarity', 'similarity_distance_threshold', 'similarity_score_threshold', 'mmr']

Allowed search types.