aws-samples / generative-ai-use-cases-jp Goto Github PK
View Code? Open in Web Editor NEWすぐに業務活用できるビジネスユースケース集付きの安全な生成AIアプリ実装
License: MIT No Attribution
すぐに業務活用できるビジネスユースケース集付きの安全な生成AIアプリ実装
License: MIT No Attribution
DDBに保存されたメッセージを削除する機能を追加
bad を送るときに正しい文言を入力したいという要望もあるが、一旦は bad のみを送るようにする
新規会話を開始して会話履歴に会話が追加されたら、その新規追加された会話を選択状態にする
現在は、PathParamsと一致しているかで選択状態を判断しているため、そこの実装を変える必要がある
CDK Deployした際にCodeBuildで以下の通りエラーが発生しました。
> [email protected] build
--
238 | > tsc && vite build
239 |
240 | src/components/ChatMessage.tsx(33,24): error TS18048: 'chatContent' is possibly 'undefined'.
241 | npm ERR! Lifecycle script `build` failed with error:
242 | npm ERR! Error: command failed
243 | npm ERR! in workspace: [email protected]
244 | npm ERR! at location: /codebuild/output/src2456308977/packages/web
245 |
246 | [Container] 2023/09/11 15:48:41 Command did not exit successfully eval "$buildCommands" exit status 1
247 | [Container] 2023/09/11 15:48:41 Phase complete: BUILD State: FAILED
248 | [Container] 2023/09/11 15:48:41 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: eval "$buildCommands". Reason: exit status 1
249 | [Container] 2023/09/11 15:48:41 Entering phase POST_BUILD
250 | [Container] 2023/09/11 15:48:41 Running command echo Build completed on `date`
251 | Build completed on Mon Sep 11 15:48:41 UTC 2023
環境は以下の通りです。
マシン:Amazon EC2 (Amazon Linux 2023)
Node.js:v18.17.1
CDK:2.95.1 (build ae455d8)
ローカルのMacでも同様の症状が起きます。240行目にあるように型不一致が起きているようです。
ご確認の程よろしくお願いいたします。
プロンプトのテンプレートを保存する機能。
ユースケース集という目的からは若干ズレるかもしれない
chat#xxxx
と xxxx
が混在しているFAQを作る条件を設定して、マニュアルを読み込ませると、LLMが自動でFAQを作成してくれる機能
以下をGitHubActionsで整備する
プロンプトをユーザが書き換えられるようにする。
以下対応案
https://github.com/aws-samples/generative-ai-use-cases-jp/blob/main/packages/cdk/cdk.json#L20
の、
"openAiApiKeySecretArn": "Your API Key",
の部分ですが、打ち込むのは API Key ではなく、
openai api key を格納した、Secrets Manager の Secrets の Arn なので実態に即した表記がわかりやすいと感じました。
SECRETS ARN stored your openai api key
とかですかね。
BedrockでStable Diffusionを実行することができるので、それを使ったユースケース。
TranslateかLLMをかませる形にして、日本語でプロンプトを入力できる形にする。
Kendraは月額800USDの利用料がかかるので、RAGを除いたデプロイができるように修正する
npx -w packages/cdk cdk bootstrap
コマンドが cdk.json
の openai の secrets manager の arn を参照しているため、以下エラーが発生してしまう。
手順を変更する。
再現手順は、新アカウントで Cloud9 で実行する。
aws configure # region の設定だけ
npm ci
npx -w packages/cdk cdk bootstrap
発生エラー
Error: `secretCompleteArn` does not appear to be complete; missing 6-character suffix
at Function.fromSecretAttributes (/home/ec2-user/environment/generative-ai-use-cases-jp/node_modules/aws-cdk-lib/aws-secretsmanager/lib/secret.js:1:7009)
at Function.fromSecretCompleteArn (/home/ec2-user/environment/generative-ai-use-cases-jp/node_modules/aws-cdk-lib/aws-secretsmanager/lib/secret.js:1:5197)
at new Api (/home/ec2-user/environment/generative-ai-use-cases-jp/packages/cdk/lib/construct/api.ts:28:27)
at new GenerativeAiUseCasesStack (/home/ec2-user/environment/generative-ai-use-cases-jp/packages/cdk/lib/generative-ai-use-cases-stack.ts:12:17)
at Object.<anonymous> (/home/ec2-user/environment/generative-ai-use-cases-jp/packages/cdk/bin/generative-ai-use-cases.ts:8:1)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Module.m._compile (/home/ec2-user/environment/generative-ai-use-cases-jp/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Object.require.extensions.<computed> [as .ts] (/home/ec2-user/environment/generative-ai-use-cases-jp/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1076:32)
****************************************************
*** Newer version of CDK is available [2.92.0] ***
*** Upgrade recommended (npm install -g aws-cdk) ***
****************************************************
Subprocess exited with error 1
今は以下のように、初期化時に chatId だけを入れているが
https://github.com/aws-samples/generative-ai-use-cases-jp/blob/main/packages/web/src/hooks/useChat.ts#L244-L251
これだと今後描写に必要な情報などが取れない可能性が高い。
例1: 今はタイトルの自動設定の判定を messages.length <= 3 で行なっているが、本当は title === '' で判定したい
例2: 会話履歴をクリックしたら上部にタイトルを出したい
そこで、以下のような実装により、useChat 初期化時に Chat を取るようにする。
#58 の説明文参照
ただの思いつきですが、チャット(既存のチャットとは別画面)から、
「echo する lambda 関数を作ってください」
と言ったら作ってくれると AWS っぽさが出る気がしました。
現在、エラーが発生してもリトライできないため、エラー表示+リトライを行えるようにする
ChatGPT風にする
新規チャットを始めた場合に、会話一覧を最新化して、現在の会話を一覧に自動追加する。
一覧に追加するタイミングで、件名の自動付与も同時に実施する。
狭い画面のDrawerについて、現在は「X」ボタンでしか閉じることができないが、グレーアウト部分のどこをクリックしても閉じられるようにする。
例えば web の postChat は postMessage の方が正しいはず
それに関する説明も必要
「システムプロンプトを表示する」ボタンを用意して、表示/非表示の切り替えを行う。
デフォルトは非表示
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.