Skip to content

Streaming chunks have different IDs when they should have the same ID #144

@stephentoub

Description

@stephentoub

The OpenAI docs:
https://platform.openai.com/docs/api-reference/chat-streaming/streaming
state:

id
string
A unique identifier for the chat completion. Each chunk has the same ID.

Importantly, every chunk is supposed to have the same ID.

But the chunks coming back from foundry local have different IDs, e.g.

...
data: {"model":null,"choices":[{"delta":{"role":"assistant","content":",","name":null,"tool_call_id":null,"function_call":null,"tool_calls":[]},"message":{"role":"assistant","content":",","name":null,"tool_call_id":null,"function_call":null,"tool_calls":[]},"index":197,"finish_reason":null,"finish_details":null,"logprobs":null}],"usage":null,"system_fingerprint":null,"service_tier":null,"created":1749165718,"CreatedAt":"2025-06-05T23:21:58+00:00","id":"chat.id.4114","StreamEvent":null,"IsDelta":false,"Successful":true,"error":null,"HttpStatusCode":0,"HeaderValues":null,"object":"chat.completion.chunk"}

data: {"model":null,"choices":[{"delta":{"role":"assistant","content":" maybe","name":null,"tool_call_id":null,"function_call":null,"tool_calls":[]},"message":{"role":"assistant","content":" maybe","name":null,"tool_call_id":null,"function_call":null,"tool_calls":[]},"index":198,"finish_reason":null,"finish_details":null,"logprobs":null}],"usage":null,"system_fingerprint":null,"service_tier":null,"created":1749165718,"CreatedAt":"2025-06-05T23:21:58+00:00","id":"chat.id.4115","StreamEvent":null,"IsDelta":false,"Successful":true,"error":null,"HttpStatusCode":0,"HeaderValues":null,"object":"chat.completion.chunk"}

data: {"model":null,"choices":[{"delta":{"role":"assistant","content":" \u0022","name":null,"tool_call_id":null,"function_call":null,"tool_calls":[]},"message":{"role":"assistant","content":" \u0022","name":null,"tool_call_id":null,"function_call":null,"tool_calls":[]},"index":199,"finish_reason":"stop","finish_details":null,"logprobs":null}],"usage":null,"system_fingerprint":null,"service_tier":null,"created":1749165718,"CreatedAt":"2025-06-05T23:21:58+00:00","id":"chat.id.4116","StreamEvent":null,"IsDelta":false,"Successful":true,"error":null,"HttpStatusCode":0,"HeaderValues":null,"object":"chat.completion.chunk"}
...

Note the IDs:
"id":"chat.id.4114"
"id":"chat.id.4115"
"id":"chat.id.4116"

This breaks clients that try to group updates by completion id.

AB#66982

Metadata

Metadata

Assignees

Labels

ADObugSomething isn't workingpapercutThis issue relates to user experience papercut

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions