mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
test(vertex): cover malformed batch usage details
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
168d0d3d99
commit
7761d04450
1 changed files with 17 additions and 1 deletions
|
|
@ -17,9 +17,9 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
|
||||
from litellm.llms.vertex_ai.batches.transformation import ( # noqa: E402
|
||||
VertexAIBatchTransformation,
|
||||
vertex_prompt_tokens_details,
|
||||
)
|
||||
from litellm.llms.vertex_ai.common_utils import ( # noqa: E402
|
||||
VertexAIError,
|
||||
|
|
@ -41,6 +41,22 @@ ENDPOINT_INPUT_FILE = (
|
|||
)
|
||||
|
||||
|
||||
def test_vertex_prompt_tokens_details_rejects_malformed_details():
|
||||
assert vertex_prompt_tokens_details({"promptTokensDetails": [1]}) is None
|
||||
assert vertex_prompt_tokens_details({"promptTokensDetails": [{"modality": "AUDIO"}]}) is None
|
||||
assert (
|
||||
vertex_prompt_tokens_details(
|
||||
{
|
||||
"promptTokensDetails": [
|
||||
{"modality": "AUDIO", "tokenCount": 1},
|
||||
"malformed",
|
||||
]
|
||||
}
|
||||
)
|
||||
is None
|
||||
)
|
||||
|
||||
|
||||
# =========================================================================== #
|
||||
# transform_openai_batch_request_to_vertex_ai_batch_request
|
||||
# =========================================================================== #
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue