forked from aws-samples/aws-genai-llm-chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Amazon Bedrock Knowledge base as a RAG Engine (retriever) (aws-sa…
…mples#427) * feat(kb): initial * feat(bedrock_kb): initial * feat(bedrock_kb): knowledge base support * feat(bedrock_kb): delete workspaces * feat(bedrock_kb): config * feat(bedrock_kb): hybrid search * feat(bedrock_kb): upgrade boto3 * fix(cohere_embeddings): correct set the `input_type` * feat(kb): add Bedrock KB to the welcome page * fix(no unused var): correct ignore * fix: correct enum values * feat(bedrock_kb): metadata filters * feat(bedrock_kb): dedup * feat(llama3): adapter * feat(bedrock_kb): merge to latest * chore: updating code to use langchain-community * feat(bedrock): fix error * fix(bedrock_kb): magic cli * fix: correct path to compiled files * chore: removed wrongly tracked file * fix: fix review feedback - remove dev files - remove console.log - remove unused code * fix: remove feature under development * fix: typescript errors * fix: ignore code un `dist` to avoid recursive builds * tests: update test snapshot and fix call order * test: fix rag tests
- Loading branch information
Showing
45 changed files
with
1,145 additions
and
189 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
21 changes: 21 additions & 0 deletions
21
lib/chatbot-api/functions/api-handler/routes/bedrock_kb.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import genai_core.parameters | ||
import genai_core.bedrock_kb | ||
from pydantic import BaseModel | ||
from aws_lambda_powertools import Logger, Tracer | ||
from aws_lambda_powertools.event_handler.appsync import Router | ||
|
||
tracer = Tracer() | ||
router = Router() | ||
logger = Logger() | ||
|
||
|
||
class KendraDataSynchRequest(BaseModel): | ||
workspaceId: str | ||
|
||
|
||
@router.resolver(field_name="listBedrockKnowledgeBases") | ||
@tracer.capture_method | ||
def list_bedrock_kbs(): | ||
indexes = genai_core.bedrock_kb.list_bedrock_kbs() | ||
|
||
return indexes |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.