[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>
Taneem Ibrahim committed
Jun 25, 2026 at 10:44 UTC
6f3da461d17e168539e99f925c0620db64eb011b
1 file changed
+6
-1
vllm/entrypoints/pooling/embed/serving.py
+6
-1
@@ -188,7 +188,12 @@ class ServingEmbedding(PoolingServing):
188
]
189
total_tokens = get_pooling_usage(ctx.final_res_batch).prompt_tokens
190
191
- image_tokens = total_tokens if request.images is not None else 0
191
+ has_image_input = request.images is not None or any(
192
+ content.type == "image_url"
193
+ for input_item in request.inputs or []
194
+ for content in input_item.content
195
+ )
196
+ image_tokens = total_tokens if has_image_input else 0
197
texts_echo = request.texts
198
199
embedding_types = request.embedding_types or ["float"]