microsoft / microsoft/agent-framework

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

Open
#7,922 5 comments 0 reactions 1 assignee Claimed by @eavanvalkenburg View on GitHub
agents python
Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
2d 45m
Merged PRs (30d)
358

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.