Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions backend/app/crud/evaluations/fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,13 @@ def run_response_chunk(
)

# Ask OpenAI to return the file_search hits so knowledge_base can judge them.
# tool_choice stays at the model default (auto) — consistent with normal calls;
# a row where the model doesn't query the KB is scored N/A, not forced to search.
# tool_choice is forced rather than left at auto: a model that declines to search
# (gpt-4.1 usually does) returns no chunks, which drops the knowledge_base metric
# for every row and leaves the score blank run-wide. Forcing the call makes the
# metric measure groundedness given retrieval, not eagerness to retrieve.
if any(t.get("type") == "file_search" for t in base_params.get("tools", [])):
base_params["include"] = ["file_search_call.results"]
base_params["tool_choice"] = "required"

results: list[dict[str, Any]] = []
max_workers = max(
Expand Down
Loading