[PR #15523] docs: add missing usage fields to ChatStreamEvent in OpenAPI spec #77479

Open
opened 2026-05-05 10:08:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15523
Author: @samrusani
Created: 4/12/2026
Status: 🔄 Open

Base: mainHead: docs/fix-chat-stream-event-schema


📝 Commits (1)

  • e5a6cfc docs: add missing usage fields to ChatStreamEvent in OpenAPI spec

📊 Changes

1 file changed (+21 additions, -0 deletions)

View changed files

📝 docs/openapi.yaml (+21 -0)

📄 Description

Summary

  • Adds the missing done_reason, total_duration, load_duration, prompt_eval_count, prompt_eval_duration, eval_count, and eval_duration fields to the ChatStreamEvent schema in docs/openapi.yaml
  • These fields are returned by the API in the final streaming chunk (when done: true) but were not documented in the schema
  • Aligns ChatStreamEvent with GenerateStreamEvent and ChatResponse, which already include these fields

Fixes #14680

Verification

Confirmed the Go source (api/types.go) uses a single ChatResponse struct (which embeds Metrics) for both streaming and non-streaming chat responses, so these fields are indeed sent in the final stream event.

Schema Has usage fields?
GenerateResponse
GenerateStreamEvent
ChatResponse
ChatStreamEvent (this PR)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15523 **Author:** [@samrusani](https://github.com/samrusani) **Created:** 4/12/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `docs/fix-chat-stream-event-schema` --- ### 📝 Commits (1) - [`e5a6cfc`](https://github.com/ollama/ollama/commit/e5a6cfc9992489b9028bb621989e97618c0a20a3) docs: add missing usage fields to ChatStreamEvent in OpenAPI spec ### 📊 Changes **1 file changed** (+21 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/openapi.yaml` (+21 -0) </details> ### 📄 Description ## Summary - Adds the missing `done_reason`, `total_duration`, `load_duration`, `prompt_eval_count`, `prompt_eval_duration`, `eval_count`, and `eval_duration` fields to the `ChatStreamEvent` schema in `docs/openapi.yaml` - These fields are returned by the API in the final streaming chunk (when `done: true`) but were not documented in the schema - Aligns `ChatStreamEvent` with `GenerateStreamEvent` and `ChatResponse`, which already include these fields Fixes #14680 ## Verification Confirmed the Go source (`api/types.go`) uses a single `ChatResponse` struct (which embeds `Metrics`) for both streaming and non-streaming chat responses, so these fields are indeed sent in the final stream event. | Schema | Has usage fields? | |---|---| | `GenerateResponse` | ✅ | | `GenerateStreamEvent` | ✅ | | `ChatResponse` | ✅ | | `ChatStreamEvent` | ✅ (this PR) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 10:08:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#77479