litellm/tests/unit/llms/bedrock/batches
paveln83 85ba26ff5f
fix(batches): keep the endpoint a batch was created for on retrieve, cancel and cost polling (#50784)
* fix(batches): keep the endpoint a batch was created for on retrieve, cancel and cost polling

* test(batches): give poller test rows the stored batch every managed batch row carries

* fix(batches): set the created endpoint on the batch object the hook saves and the logger reads

Retrieve, cancel and the cost poller now write the endpoint saved at create time onto the
provider's batch object itself instead of a copy. The managed files hook persists that object
and swaps its raw provider id for the unified id in place, and the spend logger reads the same
object, so a copy either let the hook save the provider's endpoint back or kept the raw id on
the inline cost row.

* fix(bedrock): report the embeddings endpoint from the batch job's model

Bedrock's GetModelInvocationJob has no endpoint field, so a retrieve that
has no saved batch to read still answered /v1/chat/completions for an
embeddings job. The answer now follows the mode of the job's modelId.

* fix(bedrock): keep the embeddings endpoint when a batch deployment overrides the model's mode

A deployment with model_info.mode set to batch overwrites the shared
cost-map entry's mode, so the job's model no longer read as an embedding
model. An entry with an output vector size is now also read as one.

* fix(bedrock): correct a saved chat endpoint on embeddings batches and cover Cohere Embed v3

A Bedrock answer of /v1/embeddings now replaces a saved /v1/chat/completions, so a batch read before the upgrade or by an old pod during a rolling upgrade reports the right endpoint on its next provider sync. The two Cohere Embed v3 cost-map rows gain output_vector_size so they stay embeddings when a batch deployment overrides the model's mode

* test(batches): annotate the new endpoint test locals with Final

* ci: start the spend logs guard that never ran at the last tip

* test(batches): cover the empty endpoint branches and the embedding mode check of the endpoint fix

* test(batches): read the stored batch through the real database helper in the cancel endpoint test

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-24 05:42:08 -08:00
..
__init__.py
bedrock_batch_completions.jsonl test: move the unit half of 126 mixed legacy files into tests/unit (#45090) 2026-10-07 14:07:43 -07:00
test_batch_metadata_sanitization.py
test_handler.py fix(batches): keep the endpoint a batch was created for on retrieve, cancel and cost polling (#50784) 2026-11-24 05:42:08 -08:00
test_transformation.py fix(batches): keep the endpoint a batch was created for on retrieve, cancel and cost polling (#50784) 2026-11-24 05:42:08 -08:00