Skip to content

Python: [Bug]: OpenAI RAPI no longer requires the call id on a function call result #7922

Description

@TaoChenOSU

Description

As described in the title: https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(method)%20create%20%3E%20(params)%200.non_streaming%20%3E%20(param)%20input%20%3E%20(schema)%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%208%20%3E%20(property)%20call_id

Our OpenAI integration still requires a call_id on the function result content:

@classmethod
    def from_function_result(
        cls: type[ContentT],
        call_id: str,
        *,
        result: Any = None,
        exception: str | None = None,
        annotations: Sequence[Annotation] | None = None,
        additional_properties: MutableMapping[str, Any] | None = None,
        raw_representation: Any = None,
    ) -> ContentT:

And our OpenAI integration drops function result contents that don't have a call id:

case "function_call":
      if not content.call_id:
          logger.warning(f"FunctionCallContent missing call_id for function '{content.name}'")
          return {}

Code Sample

This hasn't triggered any issue yeah but translating the function result contents between OpenAI spec compatible SDKs and MAF content type is awkward. The following code will raise a Pylance warning:

Content.from_function_result(item.get("call_id"), result=output)
"""
Argument of type "str | None" cannot be assigned to parameter "call_id" of type "str" in function "from_function_result"
  Type "str | None" is not assignable to type "str"
    "None" is not assignable to "str"
"""

Package Versions

agent-framework-core, agent-framework-openai

Additional Context

We need to check what the services actually expects.

Activity

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

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: Python

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions