aws_bedrock_embeddings: support dimensions for Titan Text Embeddings V2
Summary
Amazon Titan Text Embeddings V2 (amazon.titan-embed-text-v2:0) supports configurable output embedding sizes (256, 512, or 1024 dimensions, default 1024) via a dimensions parameter in the InvokeModel request body. The aws_bedrock_embeddings processor doesn't expose it, so V2 users always get 1024-dimension vectors.
Use case / motivation
Smaller embeddings mean lower storage and compute cost in the downstream vector store and faster similarity search, at a small accuracy cost — a tradeoff many RAG pipelines happily make. Right now the only workaround is dropping down to a raw http processor and hand-rolling SigV4 auth, which defeats the purpose of the native component.
Prior art / feasibility
- The Titan Text Embeddings V2 docs define
dimensionsas an optional request field accepting 256, 512, or 1024; only V2 accepts it (V1 and Cohere models reject it). - The processor already has precedent for model-specific parameters:
input_typeis required for Cohere models and ignored by Titan ones (#4473). Adimensionsfield scoped to Titan V2 follows the same pattern.
Proposed configuration (illustrative)
processors:
aws_bedrock_embeddings:
model: amazon.titan-embed-text-v2:0
dimensions: 512Omitted dimensions preserves current behavior (model default, no field sent).
Additional considerations
- Values outside 256/512/1024 should fail fast at config-parse time, not per message at runtime.
- Setting
dimensionson a non-V2 model (Titan v1, Cohere) should likewise be a config error, since the API would reject it.
Source: redpanda-data/connect