feat: add Bedrock Knowledge Base Retriever to @ai-sdk/amazon-bedrock#16973
Draft
PVidyadhar wants to merge 1 commit into
Draft
feat: add Bedrock Knowledge Base Retriever to @ai-sdk/amazon-bedrock#16973PVidyadhar wants to merge 1 commit into
PVidyadhar wants to merge 1 commit into
Conversation
- Created bedrockKnowledgeBaseRetriever factory function - Supports MANAGED (default) and VECTOR knowledge base types - AgenticRetrieveStream with fallback to plain Retrieve - managedSearchConfiguration for managed KBs - Multi-type location parsing (S3, Web, Confluence, SharePoint, Custom) - Updated README with KB retrieval section, reranking options, and doc links - Added @aws-sdk/client-bedrock-agent-runtime dependency - Added BEDROCK_MANAGED_KB.md design doc - Unit tests included
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Amazon Bedrock recently launched Managed Knowledge Bases, which handle embedding, storage, and retrieval automatically — no external vector store
needed. The
@ai-sdk/amazon-bedrockpackage currently supports model invocation via Converse API but has no native KB retrieval capability. ThisPR adds a retriever that enables AI SDK users to query Bedrock Knowledge Bases directly.
Summary
Created
bedrockKnowledgeBaseRetrieverfactory function in@ai-sdk/amazon-bedrockthat:managedSearchConfigurationfor managed KBs,vectorSearchConfigurationfor vector KBs@aws-sdk/client-bedrock-agent-runtimedependencyManual Verification
managedSearchConfiguration: ✅ 3 results returned with content and scoresAgenticRetrieveStream: ✅ 10 agentic results with source URIsvectorSearchConfigurationon MANAGED KB: ✅ Correctly rejected with clear error messageChecklist
pnpm changesetin the project root)Future Work
rerankingModelTypeparameter for convenience (currently configurable via raw config passthrough)Related Issues
N/A — new feature addition for AWS Bedrock Managed Knowledge Base GA launch.