You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using agent-workflow with Anthropic and stream = true, the usage info is filtered out from the chunk.
The usage info is of type "message-delta", and the chunk is not yielded in the code below:
1. Anthropic (Streaming)
When using agent-workflow with Anthropic and
stream = true, the usage info is filtered out from the chunk.The usage info is of type
"message-delta", and the chunk is not yielded in the code below:🔗 LlamaIndexTS Anthropic LLM Code
Example payload:
{ "type": "message_delta", "delta": { "stop_reason": "end_turn", "stop_sequence": null }, "usage": { "input_tokens": 8, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0, "output_tokens": 12 } }2. Anthropic and OpenAI (Non-Streaming)
When running with
agent.run, it is returning the finalEvent.However, the
finalEventdoes not have usage info applicable.https://github.com/run-llama/LlamaIndexTS/blob/main/packages/workflow/src/agent/agent-workflow.ts#L470-L476