mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
test(rust): simplify Bedrock bridge e2e
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
083f243879
commit
37dc8cfcb3
2 changed files with 20 additions and 24 deletions
|
|
@ -0,0 +1,20 @@
|
|||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
import litellm
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bedrock_messages_with_rust() -> None:
|
||||
response = await litellm.anthropic.messages.acreate(
|
||||
model="bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
||||
messages=[{"role": "user", "content": "Say hello"}],
|
||||
max_tokens=20,
|
||||
api_key=os.getenv("AWS_BEARER_TOKEN_BEDROCK"),
|
||||
aws_region_name="us-west-2",
|
||||
rust=True,
|
||||
)
|
||||
|
||||
assert response["content"][0]["text"]
|
||||
assert response["_hidden_params"]["additional_headers"]["x-litellm-rust"] == "true"
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests for the optional Rust-backed Anthropic Messages path."""
|
||||
|
||||
import importlib
|
||||
import os
|
||||
from typing import cast
|
||||
|
||||
import httpx
|
||||
|
|
@ -123,29 +122,6 @@ def test_load_rust_messages_returns_injected_impl():
|
|||
assert rust_messages.load_rust_messages() is bridge
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bedrock_invoke_uses_native_rust_bridge():
|
||||
model = os.getenv(
|
||||
"BEDROCK_MODEL",
|
||||
"us.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
||||
)
|
||||
|
||||
response = await litellm.anthropic.messages.acreate(
|
||||
model=f"bedrock/{model}",
|
||||
messages=[{"role": "user", "content": "Reply with one word: hello"}],
|
||||
max_tokens=32,
|
||||
api_key=os.getenv("AWS_BEARER_TOKEN_BEDROCK"),
|
||||
aws_region_name=os.getenv("AWS_REGION_NAME", "us-west-2"),
|
||||
rust=True,
|
||||
)
|
||||
|
||||
assert response["type"] == "message"
|
||||
assert response["role"] == "assistant"
|
||||
assert response["content"][0]["type"] == "text"
|
||||
assert response["content"][0]["text"].strip()
|
||||
assert response["_hidden_params"]["additional_headers"]["x-litellm-rust"] == "true"
|
||||
|
||||
|
||||
def test_configuring_messages_does_not_enable_ocr():
|
||||
from litellm.rust_bridge.ocr import rust_ocr_enabled
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue