Skip to content

Conversation

@turisanapo
Copy link

Background

Nova embedding models on Amazon Bedrock use a different API schema than Titan models. Nova requires a SINGLE_EMBEDDING taskType with singleEmbeddingParams, while Titan uses inputText. The response formats also differ: Nova returns embeddings (array of objects), Titan returns embedding (array of numbers).

Summary

  • Update BedrockEmbeddingModel.doEmbed to send a SINGLE_EMBEDDING payload for Nova embedding models with singleEmbeddingParams containing embeddingPurpose, embeddingDimension, and text with truncationMode.
  • Add Nova-specific provider options: embeddingDimension (256, 384, 1024, 3072), embeddingPurpose ('GENERIC_INDEX', 'QUERY'), and truncationMode ('START', 'END', 'NONE').
  • Update response schema to handle both Nova (embeddings array) and Titan (embedding) response formats using a union schema.
  • Add/extend tests to assert the Nova embeddings request and response schema.

Manual Verification

  • Ran the updated unit tests covering Nova embeddings request schema (packages/amazon-bedrock/src/bedrock-embedding-model.test.ts).
  • Verified against a real Bedrock Nova embeddings model by calling doEmbed and confirming the request payload uses SINGLE_EMBEDDING taskType.

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

@vercel-ai-sdk vercel-ai-sdk bot added ai/provider provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider labels Dec 22, 2025
@turisanapo turisanapo changed the title Fix/bedrock nova embeddings fix(amazon-bedrock): support Nova embedding models Dec 22, 2025
@turisanapo
Copy link
Author

Heads-up: this PR is related to #11213. Both touch the same Bedrock embeddings codepaths/files (bedrock-embedding-model.ts, bedrock-embedding-options.ts, and the embedding model tests).

If #11213 is expected to merge first, I can rebase this PR and resolve any conflicts. Let me know if you’d prefer a stacked approach or if there are any extra checks/docs updates you want in this context.

@turisanapo
Copy link
Author

Tagging @shaper @lgrammel for review (Bedrock provider).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant