Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Amazon BedrockとOpenSearch Serviceでなんでも答えられる社内RA...
Search
とすり
July 31, 2024
Technology
2
400
Amazon BedrockとOpenSearch Serviceでなんでも答えられる社内RAGを作成する!!
とすり
July 31, 2024
Tweet
Share
More Decks by とすり
See All by とすり
Amazon BedrockでサーバレスなAIお料理ボットを作成する!!
tosuri13
2
400
React + TextAliveでカッコいいLyric Applicatioinを作ろう!!
tosuri13
1
500
Radix UI & shadcn/uiのススメ
tosuri13
0
100
Other Decks in Technology
See All in Technology
ドメイン名の終活について - JPAAWG 7th -
mikit
33
20k
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
130
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
100
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
840
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
320
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.6k
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
230
Terraform Stacks入門 #HashiTalks
msato
0
360
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
A designer walks into a library…
pauljervisheath
204
24k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Building an army of robots
kneath
302
43k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
For a Future-Friendly Web
brad_frost
175
9.4k
KATA
mclloyd
29
14k
Transcript
Am a zon BedrockͱOpenSe a rch Service ͰͳΜͰ͑ΒΕΔࣾRAGΛ࡞͢Δ!! @tosuri13
@tosuri13 ࣗݾհ ͱ͢Γ @tosuri13 MOTEXגࣜձࣾ ॴଐ 🐧 Μ͗Μ͕͖Ͱ͢
@tosuri13 ࠔ͍ͬͯͨ͜ͱ Γ͍ͨ͜ͱ͕ॻ͔Ε͍ͯΔࢿྉΛύοͱݟ͚ͭΒΕͳ͍!! ɹˠ طଘͷRAGιϦϡʔγϣϯϑϧϚωʔδυͳAWSαʔϏεɺυΩϡϝϯ τॲཧͷॊೈੑίετ໘Ͱؾܰʹࢼͮ͠Β͍… ɹˠ ࣗͨͪͰࣾͷυΩϡϝϯτΛݕࡧͯ͠AIʹճͯ͠Β͏ಠࣗͷRAGΞ ϓϦέʔγϣϯΛ࡞Ζ͏!!
@tosuri13 RAGͱ? RAG(Retriev a l Augmented Gener a tion)ͱɺ֎෦͔Βऔಘͨ͠ճͷࢀߟͱͳ ΔใΛLLMʹࢀরͤͯ͞ճΛੜ͢Δख๏Ͱ͢ɻ
RAGΛ͏͜ͱʹΑͬͯɺLLM͕ຊདྷΓಘͳ͍ใΛิͯ͠ճΛੜͤ͞ Δ͜ͱ͕Ͱ͖ΔΑ͏ʹͳΓ·͢!! ֎෦DB LLM AIΛ༻͍ͯݕࡧ ྨࣅ͢ΔใΛ͢ औಘͨ͠ใΛ ࢀরͯ͠ճ
@tosuri13 ϕΫτϧݕࡧʹ͍ͭͯ ·ͨɺࢀߟใͱ͍ͯͨ͠͠υΩϡϝϯτΛݕࡧ͢ΔͨΊʹɺϕΫτϧݕࡧ ͱ͍͏ख๏͕RAGγεςϜͰ͘࠾༻͞Ε͍ͯ·͢ɻϕΫτϧݕࡧʹΑΓࣗવ ݴޠΛ༻͍ͨυΩϡϝϯτͷݕࡧ͕Ͱ͖ΔΑ͏ʹͳΓ·͢!! ϕΫτϧετΞ [0.8, 0.3, 0.1 …
] [0.4, 0.4, 0.3 … ] [0.5, 0.7, 0.8 … ] େྔͷυΩϡϝϯτ ࣭ [0.8, 0.3, 0.2 … ] ࣭ϕΫτϧԽͯ͠ ࣅ͍ͯΔϕΫτϧΛݕࡧ͢Δ!! υΩϡϝϯτΛϕΫτϧԽͯ͠ ྨࣅ͢ΔจষΛ୳͘͢͢͠Δ!!
ૣRAGΞϓϦέʔγϣϯΛAWSͰ࡞ͬͯΈͨ!! @tosuri13
@tosuri13 ༻͢ΔAWSαʔϏεΛϐοΫΞοϓ!! ɾAm a zon Bedrock ɹˠ ճϕΫτϧͷੜʹ༻͠·͢ɻ༻͢Δج൫ϞσϧҎԼͷ2ͭͰ͢ɻ ɹɹ- Cl
a ude 3.5 Sonnet (ճੜ༻) ɹɹ- Tit a n Text Embedding v2 (ϕΫτϧੜ༻) ɾAm a zon OpenSe a rch Service ɹˠ ϕΫτϧΛ֨ೲͯ͠ηϚϯςΟοΫݕࡧΛߦ͏ϕΫτϧετΞͱͯ͠༻͠·͢ɻ ɾAm a zon S3 ɹˠ ݩͷυΩϡϝϯτͱࣝผࢠࢀরݩURLͳͲͷϝλσʔλΛอ͠·͢ɻ
@tosuri13 RAGΞϓϦέʔγϣϯͷAWSߏਤ νϟοτΞϓϦ ཧऀ API G a tew a y
L a mbd a SNS Bedrock L a mbd a OpenSe a rch L a mbd a S3 Bedrock ճ ͷ ฦ ৴ ճͷੜ ϕΫτϧετΞ υΩϡϝϯτཧ ϕΫτϧม ॳճԠ (λΠϜΞτରࡦ) WebhookͰ࣭Λૹ৴
@tosuri13 ԿͰฉ͚ΔΑ͏ʹͳͬͨ!! ࣮ࡍͷճΛ͓ݟͤ͢Δ͜ͱͰ͖·ͤΜ͕ɺνϟοτΞϓϦΛ༻ͯ͠ҎԼͷ Α͏ͳΠϝʔδͰճͯ͠Β͏͜ͱ͕Ͱ͖ΔΑ͏ʹͳΓ·ͨ͠!! RAGΞϓϦέʔγϣϯ ࠔ͍ͬͯΔࣾһ ͜ͷAPIͬͯͲ͏͍͏Ϩεϙϯε ฦ͢Μ͚ͩͬ… ઃܭࢿྉʹΑΔͱ͜ͷΑ͏ͳεΩʔϚͷ Ϩεϙϯε͕ฦ͞ΕϚεɻ
ɹ{JSONεΩʔϚ} ɾAPIઃܭࢿྉͷURL ɾAPIઃܭ࣌ͷMTGࢿྉͳͲͷURL νϟοτͰ࣭
ࡉ͔͍࣮ͨ͠ϙΠϯτ!! @tosuri13
@tosuri13 ᶃ νϟϯΫͷׂํ๏ νϟοτΞϓϦ ཧऀ API G a L a
SNS Bedrock L a OpenSe a rch L a mbd a S3 Bedrock ճ ͷ ฦ ৴ ճͷੜ ϕΫτϧDB υΩϡϝϯτཧ ϕΫτϧม ॳճԠ (λΠϜΞτରࡦ) WebhookͰ࣭Λૹ৴
@tosuri13 ᶃ νϟϯΫͷׂํ๏ ϕΫτϧΛੜ͢ΔݩͱͳΔจࣈྻɺա͗ͯա͗ͯճͷਫ਼͕ѱԽ ͯ͠͠·͏Մೳੑ͕͋Γ·͢ɻ ɾจࣈྻ͕ա͗Δ → LLMʹஅยతͳใ͔͠༩͑ΒΕͳ͍ ɾจࣈྻ͕ա͗Δ →
ॏཁͳจ຺͕΅͚ͯ͠·͍ɺਖ਼͘͠ݕࡧ͞Εͳ͍Մೳੑ͕ߴ·Δ ɹˠ దʹυΩϡϝϯτΛνϟϯΫׂͯ͠ϕΫτϧԽ͢Δඞཁ͕͋Δ!!
@tosuri13 ᶃ νϟϯΫͷׂํ๏ ͲͷυΩϡϝϯτ౷ҰతʹM a rkdownʹมΛߦ͍ɺH1H2λά͝ͱʹׂ͢ Δ͜ͱͰɺదͳαΠζ͔ͭจ຺Λอ࣋ͨ͠ঢ়ଶͰνϟϯΫׂΛ͍ͯ͠·͢ɻ htmlɾcsvɾtxtͳͲ M a
rkdown # ேྱMTGϝϞ ## ਐḿ֬ೝ ɹ- A͞Μ: ͍͢͝ਐΜͰΔɺେৎͦ͏ ɹ- B͞Μ: શવਐΜͰͳ͍ɺࠔͬͨ… ## ࠓͷλεΫ ɹ- Xࣾͱͷଧͪ߹Θͤ ɹ- ์ஔ͞Ε͍ͯΔίϯϑϦΫτΛमਖ਼͢Δ S3͔ΒͷΠϕϯτ௨Λड͚औͬͯ M a rkdownʹม!! ҎԼͷΑ͏ͳΠϝʔδͰνϟϯΫׂ!!
@tosuri13 ᶄ Tool useʹΑΔCit a tions νϟοτΞϓϦ ཧऀ API G
a L a SNS Bedrock L a mbd a OpenSe a rch L a S3 Bedrock ճ ͷ ฦ ৴ ճͷੜ ϕΫτϧDB υΩϡϝϯτཧ ϕΫτϧม ॳճԠ (λΠϜΞτରࡦ) WebhookͰ࣭Λૹ৴
@tosuri13 ᶄ Tool useʹΑΔCit a tions ϕΫτϧݕࡧʹΑΓऔಘͨ͠υΩϡϝϯτʹɺඞͣؔ͠࿈͢ΔใͷΈؚ͕ ·Ε͍ͯΔͱݶΓ·ͤΜɻͦͷͨΊɺҾ༻ݩͱͳΔURLΛฦ͢߹࣭ͱؔ ͷͳ͍URLؚ͕·Εͯ͠·͏ͳͲ͕͋Γ·͢ɻ RAGΞϓϦέʔγϣϯ
༗څͷਃํ๏Λڭ͑ͯ!! ͍͔ͭ͘ݟ͚͖ͭͯ·γλɻ ɾ{ܦඅਃํ๏ͷURL} ɾ{༗څਃํ๏ͷURL} ɾ{ೖୀࣨਃํ๏ͷURL} ٳΈ͍ͨࣾһ ؔͷͳ͍URL ճʹؚΊͯ΄͘͠ͳ͍
@tosuri13 ᶄ Tool useʹΑΔCit a tions LLM͕ࢀߟʹͨ͠༰ͷΈΛฦ͢ϓϩϯϓτΤϯδχΞϦϯάͷख๏ΛCit a tions ͱ͍͍ɺAm
a zon BedrockͷConverse APIʹࡌ͞Ε͍ͯΔTool use (Function C a lling)Λ༻࣮ͯ͠͠·ͨ͠ɻ Ϩεϙϯεͷܗࣜઆ໌Λهࡌͨ͠ πʔϧͷεΩʔϚΛఆٛͯ͢͠ εΩʔϚ LLM ߏԽ͞Εͨঢ়ଶͰʮԿΛࢀߟʹͨ͠ͷ͔?ʯΛड͚औΕΔ!!
@tosuri13 ᶄ Tool useʹΑΔCit a tions ·ͨɺఏڙ͞ΕͨπʔϧΛ͏͔൱͔LLM͕அͯ͠ϨεϙϯεΛฦͨ͢Ίɺ ࢀߟʹͳΔใ͕શ͘ͳ͔ͬͨ߹ͳͲʹϋϧγωʔγϣϯΛ͑ΔΑ͏ͳ͜ͱ Ͱ͖·͢!! RAGΞϓϦέʔγϣϯ
৯͍͠Μͳࣾһ େࡕपลͷඒຯ͍͠ ͓Έম͖ͷ͓ళΛڭ͑ͯ!! ͋ͳͨͷΦϑΟεʹʮܦඅਃʯ ͱ͍͏໊લͷ͓Έম͖͞Μ͕ ซઃ͞Ε͍ͯΔΑ͏σεɻ ɾ{ܦඅਃํ๏ͷURL} ࢀߟใΛݩʹӕͷ༰Λ ճ͢ΔΑ͏ͳ͜ͱΛ͛Δ!!
·ͱΊ @tosuri13
@tosuri13 ·ͱΊͱײ Am a zon BedrockͱOpenSe a rchΛ͏͜ͱͰɺؾܰʹRAGΞϓϦέʔγϣϯΛ ߏங͢Δ͜ͱ͕Ͱ͖·ͨ͠!!·ͨɺಠࣗͰRAGΛ࣮͢Δ͜ͱʹΑΓɺAIγεςϜ ͷࣝؔ࿈͢ΔAWSαʔϏεͷཧղ͕ਂ·Γ·ͨ͠!!
ࢲͷLTΛฉ͍ͯRAGʹڵຯΛ࣋ͬͨํ͕͍Εɺͥͻࣗ͝Ͱ࣮ͯ͠ࢼͯ͠Έ ͯ΄͍͠ͱࢥ͍·͢!!
@tosuri13 ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠!!