Skip to content

FunctionSchema has no strict field — OpenAI Responses tools always send strict: null #5604

Description

@mannyb223

Description

pipecat.adapters.schemas.function_schema.FunctionSchema has no way to opt a tool into OpenAI's
strict function-calling mode (JSON-schema-guaranteed argument validation, which OpenAI's own
docs recommend enabling by default). This applies to both hand-written FunctionSchema tools and
direct functions (DirectFunctionWrapper.to_function_schema()), since both build the same
schema shape with no strict concept.

open_ai_responses_adapter.py's to_provider_tools_format reads a "strict" key off the dict
produced by FunctionSchema.to_default_dict():

tool: FunctionToolParam = {
    "type": "function",
    "name": d["name"],
    "parameters": d.get("parameters", {}),
    "strict": d.get("strict", None),
}

But to_default_dict() never sets that key, so every Responses-API tool ships with an explicit
"strict": null, never true, and there is no FunctionSchema constructor argument, decorator,
or ToolsSchema option to change that. (open_ai_adapter.py, the Chat Completions path, doesn't
even read/forward a strict key at all.)

The only existing workaround is ToolsSchema.custom_tools[AdapterType.OPENAI], which requires
hand-writing the full raw OpenAI tool dict (bypassing FunctionSchema entirely, and losing its
handler auto-registration) — that's documented as the escape hatch for provider-native tools that
don't fit the standard schema, not a way to add strict: true to an otherwise-standard tool.

Repro (stock pipecat, no custom code beyond this)

from pipecat.adapters.schemas.function_schema import FunctionSchema
from pipecat.adapters.schemas.tools_schema import ToolsSchema
from pipecat.adapters.services.open_ai_responses_adapter import OpenAIResponsesLLMAdapter

weather_function = FunctionSchema(
    name="get_weather",
    description="Get the weather for a location.",
    properties={"location": {"type": "string"}},
    required=["location"],
)
tools_schema = ToolsSchema(standard_tools=[weather_function])

adapter = OpenAIResponsesLLMAdapter()
tools = adapter.to_provider_tools_format(tools_schema)
print(tools[0]["strict"])  # -> None, not True

Expected

Some way to request strict: true (and get additionalProperties: false emitted) directly from
FunctionSchema/direct functions — e.g. a strict: bool = False constructor arg on
FunctionSchema that flows through to_default_dict() into both the Responses and Chat
Completions adapters, defaulting to False for backward compatibility.

Actual

strict is always null/absent regardless of the tool's schema shape, with no supported way to
change it short of bypassing FunctionSchema via custom_tools.

Environment

pipecat 1.8.1, openai Python SDK 2.54.0, OpenAI Responses API.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions