mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
fix: count image tokens in Titan embed response (fixes #25857)
Signed-off-by: Yiyang Liu <37043548+ianliuy@users.noreply.github.com>
This commit is contained in:
parent
c0fc4c4234
commit
eff7a9931c
2 changed files with 4 additions and 2 deletions
|
|
@ -93,9 +93,9 @@ class AmazonTitanMultimodalEmbeddingG1Config:
|
|||
)
|
||||
|
||||
usage = Usage(
|
||||
prompt_tokens=total_prompt_tokens,
|
||||
prompt_tokens=total_prompt_tokens + image_count,
|
||||
completion_tokens=0,
|
||||
total_tokens=total_prompt_tokens,
|
||||
total_tokens=total_prompt_tokens + image_count,
|
||||
prompt_tokens_details=prompt_tokens_details,
|
||||
)
|
||||
return EmbeddingResponse(model=model, usage=usage, data=transformed_responses)
|
||||
|
|
|
|||
|
|
@ -863,6 +863,8 @@ def test_titan_multimodal_embedding_image_cost_tracking():
|
|||
)
|
||||
|
||||
assert result.usage is not None
|
||||
assert result.usage.prompt_tokens == 1 # image_count included in prompt_tokens
|
||||
assert result.usage.total_tokens == 1
|
||||
assert result.usage.prompt_tokens_details is not None
|
||||
assert result.usage.prompt_tokens_details.image_count == 1
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue