[Pooling] Fix Cohere embed billed image token accounting for mixed-content inputs (#46093)
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
d3130d878c
commit
6f3da461d1
@@ -188,7 +188,12 @@ class ServingEmbedding(PoolingServing):
|
||||
]
|
||||
total_tokens = get_pooling_usage(ctx.final_res_batch).prompt_tokens
|
||||
|
||||
image_tokens = total_tokens if request.images is not None else 0
|
||||
has_image_input = request.images is not None or any(
|
||||
content.type == "image_url"
|
||||
for input_item in request.inputs or []
|
||||
for content in input_item.content
|
||||
)
|
||||
image_tokens = total_tokens if has_image_input else 0
|
||||
texts_echo = request.texts
|
||||
|
||||
embedding_types = request.embedding_types or ["float"]
|
||||
|
||||
Reference in New Issue
Block a user