mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(utils.py): fix anthropic streaming return usage tokens
This commit is contained in:
parent
495aebb582
commit
dacadbf624
1 changed files with 1 additions and 0 deletions
|
@ -9758,6 +9758,7 @@ class CustomStreamWrapper:
|
||||||
if response_obj is None:
|
if response_obj is None:
|
||||||
return
|
return
|
||||||
completion_obj["content"] = response_obj["text"]
|
completion_obj["content"] = response_obj["text"]
|
||||||
|
setattr(model_response, "usage", Usage())
|
||||||
if response_obj.get("prompt_tokens", None) is not None:
|
if response_obj.get("prompt_tokens", None) is not None:
|
||||||
model_response.usage.prompt_tokens = response_obj[
|
model_response.usage.prompt_tokens = response_obj[
|
||||||
"prompt_tokens"
|
"prompt_tokens"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue