LoginSignup
4
1

GenU (Generative AI Use Cases JP) のアップデート方法

Last updated at Posted at 2024-06-24

はじめに

GenU (Generative AI Use Cases JP) のアップデート方法を毎回忘れちゃうので、備忘録的にまとめます。アップデート方法は好みによってまちまちだと思いますが、自分は git reset --hard でローカル側の変更をすべて捨てる方法を採用しています。

というのも、cdk.json しか基本的に変更しないので、コンフリクトを考えるよりは、差分を手元にメモするだけで済むシンプルな手順で実行しています。

注意事項!

この手順は、ローカル側の変更を cdk.json のみ変更している前提です。たくさんのファイルを変更している環境の場合は、このアップデート手順は難しいこともあるので、適宜環境によって判断してください。

cdk.json の差分を確認する

GenU の git clone している ルートフォルダに移動します。

cd <hogehoge/generative-ai-use-cases-jp>

git diff コマンドで cdk.json の変更差分を確認します。

git diff --unified=0

実行例です。以下のテキストを手元のメモ帳か何かに保存しておいて、あとから見返しができるようにしています。基本的には、行の頭に「+」が書かれているものしか見ていません。

  • 行の頭に「-」と書かれているのが、変更前の内容
  • 行の頭に「+」と書かれているのが、手動で変更を加えた、変更後の内容
> git diff --unified=0
diff --git a/packages/cdk/cdk.json b/packages/cdk/cdk.json
index 49d5213..9d9a83a 100644
--- a/packages/cdk/cdk.json
+++ b/packages/cdk/cdk.json
@@ -20 +20 @@
-    "ragEnabled": false,
+    "ragEnabled": true,
@@ -23 +23 @@
-    "selfSignUpEnabled": true,
+    "selfSignUpEnabled": false,
@@ -30 +30,9 @@
-      "anthropic.claude-3-sonnet-20240229-v1:0"
+      "anthropic.claude-3-sonnet-20240229-v1:0",
+      "anthropic.claude-3-haiku-20240307-v1:0",
+      "amazon.titan-text-premier-v1:0",
+      "meta.llama3-70b-instruct-v1:0",
+      "meta.llama3-8b-instruct-v1:0",
+      "cohere.command-r-plus-v1:0",
+      "cohere.command-r-v1:0",
+      "mistral.mistral-large-2402-v1:0",
+      "mistral.mistral-small-2402-v1:0"
@@ -33 +41,2 @@
-      "stability.stable-diffusion-xl-v1"
+      "stability.stable-diffusion-xl-v1",
+      "amazon.titan-image-generator-v1"
@@ -36 +45 @@
-    "agentEnabled": false,
+    "agentEnabled": true,
@@ -38 +47 @@
-    "searchAgentEnabled": false,
+    "searchAgentEnabled": true,
@@ -49 +58 @@
-    "recognizeFileEnabled": false,
+    "recognizeFileEnabled": true,

また、cdk.json ファイルの全体を直接別のメモ帳か何かに退避しておいても良いと思います。特に modelIds を手打ちで全部入力するのが大変なので、これだけは毎回退避しています。

    "modelIds": [
      "anthropic.claude-3-sonnet-20240229-v1:0",
      "anthropic.claude-3-haiku-20240307-v1:0",
      "amazon.titan-text-premier-v1:0",
      "meta.llama3-70b-instruct-v1:0",
      "meta.llama3-8b-instruct-v1:0",
      "cohere.command-r-plus-v1:0",
      "cohere.command-r-v1:0",
      "mistral.mistral-large-2402-v1:0",
      "mistral.mistral-small-2402-v1:0"
    ],

ローカルの変更をすべて捨てる

以下のコマンドでローカル側の変更をすべてリセットします。cdk.json の変更や、他に加えた変更はすべて削除されるので、ご注意ください。

git reset --hard

GitHub から最新バージョンをダウンロード

以下のコマンドで最新バージョンのソースコードを取得します。

git pull

npm ci で依存関係を解決します。

npm ci

依存関係を解決している処理の途中でもよいので、cdk.json を、メモ帳か何かに退避したテキストを見ながら、手動で変更します。例えば次のように、modelIds などを指定します。

    "modelIds": [
      "anthropic.claude-3-5-sonnet-20240620-v1:0",
      "anthropic.claude-3-sonnet-20240229-v1:0",
      "anthropic.claude-3-haiku-20240307-v1:0",
      "amazon.titan-text-premier-v1:0",
      "meta.llama3-70b-instruct-v1:0",
      "meta.llama3-8b-instruct-v1:0",
      "cohere.command-r-plus-v1:0",
      "cohere.command-r-v1:0",
      "mistral.mistral-large-2402-v1:0"
    ],

デプロイをします。

npm run cdk:deploy

これでアップデートが完了です!

参考 URL

GenU
https://github.com/aws-samples/generative-ai-use-cases-jp/tree/main

4
1
1

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
4
1