Share
Embed
カスタムベクトルストアでRAGワークフローをカスタマイズする
JAWS-UG横浜 #66 AWS re:Invent 2023 Recap Database
Pretzelisa
January 20, 2024
Transcript
24 slides
-
自己紹介 齋藤理沙子 オンプレからクラウドまで、インフラまわり色々 2023 Japan AWS Jr. Champions 2023 Japan
AWS All Certifications Engineers 好きなサービス:FSx for NetApp ONTAP 2 -
re:Invent2023期間のアップデート 3 AWS「Amazon OpenSearch Serverless 用ベクトルエンジン」 https://aws.amazon.com/jp/opensearch-service/serverless-vector-engine/ Amazon OpenSearch Serverless
用ベクトルエンジンがGA Amazon Web Servicesブログ 「Amazon OpenSearch Serverless 用ベクトルエンジンが利用可能になりました」 https://aws.amazon.com/jp/blogs/news/vector-engine-for-amazon-opensearch- serverless-is-now-generally-available/ -
re:Invent2023期間のアップデート 4 AWS「Amazon OpenSearch Serverless 用ベクトルエンジン」 https://aws.amazon.com/jp/opensearch-service/serverless-vector-engine/ Amazon OpenSearch Serverless
用ベクトルエンジンがGA Amazon Web Servicesブログ 「Amazon OpenSearch Serverless 用ベクトルエンジンが利用可能になりました」 https://aws.amazon.com/jp/blogs/news/vector-engine-for-amazon-opensearch- serverless-is-now-generally-available/ ベクトル化されたデータのクエリができる -
ベクトル化のイメージ 5 Titan Multimodal Embeddings Generation 1 (G1)で テキスト“This is
a test”をベクトル化してもらう 実際はもっと下に続いてます -
データをベクトル化すると何ができる? 6 Amazon Web Servicesブログ「生成系 AI アプリケーションでベクトルデータストアが果たす役割とは」 https://aws.amazon.com/jp/blogs/news/the-role-of-vector-datastores-in-generative-ai-applications/ セマンティック検索、テキスト分類、 RAGの実装などができる
RAG(Retrieval Augmented Generation, 検索拡張生成)…データソースから情報を取得し、 それを基に回答を生成する手法 ⚫ Keyword A ⚫ Keyword B ⚫ Keyword C ⚫ Keyword D ⚫ Keyword E 要素をマッピングして、 近接性から意味的類似性を表現する -
RAGワークフロー 7 Amazon Web Services ブログ「ナレッジベースは、Amazon Bedrock でフルマネージド型の RAG エクス
ペリエンスを提供するようになりました」 https://aws.amazon.com/jp/blogs/news/knowledge-bases-now-delivers-fully-managed-rag- experience-in-amazon-bedrock/ AWS「RAG とは何ですか?」 https://aws.amazon.com/jp/what-is/retrieval-augmented-generation/ 指定したデータソースからの情報を基にAIに回答生成してもらいたい →入力プロンプトに関連するデータを抽出して、それを要約してもらう AWSではBedrockにKnowledge base(データソース)の情報を データベースにマッピングさせることで、 RAGワークフローを実装することができる -
カスタムベクトルストアで RAGワークフローを実装する Amazon BedrockではフルマネージドのRAGワークフロー構築 (=ベクトルストアをよしなに作ってもらう)こともできる ……けど、今回はカスタムベクトルストアを構築してみる カスタムベクトルストアとして、 Amazon OpenSearch
Serverless用ベクトルエンジン Pinecone Redis Enterprise Cloud Amazon Aurora の4つを利用することができる 8 -
BedrockでKnowledge baseを設定する カスタムベクトルストア(Vector engine for Amazon OpenSearch Serverless)でKnowledge baseを作成するときに指定するもの
回答の基になるデータのS3 URI(フルマネージドのRAGワークフローでも指定要) OpenSearch ServerlessコレクションのARN コレクションのインデックス名 ベクトルフィールド名 テキストフィールド名 メタデータフィールド名 14 -
ハマリポイント 19 いったんマネージドRAGワークフローを新規作成して、 よしなに設定してくれた値でベクトルストアを新規作成したら Knowledge baseを作成できた(エラーの原因分からず……) エラーが出たときはOpenSearch側のテキストフィールドとメタデータフィールドの 名前をtext, metadataとしていたが、 text
-> AMAZON_BEDROCK_TEXT_CHUNK metadata -> AMAZON_BEDROCK_METADATA に変更したらKnowledge base作成できた カスタムベクトルストアでKnowledge baseを作成するとき、 こんなエラーが出た -
参考サイト Amazon Web Servicesブログ「Amazon OpenSearch Serverless 用ベクト ルエンジンが利用可能になりました」 https://aws.amazon.com/jp/blogs/news/vector-engine-for-amazon- opensearch-serverless-is-now-generally-available/
AWS「Amazon OpenSearch Serverless 用ベクトルエンジン」 https://aws.amazon.com/jp/opensearch-service/serverless-vector- engine/ Amazon Web Servicesブログ「生成系 AI アプリケーションでベクトルデー タストアが果たす役割とは」 https://aws.amazon.com/jp/blogs/news/the-role-of-vector-datastores- in-generative-ai-applications/ 23 -
参考サイト Amazon Web Services ブログ「ナレッジベースは、Amazon Bedrock でフルマネージド型の RAG エクスペリエンスを提供するよう になりました」
https://aws.amazon.com/jp/blogs/news/knowledge-bases-now- delivers-fully-managed-rag-experience-in-amazon-bedrock/ AWS「RAG とは何ですか?」 https://aws.amazon.com/jp/what-is/retrieval-augmented- generation/ 24