OpenAI File Search Score Thresholds Need Measured Policy
OpenAI Responses accepts ranking_options.score_threshold for file search as a number between 0 and 1. Higher values attempt to return more relevant results and can return fewer of them. Production routes should set the threshold from measured retrieval tests, bind it to the ranker and corpus revision, reject caller relaxation, and record both the enforced threshold and observed result scores.

OpenAI Responses accepts ranking_options.score_threshold inside a file_search tool definition. The current reference defines a value between 0 and 1 and says numbers closer to 1 attempt to return only the most relevant results, with fewer results possible. That field deserves route policy. A support route with a permissive floor and a claims route with a strict floor are making different evidence-admission decisions before the model writes a word.
TL;DR
- Set
ranking_options.score_thresholdfrom evaluated route policy within OpenAI's documented 0 through 1 range. - Block callers from lowering the threshold below the approved value unless a reviewed route explicitly permits it.
- Bind test results to the ranker and vector store revision. Bind them to the filters and model. Record the result cap because it also shapes the observed retrieval set.
- Retain the enforced threshold and returned scores in protected request evidence. Retain the file IDs and route there too. Keep the policy version with that record.
The threshold filters retrieval candidates
The current Responses create reference describes score_threshold as a file search ranking option between 0 and 1. Values closer to 1 attempt to return only more relevant results and may return fewer results. The same tool definition accepts a ranker plus max_num_results.
A threshold is an admission boundary for retrieved chunks. Raising it can remove weak matches that would otherwise enter model context. It can also remove the only passage that answers an unusual but legitimate question. Lowering it increases the chance that marginal material reaches the model. OpenAI supplies the score and applies the configured field. Your application decides which score floor is acceptable for an authenticated route.
The number carries no universal business meaning by itself. A threshold selected against one vector store and query set should stay attached to that tested configuration. Copying one threshold across unrelated corpora creates the appearance of precision without the evidence behind it.
Calibrate against positive and negative queries
Build a route evaluation set with known-answer queries, paraphrases, short ambiguous prompts, misspellings, cross-document questions, and questions the corpus cannot answer. Include protected edge cases such as a superseded procedure that should lose to the current version. Run those cases through the intended vector store and metadata filters. Use the intended ranker and result cap.
OpenAI's retrieval guide says a higher threshold limits results to more relevant chunks while potentially excluding useful ones. Use that tradeoff to plot supported-answer coverage against irrelevant-result admission. Pick a threshold after the route owner defines acceptable misses and false admissions.
I would reject any production threshold chosen from three hand-written prompts in a developer console. A clean screenshot with three green answers proves very little. The useful artifact is a versioned evaluation report containing the query set and corpus revision. It should include returned chunk IDs and scores, plus expected support and reviewed failures.
Re-run calibration after changes to files, chunking, filters, ranker, model, or retrieval instructions.
Route policy should prevent threshold drift
Resolve identity, tenant, application route, and vector store entitlement before compiling the file search tool. The caller may request a stricter threshold if route policy permits narrowing. A caller-supplied value below the approved floor expands eligible evidence and should be rejected before provider dispatch.
Validate JSON types as well as range. Reject a numeric string, null where an explicit value is required, a negative number, a value above 1, and duplicate ranking_options created by unsafe object merging. Send the canonical number produced by policy instead of forwarding unchecked caller JSON.
The pattern matches LLM API parameter allowlisting. Keep the threshold beside the route's approved vector store IDs, metadata-filter template, ranker choice, and result cap. A policy revision should name the evaluation that justified the change.
My preferred failure is a red route rejection naming the expected floor and policy version. Quiet coercion conceals client defects and makes two visually identical requests behave differently.
Scores need protected observability
File search results are absent from a Responses result by default. OpenAI documents file_search_call.results as an include value for retrieving them. Enable it in evaluation and controlled diagnostics. Also enable it on routes where result-level evidence is required. Avoid copying retrieved customer text into a broad application log.
A useful record contains the authenticated identity context supplied by the application, route, policy version, vector store IDs, metadata-filter digest, requested threshold, enforced threshold, ranker, result cap, returned scores, file IDs, model, and provider response ID. Retain text under a separate content policy or store protected digests and an access-controlled pointer.
The AI audit log schema can carry the decision fields and correlation identifiers. Keep the provider's retrieval score labeled as a provider result rather than presenting it as an application authorization score. The application still owns data access and tenant eligibility. It also owns the decision to accept an answer downstream.
A score histogram on a dark dashboard can reveal a corpus shift immediately. Yesterday's accepted results occupied the upper band, while today's sit just above the configured floor. Investigate the corpus revision, filters, and ranker, because the histogram alone cannot identify which change caused the shift.
Thresholds interact with caps and filters
A threshold decides which scored results qualify. max_num_results limits how many results can be returned. Metadata filters restrict the candidate set by attributes. Each control answers a different question, and the final retrieval set reflects their combination.
OpenAI's vector store search reference documents a default score threshold of 0 for the direct search endpoint, along with returned scores between 0 and 1. That endpoint is useful for retrieval evaluation, but its request shape and defaults should not be assumed to replace the Responses file search contract. Record which API surface generated each score sample.
Test combinations rather than isolated fields. Use a strict threshold with low and high caps, then repeat with the production metadata filter. Add an empty-result case and confirm the application declines to invent an answer when the route requires retrieved support. The per-route policy model gives those combinations a named owner and change history.
DeepInspect
DeepInspect can enforce an OpenAI file search score threshold when authenticated user or agent traffic is deliberately routed through its HTTP proxy. A per-route policy can validate the 0 through 1 value, reject an unapproved lower floor, constrain related retrieval fields, and write a per-decision record before the Responses request reaches OpenAI.
The application owns corpus construction, file authorization, evaluation sets, ranker approval, and handling for unsupported answers. Indexing, local retrieval, direct provider calls, and traffic that bypasses the proxy remain outside this boundary.
Book a demo today.
Frequently asked questions
- What values can score_threshold accept?
The current Responses create reference documents a number between 0 and 1. Values closer to 1 attempt to return more relevant file search results and can yield fewer results. Validate the type and range at the authenticated HTTP boundary before forwarding the request.
- Is a higher threshold always safer?
A higher value can exclude weak matches, and it can also exclude a useful passage. Safety comes from a tested route contract that handles unsupported answers, enforces file access separately, and detects retrieval regressions. The largest possible number is not a substitute for evaluation.
- Can users lower the threshold for a hard question?
Only under an explicit route policy. Lowering the floor expands the chunks eligible to enter model context. A production client should reject unapproved relaxation or send the question through a separately reviewed fallback route with its own evidence record.
- Should score_threshold be logged with the answer?
Record the requested and enforced values with route, policy version, ranker, result cap, vector store IDs, and provider response ID. Returned scores and file IDs improve diagnosis. Retrieved text needs stricter retention because it may contain protected customer material.