diff --git a/service/router.py b/service/router.py index da3a5139..9b840fce 100644 --- a/service/router.py +++ b/service/router.py @@ -41,6 +41,8 @@ async def get_documents( *, vector_service: BaseVectorDatabase, payload: RequestPayload ) -> list[BaseDocumentChunk]: chunks = await vector_service.query(input=payload.input, top_k=5) + # filter out documents with empty content + chunks = [chunk for chunk in chunks if chunk.content.strip()] if not len(chunks): logger.error(f"No documents found for query: {payload.input}") return []