SetChatTokeUsage should only run when then response is not streamed in OpenAiBasedProviderClientBase

Created on 9 September 2025, about 2 months ago

Problem/Motivation

Currently the SetChatTokeUsage is run, even when the response is of streamed type. Since the stream will not give back token usage, until the last chunk, this will:

a. fail, currently, because missing array structure
b. not set any tokens, since this is set after the stream is consumed

Steps to reproduce (required for bugs, but not feature requests)

Try to stream any provider that is based on it.

Proposed resolution

Fix so that SetChatTokenUsage only runs on none-streamed responses.

🐛 Bug report
Status

Active

Version

1.2

Component

AI Core module

Created by

🇩🇪Germany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024