Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Azure OpenAI Completions API - Prompt annotations cause NULL reference exception #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
desmondpp opened this issue Jun 12, 2025 · 0 comments · Fixed by #93
Closed

Azure OpenAI Completions API - Prompt annotations cause NULL reference exception #92

desmondpp opened this issue Jun 12, 2025 · 0 comments · Fixed by #93
Labels
bug Something isn't working package:agents-openai

Comments

@desmondpp
Copy link

Describe the bug

When streaming an agent response using the completions API with an Azure OpenAI endpoint, prompt annotations are returned from the model where the choices propery is []. The following code does not adequately handle a choices property that exists, but contains no elements:

        if (!chunk.choices || !chunk.choices[0].delta)
            continue;

This results in a Cannot read properties of undefined (reading 'delta') error.

Debug information

  • Agents SDK version: (e.g. v0.0.7)
  • Runtime environment (e.g. Node.js 22.16.0)

Repro steps

Use an Azure OpenAI endpoint with any prompt and the following set:

setOpenAIAPI('chat_completions');
const stream = await runner.run(agent, messages, {
      stream: true,
    });

Expected behavior

At a minimum, the prompt annotations should be ignored and the streamed chat completion should resume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:agents-openai
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants