From e2bac92959f061482622947fa57738d6eaf11397 Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Thu, 5 Mar 2026 15:06:49 +0200 Subject: [PATCH] fix: increase RAG search top_k from 3 to 10 With only 3 results, passport queries often miss family members since all passport files have similar low relevance scores. Increasing to 10 ensures all related documents are included in LLM context. Co-Authored-By: Claude Opus 4.6 --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 96a65ba..a45a4b2 100644 --- a/bot.py +++ b/bot.py @@ -336,7 +336,7 @@ class DocumentRAG: self.use_local_rag = bool(self.rag_endpoint) self.enabled = bool(self.rag_endpoint) or bool(portal_url and bot_api_key) - async def search(self, query: str, top_k: int = 3, api_key: str | None = None, org_slug: str | None = None, matrix_user_id: str | None = None) -> list[dict]: + async def search(self, query: str, top_k: int = 10, api_key: str | None = None, org_slug: str | None = None, matrix_user_id: str | None = None) -> list[dict]: if not self.enabled or not matrix_user_id: return []