Open markpollack opened 1 month ago
OpenAI has a nested audio_tokens usage field in both the prompt_tokens_details and completion_tokens_details so we can't just add them all as key value pairs unless key is prefixed or similar.
The prompt_tokens_details
and completion_tokens_details.audio_tokens
components are being introduced in this PR: https://github.com/spring-projects/spring-ai/issues/1560 I haven't propagated them up due to the challenges covered in this issue.
Having reasoning_tokens
at the top level makes it challenging to support the other fields, especially audio_tokens
which is present both for prompt and completion.
OpenAI added a new usage field,
this should be made available in some way via the
org.springframework.ai.chat.metadata.Usage interface
See https://github.com/spring-projects/spring-ai/pull/1394