Add project-aware boost to raw query
This commit is contained in:
@@ -88,6 +88,7 @@ class QueryRequest(BaseModel):
|
||||
prompt: str
|
||||
top_k: int = 10
|
||||
filter_tags: list[str] | None = None
|
||||
project: str | None = None
|
||||
|
||||
|
||||
class QueryResponse(BaseModel):
|
||||
@@ -258,7 +259,12 @@ def api_refresh_project(project_name: str, purge_deleted: bool = False) -> Proje
|
||||
def api_query(req: QueryRequest) -> QueryResponse:
|
||||
"""Retrieve relevant chunks for a prompt."""
|
||||
try:
|
||||
chunks = retrieve(req.prompt, top_k=req.top_k, filter_tags=req.filter_tags)
|
||||
chunks = retrieve(
|
||||
req.prompt,
|
||||
top_k=req.top_k,
|
||||
filter_tags=req.filter_tags,
|
||||
project_hint=req.project,
|
||||
)
|
||||
except Exception as e:
|
||||
log.error("query_failed", prompt=req.prompt[:100], error=str(e))
|
||||
raise HTTPException(status_code=500, detail=f"Query failed: {e}")
|
||||
|
||||
Reference in New Issue
Block a user