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]

Update Bedrock Titan V2 type definitions for encoding format support

Tim Elfrink0e096d7883e1
diff --git a/litellm/types/llms/bedrock.py b/litellm/types/llms/bedrock.py
index a829a6b94b9..352e7f7eef0 100644
--- a/litellm/types/llms/bedrock.py
+++ b/litellm/types/llms/bedrock.py
@@ -324,15 +324,22 @@ class CohereEmbeddingResponse(TypedDict):
texts: List[str]
-class AmazonTitanV2EmbeddingRequest(TypedDict):
- inputText: str
+class AmazonTitanV2EmbeddingRequest(TypedDict, total=False):
+ inputText: Required[str]
dimensions: int
normalize: bool
+ embeddingTypes: List[Literal["float", "binary"]]
-class AmazonTitanV2EmbeddingResponse(TypedDict):
- embedding: List[float]
- inputTextTokenCount: int
+class AmazonTitanV2EmbeddingsByType(TypedDict, total=False):
+ binary: List[int] # Array of integers for binary format
+ float: List[float] # Array of floats for float format
+
+
+class AmazonTitanV2EmbeddingResponse(TypedDict, total=False):
+ embedding: List[float] # Legacy field - array of floats (backward compatibility)
+ embeddingsByType: AmazonTitanV2EmbeddingsByType # New format per AWS schema
+ inputTextTokenCount: Required[int] # Always present in AWS response
class AmazonTitanG1EmbeddingRequest(TypedDict):