Skip to content

Commit 32bde47

Browse files
authored
fix: filter out documents with empty content in get_documents function (#99)
1 parent ee07e96 commit 32bde47

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

service/router.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ async def get_documents(
4141
*, vector_service: BaseVectorDatabase, payload: RequestPayload
4242
) -> list[BaseDocumentChunk]:
4343
chunks = await vector_service.query(input=payload.input, top_k=5)
44+
# filter out documents with empty content
45+
chunks = [chunk for chunk in chunks if chunk.content.strip()]
4446
if not len(chunks):
4547
logger.error(f"No documents found for query: {payload.input}")
4648
return []

0 commit comments

Comments
 (0)