:param documents: A list of Documents to vectorize.
:param bm25_params: Parameters to pass to the BM25 vectorizer.
:param preprocess_func: A function to preprocess each text before vectorization.
:param **kwargs: Any other arguments to pass to the retriever.
Returns
A BM25Retriever instance.
classmethod from_orm(obj: Any) → Model¶
classmethod from_texts(texts: ~typing.Iterable[str], metadatas: ~typing.Optional[~typing.Iterable[dict]] = None, bm25_params: ~typing.Optional[~typing.Dict[str, ~typing.Any]] = None, preprocess_func: ~typing.Callable[[str], ~typing.List[str]] = <function default_preprocessing_func>, **kwargs: ~typing.Any) → BM25Retriever[source]¶
Create a BM25Retriever from a list of texts.
:param texts: A list of texts to vectorize.
:param metadatas: A list of metadata dicts to associate with each text.
:param bm25_params: Parameters to pass to the BM25 vectorizer.
:param preprocess_func: A function to preprocess each text before vectorization.
:param **kwargs: Any other arguments to pass to the retriever.
Returns
A BM25Retriever instance.
get_relevant_documents(query: str, *, callbacks: Callbacks = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → List[Document]¶
Retrieve documents relevant to a query.
:param query: string to find relevant documents for
:param callbacks: Callback manager or list of callbacks
:param tags: 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.
Parameters