2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWS Bedrock と Knowledge Bases を使用して RAG を実現してみた

2
Last updated at Posted at 2025-06-12

はじめに

こんにちは.

AWS Bedrock + Knowledge Bases + S3 + OpenSearch を使用して RAG を実現します.

aws-cdk の Bedrock L2 Construct 対応は進んできています.

しかしながら, なるべくサクッと実現するために今回ご紹介するコードでは

を使用してみました.

構成

User ---> Bedrock Agent ---> Knowledge Bases ---> OpenSearch(Serverless)
                                   └── S3

AWS リソースの作成・設定

$ git clone https://github.com/dev-kawano-y/study-aws-bedrock-agent-with-knowledge-bases.git
$ cd study-aws-bedrock-agent-with-knowledge-bases
$ npm ci
AWS リソースの作成
$ cd infrastructures
$ npx cdk deploy InfrastructuresStack --profile ...

動作確認

Amazon Bedrock コンソール > エージェント > [エージェントを選択] > テスト

RAG 用のドキュメントあり

スクリーンショット 2025-06-12 16.14.21.png

RAG 用のドキュメントは こちら
応答を見ると問題なさそうですね.

おまけ: RAG 用のドキュメントなし

スクリーンショット 2025-06-12 16.04.55.png

RAG 用のドキュメントを設定しないと期待する応答を得ることができませんでした.

AWS リソースの削除

AWS リソースの削除

$ npx cdk destroy InfrastructuresStack --profile ...

最後に

OpenSearch はまあまあ良いお値段するので, お試し後は削除をお忘れなく.

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?