Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(bedrock): build response field paths as an immutable sequence to satisfy the type discipline gate

Devin AI418e8ca5e8db
diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py
index 52366da8c35..767677cbcbf 100644
--- a/litellm/llms/bedrock/chat/converse_transformation.py
+++ b/litellm/llms/bedrock/chat/converse_transformation.py
@@ -1618,7 +1618,7 @@ class AmazonConverseConfig(BaseConfig):
if additional_request_params:
data["additionalModelRequestFields"] = additional_request_params
if "thinking" in additional_request_params:
- data["additionalModelResponseFieldPaths"] = ["/usage/output_tokens_details"]
+ data["additionalModelResponseFieldPaths"] = ("/usage/output_tokens_details",)
if system_content_blocks:
data["system"] = system_content_blocks
diff --git a/litellm/types/llms/bedrock.py b/litellm/types/llms/bedrock.py
index 5665aa3277a..6ae2e31fe60 100644
--- a/litellm/types/llms/bedrock.py
+++ b/litellm/types/llms/bedrock.py
@@ -1,4 +1,5 @@
import json
+from collections.abc import Sequence
from enum import Enum
from typing import TYPE_CHECKING, Any, Final, Literal
@@ -396,7 +397,7 @@ class OutputConfigBlock(TypedDict, total=False):
class CommonRequestObject(TypedDict, total=False): # common request object across sync + async flows
additionalModelRequestFields: dict
- additionalModelResponseFieldPaths: list[str]
+ additionalModelResponseFieldPaths: Sequence[str]
inferenceConfig: InferenceConfig
system: list[SystemContentBlock]
toolConfig: ToolConfigBlock
diff --git a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py
index b648b6322f7..4d2c077b548 100644
--- a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py
+++ b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py
@@ -401,7 +401,7 @@ def test_thinking_request_adds_output_tokens_details_response_path():
headers={},
)
- assert result["additionalModelResponseFieldPaths"] == ["/usage/output_tokens_details"]
+ assert result["additionalModelResponseFieldPaths"] == ("/usage/output_tokens_details",)
def test_request_without_thinking_omits_response_field_paths():
diff --git a/type-discipline-budget.json b/type-discipline-budget.json
index 627811a7f1d..05098546325 100644
--- a/type-discipline-budget.json
+++ b/type-discipline-budget.json
@@ -1,6 +1,6 @@
{
"LIT001": {
- "limit": 22805
+ "limit": 22804
},
"LIT002": {
"limit": 26873