Rifqi Hafizuddin commited on
Commit ·
b59ef76
1
Parent(s): 0935ede
fix: increase K in chat endpoint to 10
Browse files- src/api/v1/chat.py +6 -2
src/api/v1/chat.py
CHANGED
|
@@ -189,9 +189,12 @@ async def chat_stream(request: ChatRequest, db: AsyncSession = Depends(get_db)):
|
|
| 189 |
sources: List[Dict[str, Any]] = []
|
| 190 |
|
| 191 |
if intent_result is None:
|
| 192 |
-
# Step 2: Launch retrieval and history loading in parallel, then run orchestrator
|
|
|
|
|
|
|
|
|
|
| 193 |
retrieval_task = asyncio.create_task(
|
| 194 |
-
retriever.retrieve(request.message, request.user_id, db)
|
| 195 |
)
|
| 196 |
history_task = asyncio.create_task(
|
| 197 |
load_history(db, request.room_id, limit=6) # 6 msgs (3 pairs) for orchestrator
|
|
@@ -219,6 +222,7 @@ async def chat_stream(request: ChatRequest, db: AsyncSession = Depends(get_db)):
|
|
| 219 |
query=search_query,
|
| 220 |
user_id=request.user_id,
|
| 221 |
db=db,
|
|
|
|
| 222 |
source_hint=intent_result.get("source_hint", "both"),
|
| 223 |
)
|
| 224 |
else:
|
|
|
|
| 189 |
sources: List[Dict[str, Any]] = []
|
| 190 |
|
| 191 |
if intent_result is None:
|
| 192 |
+
# Step 2: Launch retrieval and history loading in parallel, then run orchestrator.
|
| 193 |
+
# k=10 (not the wrapper default of 5) so the merged top-k spans more
|
| 194 |
+
# tables — db_executor's FK expansion is one-hop and cannot bridge
|
| 195 |
+
# 2-hop gaps (e.g. customers -> order_items -> products) on its own.
|
| 196 |
retrieval_task = asyncio.create_task(
|
| 197 |
+
retriever.retrieve(request.message, request.user_id, db, k=10)
|
| 198 |
)
|
| 199 |
history_task = asyncio.create_task(
|
| 200 |
load_history(db, request.room_id, limit=6) # 6 msgs (3 pairs) for orchestrator
|
|
|
|
| 222 |
query=search_query,
|
| 223 |
user_id=request.user_id,
|
| 224 |
db=db,
|
| 225 |
+
k=10,
|
| 226 |
source_hint=intent_result.get("source_hint", "both"),
|
| 227 |
)
|
| 228 |
else:
|