langchain_community.retrievers.qdrant_sparse_vector_retriever.QdrantSparseVectorRetriever

Note

QdrantSparseVectorRetriever implements the standard Runnable Interface. 🏃

class langchain_community.retrievers.qdrant_sparse_vector_retriever.QdrantSparseVectorRetriever[source]

Bases: BaseRetriever

Qdrant sparse vector retriever.

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 client: Any = None

‘qdrant_client’ instance to use.

param collection_name: str [Required]

Qdrant collection name.

param content_payload_key: str = 'content'

Payload field containing the document content. Defaults to ‘content’

param filter: Optional[Any] = None

Qdrant qdrant_client.models.Filter to use for queries. Defaults to None.

param k: int = 4

Number of documents to return per query. Defaults to 4.

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 metadata_payload_key: str = 'metadata'

Payload field containing the document metadata. Defaults to ‘metadata’.

param search_options: Dict[str, Any] = {}

Additional search options to pass to qdrant_client.QdrantClient.search().

param sparse_encoder: Callable[[str], Tuple[List[int], List[float]]] [Required]

Sparse encoder function to use.

param sparse_vector_name: str [Required]

Name of the sparse vector to use.

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.

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

Run more documents through the embeddings and add to the vectorstore.

Parameters
  • (List[Document] (documents) – Documents to add to the vectorstore.

  • documents (List[Document]) –

  • kwargs (Any) –

Returns

List of IDs of the added texts.

Return type

List[str]

add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[Sequence[str]] = None, batch_size: int = 64, **kwargs: Any) List[str][source]
Parameters
  • texts (Iterable[str]) –

  • metadatas (Optional[List[dict]]) –

  • ids (Optional[Sequence[str]]) –

  • batch_size (int) –

  • 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.

Examples using QdrantSparseVectorRetriever