Open
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
Typescript complains about streamed events from the responses API with type response.output_text.annotation.added
using SDK 4.103.0. There is no issue in 4.102.0 and earlier.
> tsc
src/index.ts:18:10 - error TS2678: Type '"response.output_text.annotation.added"' is not comparable to type '"response.audio.delta" | "response.audio.done" | "response.audio.transcript.delta" | "response.audio.transcript.done" | "response.code_interpreter_call.code.delta" | ... 47 more ... | "response.reasoning_summary.done"'.
18 case 'response.output_text.annotation.added':
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in src/index.ts:18
To Reproduce
- Make a streaming request using the responses API.
- Iterate over the events in the response stream.
- Attempt to use
'response.output_text.annotation.added'
withevent.type
. - Observe typescript error.
Code snippets
// simple program to reproduce
import { OpenAI } from 'openai';
async function main() {
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const response = await openai.responses.create({
model: "gpt-4.1",
input: "Why is the sky blue?",
stream: true,
});
for await (const event of response) {
switch (event.type) {
case 'response.output_text.annotation.added': // this fails to compile in v4.103.0
break;
}
}
}
main();
OS
macOS
Node version
Node v22.12.0
Library version
openai v4.103.0