Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

WeaviateBM25Retriever

Retrieves documents from Weaviate using the BM25 keyword-based search algorithm.

Key Features

  • BM25 keyword search from Weaviate's vector database.
  • Configurable number of results with top_k.
  • Filter support to narrow down the search space.
  • Configurable filter policy for handling runtime filters.

Configuration

  1. Drag the WeaviateBM25Retriever component onto the canvas from the Component Library.
  2. Click the component to open the configuration panel.
  3. On the General tab:
    1. Configure the document_store with your Weaviate instance URL.
  4. Go to the Advanced tab to configure top_k and filters.

Connections

WeaviateBM25Retriever accepts a query text string as input. It outputs a list of retrieved documents.

Connect the pipeline's query input to its query input. Connect its documents output to a PromptBuilder, Ranker, or answer builder.

Usage Example

components:
WeaviateBM25Retriever:
type: weaviate.src.haystack_integrations.components.retrievers.weaviate.bm25_retriever.WeaviateBM25Retriever
init_parameters:

Parameters

Inputs

ParameterTypeDefaultDescription
querystrThe query text.
filtersOptional[Dict[str, Any]]NoneFilters applied to the retrieved Documents. The way runtime filters are applied depends on the filter_policy chosen at retriever initialization. See init method docstring for more details.
top_kOptional[int]NoneThe maximum number of documents to return.

Outputs

ParameterTypeDefaultDescription
documentsList[Document]

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
document_storeWeaviateDocumentStoreInstance of WeaviateDocumentStore that will be used from this retriever.
filtersOptional[Dict[str, Any]]NoneCustom filters applied when running the retriever
top_kint10Maximum number of documents to return
filter_policyUnion[str, FilterPolicy]FilterPolicy.REPLACEPolicy to determine how filters are applied.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
querystrThe query text.
filtersOptional[Dict[str, Any]]NoneFilters applied to the retrieved Documents. The way runtime filters are applied depends on the filter_policy chosen at retriever initialization. See init method docstring for more details.
top_kOptional[int]NoneThe maximum number of documents to return.