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
ChatGPT in SlackでAI Slackbotを楽しく運用する
Search
iwamot
September 13, 2023
Technology
1
450
ChatGPT in SlackでAI Slackbotを楽しく運用する
2023-09-14
みんなのPython勉強会#97
https://startpython.connpass.com/event/294703/
iwamot
September 13, 2023
Tweet
Share
More Decks by iwamot
See All by iwamot
AWS Protonの概要
iwamot
0
46
ENECHANGEが実現した管理者の工数負担を削減しながらもAWSセキュリティを強化した方法とは
iwamot
0
100
Web APIのAWS Lambda移行で工夫したこと
iwamot
4
3k
ECS on FargateへのSeekable OCI導入レポート
iwamot
0
450
サービスクォータ、ちゃんと監視してますか?
iwamot
0
920
AWS Well-Architected Toolで信頼性をレビューした結果
iwamot
0
440
テックカンパニーとしてのENECHANGEの中期目標
iwamot
0
78
AIの活用状況と今後の展望
iwamot
0
62
ENECHANGE社のAWSセキュリティ改革ストーリー
iwamot
0
130
Other Decks in Technology
See All in Technology
What is DRE? - Road to SRE NEXT@広島
chanyou0311
3
630
ペパボのオブザーバビリティ研修2024 説明資料
kesompochy
0
1.1k
開発生産性をむしろ向上させる セキュリティパートナーの作り方 / Dev Productivity Con 2024
flatt_security
0
360
LLMアプリケーションの評価の実践と課題 ~PharmaXにおける今後の展望~
pharma_x_tech
2
160
ゆめみのアクセシビリティの現在地と今後
ryokatsuse
3
290
推薦システムを本番導入する上で一番優先すべきだったこと~NewsPicks記事推薦機能の改善事例を元に~
morinota
0
120
[I/O Extended Android 2024] What`s new in Android 2024
kyeongwan
0
220
コミュニティサービスに「あなたへ」フィードを リリースするまでの試行錯誤
takapy
1
150
Git 研修 Basic【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
310
公共領域から学ぶ クラウド移行についてエンジニアが意識していること
kawakawa2222
0
140
コンテナ・K8s研修 - 前半 コンテナ基礎・ハンズオン【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
170
dxd2024-生成AIに振り回された3か月間の成功と失敗/dxd2024-link-and-motivation
lmi
2
260
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
Music & Morning Musume
bryan
43
5.9k
How To Stay Up To Date on Web Technology
chriscoyier
784
250k
RailsConf 2023
tenderlove
16
720
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
325
21k
The World Runs on Bad Software
bkeepers
PRO
63
11k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
23
1.9k
Practical Orchestrator
shlominoach
185
10k
Building an army of robots
kneath
301
42k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Creatively Recalculating Your Daily Design Routine
revolveconf
214
11k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
29
2.5k
Transcript
ChatGPT in SlackでAI Slackbotを楽しく運用する 2023-09-14 みんなのPython勉強会#97 https://startpython.connpass.com/event/294703/ ENECHANGE株式会社 CTO室 インフラエンジニア兼SRE 岩本隆史
(iwamot)
ChatGPT in Slackとは
OSSのAI Slackbotアプリ https://github.com/seratch/ChatGPT-in-Slack
Slackの瀬良さんが個人で開発 https://www.linkedin.com/in/seratch/
もちろんPythonで実装 https://github.com/seratch/ChatGPT-in-Slack
いろんな環境で実行可能
ローカル環境・Amazon EC2等 # Create an app-level token with connections:write scope
export SLACK_APP_TOKEN=xapp-1-... # Install the app into your workspace to grab this token export SLACK_BOT_TOKEN=xoxb-... # Visit https://platform.openai.com/account/api-keys for this token export OPENAI_API_KEY=sk-... (snip) python -m venv .venv source .venv/bin/activate pip install -r requirements.txt python main.py https://github.com/seratch/ChatGPT-in-Slack/blob/main/README.md
Amazon ECS on AWS Fargate等 (Docker) FROM python:3.11.4-slim-buster as builder
COPY requirements.txt /build/ WORKDIR /build/ RUN pip install -U pip && pip install -r requirements.txt FROM python:3.11.4-slim-buster as app WORKDIR /app/ COPY *.py /app/ RUN mkdir /app/app/ COPY app/*.py /app/app/ COPY --from=builder /usr/local/bin/ /usr/local/bin/ COPY --from=builder /usr/local/lib/ /usr/local/lib/ ENTRYPOINT python main.py https://github.com/seratch/ChatGPT-in-Slack/blob/main/Dockerfile
AWS Lambda + Amazon API Gateway (Serverless Framework) frameworkVersion: '3'
service: slack-chat-gpt-bot provider: name: aws runtime: python3.9 region: us-east-1 ... https://github.com/seratch/ChatGPT-in-Slack/blob/main/serverless.yml
おすすめ記事 ChatGPTとSlack上で会話するアプリを10分で構築しよう(前編:ローカル環境) https://qiita.com/rubita/items/f143f199e20b0310980a ChatGPTとSlack上で会話するアプリを10分で構築しよう(後編:AWS Lambda) https://qiita.com/rubita/items/f8d08552f98cc3b25a1a
ぼくの提案で追加された機能
Azure OpenAIの利用 # To use Azure OpenAI, set the following
optional environment variables according to your environment # default: None export OPENAI_API_TYPE=azure # default: https://api.openai.com/v1 export OPENAI_API_BASE=https://YOUR_RESOURCE_NAME.openai.azure.com # default: None export OPENAI_API_VERSION=2023-05-15 # default: None export OPENAI_DEPLOYMENT_ID=YOUR-DEPLOYMENT-ID https://github.com/seratch/ChatGPT-in-Slack/blob/main/README.md
Function Calling(実験的機能) # Experimental: You can try out the Function
Calling feature (default: None) export OPENAI_FUNCTION_CALL_MODULE_NAME=tests.function_call_example https://github.com/seratch/ChatGPT-in-Slack/blob/main/README.md
Function Callingの利用例
DALL·E 2を使った画像作成
qrcodeライブラリを使ったQRコード作成
Amazon Pollyを使った音声読み上げ
まとめ
運用も開発も楽しいので是非お試しを! https://github.com/seratch/ChatGPT-in-Slack