https://www.boundaryml.com logo
Accessing cache_read_input_tokens and cache_creati...
# help
a
I see in the [docs](https://docs.boundaryml.com/guide/baml-advanced/collector-track-tokens#best-practices) that it mentions HTTP response will be null for streaming responses, but normally this is how I would access cache_read_input_tokens and cache_creation_input_tokens for Claude models, so how am I supposed to access it for a streamed response? Collector usage is available, but I need the input token cache read/write info. Using Bedrock provider, Anthropic provider as fallback.
I notice
collector.usage.cachedInputTokens
is available, however it always seems to be
null
b
Hm... I'm not sure if we expose this through the collector today.
Digging into the code
Ah, we never documented this... that's our mistake
I've also gone ahead and filed https://github.com/BoundaryML/baml/issues/2780 for this
a
we likely missed adding this on the Anthropic streaming API, will see if i can get it patched next release
a
Appreciate it. I believe I checked the SSE responses when I was trying to find a workaround and I think it was empty?
a
yeah we may not have populated the collector for Anthropic yet on streams, ty for the report
ok i think i found the bug here
and now we have sse responses
wait, is this anthropic on vertex, or anthropic raw api? @Anders
fix will go out 0.215.0 next week
a
This was anthropic anthropic and bedrock anthropic