mirror of
https://github.com/FJurmanovic/sugarr.git
synced 2026-11-11 07:41:08 +00:00
The previous cached-tokens commit added cache_read_input_tokens (a flat-schema key) alongside prompt_tokens/completion_tokens (OpenAI's native schema) in the same usageDetails object. Langfuse's ingestion explicitly does not support mixing those two schemas, and doing so broke generation.update()'s output field - confirmed live: prompt/ response content was landing in the Usage panel instead of Input/ Output. Fixed by staying entirely within OpenAI's native schema: cached tokens now nest under prompt_tokens_details.cached_tokens instead of using the flat cache_read_input_tokens key. Cast past the installed @langfuse/tracing SDK's usageDetails type (which only exposes a 3-field camelCase shape with no _details nesting, unlike the wire schema in @langfuse/core) since the nesting is valid on the wire even though the SDK's public type doesn't model it. Verified: full suite (82/82) passing, tsc/eslint clean.