mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 20:07:49 +01:00
fix: hybrid search
This commit is contained in:
@@ -90,6 +90,19 @@ class VectorSearchRetriever(BaseRetriever):
|
|||||||
embedding_function: Any
|
embedding_function: Any
|
||||||
top_k: int
|
top_k: int
|
||||||
|
|
||||||
|
def _get_relevant_documents(
|
||||||
|
self, query: str, *, run_manager: CallbackManagerForRetrieverRun
|
||||||
|
) -> list[Document]:
|
||||||
|
"""Get documents relevant to a query.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
query: String to find relevant documents for.
|
||||||
|
run_manager: The callback handler to use.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
List of relevant documents.
|
||||||
|
"""
|
||||||
|
|
||||||
async def _aget_relevant_documents(
|
async def _aget_relevant_documents(
|
||||||
self,
|
self,
|
||||||
query: str,
|
query: str,
|
||||||
@@ -1231,6 +1244,24 @@ class RerankCompressor(BaseDocumentCompressor):
|
|||||||
extra = "forbid"
|
extra = "forbid"
|
||||||
arbitrary_types_allowed = True
|
arbitrary_types_allowed = True
|
||||||
|
|
||||||
|
def compress_documents(
|
||||||
|
self,
|
||||||
|
documents: Sequence[Document],
|
||||||
|
query: str,
|
||||||
|
callbacks: Optional[Callbacks] = None,
|
||||||
|
) -> Sequence[Document]:
|
||||||
|
"""Compress retrieved documents given the query context.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
documents: The retrieved documents.
|
||||||
|
query: The query context.
|
||||||
|
callbacks: Optional callbacks to run during compression.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The compressed documents.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
async def acompress_documents(
|
async def acompress_documents(
|
||||||
self,
|
self,
|
||||||
documents: Sequence[Document],
|
documents: Sequence[Document],
|
||||||
|
|||||||
Reference in New Issue
Block a user