Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Openai Openai python Response File Search Tool Call

From Leeroopedia
Knowledge Sources
Domains API_Types, Responses_API
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete response type representing the results of a file search tool call, provided by the openai-python SDK.

Description

ResponseFileSearchToolCall is a Pydantic model representing the results of a file search tool call. It contains the call id, a list of queries used for searching, a status field (one of "in_progress", "searching", "completed", "incomplete", or "failed"), a fixed type of "file_search_call", and an optional results list. Each Result object contains optional fields for attributes (metadata key-value pairs), file_id, filename, score (relevance between 0 and 1), and text (the retrieved content). This type is auto-generated from the OpenAI OpenAPI specification by Stainless.

Usage

Import ResponseFileSearchToolCall when processing Responses API output items that contain file search results and you need to access the matched documents and their relevance scores.

Code Reference

Source Location

Signature

class ResponseFileSearchToolCall(BaseModel):
    """The results of a file search tool call."""

    id: str
    queries: List[str]
    status: Literal["in_progress", "searching", "completed", "incomplete", "failed"]
    type: Literal["file_search_call"]
    results: Optional[List[Result]] = None

Import

from openai.types.responses import ResponseFileSearchToolCall

I/O Contract

Fields

Name Type Required Description
id str Yes The unique ID of the file search tool call.
queries List[str] Yes The queries used to search for files.
status Literal["in_progress", "searching", "completed", "incomplete", "failed"] Yes The status of the file search tool call.
type Literal["file_search_call"] Yes The type of the tool call. Always "file_search_call".
results Optional[List[Result]] No The results of the file search tool call.

Result Sub-Type

Name Type Required Description
attributes Optional[Dict[str, Union[str, float, bool]]] No Up to 16 key-value pairs of metadata attached to the object.
file_id Optional[str] No The unique ID of the file.
filename Optional[str] No The name of the file.
score Optional[float] No The relevance score (0 to 1).
text Optional[str] No The text retrieved from the file.

Usage Examples

from openai.types.responses import ResponseFileSearchToolCall

# Process file search results from response output
for item in response.output:
    if isinstance(item, ResponseFileSearchToolCall):
        print(f"File search queries: {item.queries}")
        print(f"Status: {item.status}")
        if item.results:
            for result in item.results:
                print(f"  File: {result.filename} (score: {result.score})")
                print(f"  Text: {result.text[:200]}...")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment