mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-20 02:18:38 +00:00
* update bedrock models in tests * updated more tests and model_prices_and_context_window * fix model id and pricing * replace more sonnet models * update tests * git push * update pricing * flaky total cost * monkey patch * relax the cost change * fix and revert some changes * revert the pricing * chore: move cost/pricing changes to bedrock-cost-fixes branch * chore: split Bedrock file-api beta stripping to separate branch Removes strip_unsupported_file_api_betas_for_bedrock_invoke from this branch; see litellm_bedrock_invoke_strip_file_api_betas for that fix. Made-with: Cursor
37 lines
915 B
Python
37 lines
915 B
Python
from openai import OpenAI
|
|
import pytest
|
|
|
|
client = OpenAI(
|
|
base_url="http://0.0.0.0:4000",
|
|
api_key="sk-1234",
|
|
)
|
|
|
|
|
|
BEDROCK_BATCH_MODEL = "bedrock/batch-us.anthropic.claude-haiku-4-5-20251001-v1:0"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_bedrock_batches_api():
|
|
"""
|
|
Test bedrock batches api
|
|
|
|
E2E Test Creating a File and a Batch on Bedrock
|
|
"""
|
|
# Upload file
|
|
batch_input_file = client.files.create(
|
|
file=open("tests/openai_endpoints_tests/bedrock_batch_completions.jsonl", "rb"),
|
|
purpose="batch",
|
|
extra_body={"target_model_names": BEDROCK_BATCH_MODEL}
|
|
)
|
|
print(batch_input_file)
|
|
|
|
# Create batch
|
|
batch = client.batches.create(
|
|
input_file_id=batch_input_file.id,
|
|
endpoint="/v1/chat/completions",
|
|
completion_window="24h",
|
|
metadata={"description": "Test batch job"},
|
|
)
|
|
print(batch)
|
|
|
|
assert batch.id is not None |