Update Bedrock Titan V2 type definitions for encoding format support

- Add embeddingTypes parameter to AmazonTitanV2EmbeddingRequest
- Add embeddingsByType response field for binary format support
- Update type hints for enhanced embedding response handling
This commit is contained in:
Tim Elfrink 2025-09-18 20:17:23 +02:00
parent 8296bfb866
commit 0e096d7883

View file

@ -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):