Skip to content

Conversation

@gilbertl
Copy link
Contributor

When using OpenAI, assisnt reply tool-call like so

{
  "role": "assistant",
  "content": null,
  "tool_calls": [...]
}

When dealing with images, Azure OpenAI chat completions endpoint return an empty string instead of null

(example)

{
  "role": "assistant",
  "content": "",
  "tool_calls": [
    {
      "id": "call_RoAWzCh7KdKkR3LhmA9H0hqN",
      "type": "function",
      "function": {
        "name": "verify_invoice_number",
        "arguments": "{\"query\":\"74012938475019283746502391\"}"
      }
    }
  ]
}

Because the parser rejects this shape, the SDK:

  1. treats the message as an ordinary assistant response,
  2. never invokes the tool’s execute() handler,
  3. asks the model to “try again,” and
  4. eventually throws “Max turns (N) exceeded.”

Reproduction steps

  1. Create any agent with a simple tool (e.g., check_image_color).2
  2. set OpenAI client but with Azure as the endpoint
  3. Call await run(agent, [{ role: "user", content: }])

@seratch seratch added enhancement New feature or request needs-more-info labels Jul 14, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jul 14, 2025

⚠️ No Changeset found

Latest commit: 1de4760

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@gilbertl
Copy link
Contributor Author

i noticed the change caused a test failure. Made a new commit and now the test suite passes.

@dkundel-openai dkundel-openai merged commit fe5fb97 into openai:main Jul 15, 2025
5 checks passed
seratch pushed a commit to seratch/openai-agents-js that referenced this pull request Jul 16, 2025
* Handle function call messages with empty content

* Resolve test failure

* Create heavy-yaks-mate.md

---------

Co-authored-by: Dominik Kundel <[email protected]>
@mhashas mhashas mentioned this pull request Jul 16, 2025
vrtnis pushed a commit to vrtnis/openai-agents-js that referenced this pull request Jul 25, 2025
* Handle function call messages with empty content

* Resolve test failure

* Create heavy-yaks-mate.md

---------

Co-authored-by: Dominik Kundel <[email protected]>
vrtnis pushed a commit to vrtnis/openai-agents-js that referenced this pull request Jul 28, 2025
* Handle function call messages with empty content

* Resolve test failure

* Create heavy-yaks-mate.md

---------

Co-authored-by: Dominik Kundel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs-more-info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants