2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Skeet/Firebaseを利用した会話型AIアプリのデプロイ(ChatGPT/VertexAI)

Posted at

目的

Skeetを利用して、Firebase上でChatGPTおよびVertexAIチャットボットアプリの作成を実施する
Skeetフレームワークを活用することで、存在している会話型AIを用いたWebアプリが簡単に実装を試す。

Skeetとは?

[引用]
Google CloudとFirebase上にフルスタックアプリを構築できるオープンソースのサーバレスフレームワーク
このフレームワークは、アプリケーションの開発と運用のコストを削減し、より多くの計画を実現することを目的としています。

Firebaseとは?

FirebaseはGoogleが提供するモバイルおよびWebアプリケーション開発プラットフォーム
開発者がアプリケーションを効率的に構築、運用、成長させるための多くのツールとサービスを提供している。

設定の流れ

GoogleCloud/FirebaseとSkeetの設定を実施していく

[Google Cloud / Firebase]
1.Google CloudプロジェクトにFirebaseプロジェクトを追加する
2.Firebase認証の設定
3.Cloud Firestoreの設定
4.Cloud Storageの設定

[Skeet]
5.Skeetのインストールと設定
6.Appのデプロイ
7.ChatGPT API Keyの登録
8.Appの実行
9.VertexAIの利用

Firebase設定

プロジェクトの追加

Firebaseのプロジェクトを作成し、Google Cloudプロジェクトと紐づける
貼り付けた画像_2023_09_11_13_33.png

Google Cloud側のプロジェクトを選択する
今回は、「skeet」プロジェクトを選択している
貼り付けた画像_2023_09_11_13_34.png

規約に同意等のチェックボックスに✔︎をつける
貼り付けた画像_2023_09_11_13_34.png

プランを確認する
貼り付けた画像_2023_09_11_13_35.png

注意点を確認
貼り付けた画像_2023_09_11_13_35.png

Googleアナリティクスを使うかどうか選択する
今回は必要ないので、有効にしない
貼り付けた画像_2023_09_11_13_36.png

問題なければ、プロジェクトの追加が完了
貼り付けた画像_2023_09_11_13_37.png

Firebase認証メソッドの設定

アプリを利用する際の認証メソッドを追加する
構築 -> Authenticationを選択する
貼り付けた画像_2023_09_11_13_39.png

画面中央上の始めるを選択する
貼り付けた画像_2023_09_11_13_41.png

メールパスワード認証の追加

ユーザIDとしてメールアドレスを利用し、あらかじめ設定したパスワードでログインできるようにする
メール/パスワードを選択
貼り付けた画像_2023_09_11_13_42.png

有効にするを選択し、保存
貼り付けた画像_2023_09_11_13_43.png

Google認証の追加

外部認証方法として、Googleアカウントによる認証を追加する
Googleを選択
貼り付けた画像_2023_09_11_13_44.png

有効にするを選択し、プロジェクト公開名のサポートメールを選択し、保存
貼り付けた画像_2023_09_11_13_45.png

有効になっている認証メソッドを確認する
貼り付けた画像_2023_09_11_13_46.png

Cloud Firestoreの設定

「構築->Firestore Database->データベースの作成」をクリック
貼り付けた画像_2023_09_11_15_22.png

本番環境モードで開始するを選択し、次へをクリック
貼り付けた画像_2023_09_11_17_37.png

作成するリージョンを選択し、有効にするをクリック
貼り付けた画像_2023_09_11_17_39.png

CloudStorageの設定

「構築->CloudStorage->始める」をクリック
貼り付けた画像_2023_09_11_17_50.png

本番環境を選択
貼り付けた画像_2023_09_12_12_57.png

ロケーションは、Firestoreと同様となり、変更できないのでそのまま完了
貼り付けた画像_2023_09_12_12_58.png

Skeetのインストールと設定

Git:https://github.com/elsoul/skeet-cli
Skeetドキュメント:https://skeet.dev/ja/doc/

事前にいくつか必要なアプリケーションがあるので、インストールしておく
https://github.com/elsoul/skeet-cli#-dependency-

TypeScript 5.0.4 以上
Node.js 18.17.1 以上
Yarn 1.22.19 以上
Google Cloud SDK 430.0.0 以上
Firebase CLI 12.0.1 以上
GitHub CLI 2.29.0 以上
Java

CLIよりインストール

% sudo npm i -g @skeet-framework/cli
Password:

added 581 packages in 25s

55 packages are looking for funding
  run `npm fund` for details

Skeetの設定

skeet initコマンドにてGoogle CloudとFirebaseのPJ-IDなどの情報を設定していく
途中、FirebaseCLIの認証画面が開くので認証する

% skeet init --login
? What's your GCP Project ID skeet-pj
? What's your Firebase Project ID skeet-pj
? Select Regions to deploy us-west1

Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=1036766926&redirect_uri=http%3A%2F%2Flocalhost%3A9005&login_hint=xxx0gmail.com

Waiting for authentication...

✔  Success! Logged in as xxxx@gmail.com
Now using project skeet-pj

Appのデプロイ

% skeet create ApptestGC
? Select Template of Skeet Expo (React Native) - Firestore
Cloning into 'ApptestGC'...
remote: Enumerating objects: 2958, done.
remote: Counting objects: 100% (156/156), done.
remote: Compressing objects: 100% (103/103), done.
remote: Total 2958 (delta 63), reused 110 (delta 45), pack-reused 2802
Receiving objects: 100% (2958/2958), 20.85 MiB | 11.14 MiB/s, done.
Resolving deltas: 100% (1636/1636), done.
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "react-native > react-native-codegen > jscodeshift@0.13.1" has unmet peer dependency "@babel/preset-env@^7.1.6".
warning "react-native-utilities > react-native@0.42.3" has incorrect peer dependency "react@~15.4.1".
warning " > babel-loader@9.1.2" has unmet peer dependency "webpack@>=5".
warning "eas-cli > @expo/prebuild-config@5.0.7" has unmet peer dependency "expo-modules-autolinking@>=0.8.1".
warning " > tailwindcss@3.3.1" has unmet peer dependency "postcss@^8.0.9".
warning " > ts-loader@9.4.2" has unmet peer dependency "webpack@^5.0.0".
^[####################################################################################################################################---------------------------------------------^[##########################################################^[#############################################---------------------------------] 93430/148112^[####################################################################################################################################---------------------------------------------^[##########################################################^[#############################################---------------------------------] 93430/148112^[####################################################################################################################################---------------------------------------------^[####################################################################################################################################---------------------------------------------^[##########################################################^[#############################################^[#############################################---------------------------------] 93430/148112^[####################################################################################################################################---------------------------------------------^[##########################################################^[#############################################^[##########################################################^[##########^[##########################################################^[##########################################################^[##################################^[#####################################################################^[####################################################################################---------------------------------------------^[##########################################################^[#############################################---------------------------------] 93430/148112^[##########################################################^[##########################################################^[##################################^[##############################################################################################^[####################################################################################################################################---------------------------------------------^[#################################^[#################################################################################################---------------------------------------------^[##########################################################^[###################^[####################################################################################################################################---------------------------------------------^[##########################################################^[#####################################################################################################################^[###############################################################################^[####################################################################################################################################---------------------------------------------^[##########################################################^[#####################################################################################################################^[#############################################################################################################################################^[##################################^[#####################################################################################################################^[#########################################################################################################################################################################################^[###################################^[#####################################################################################################################^[############################################################################################################^[#####################################################################################################################^[################################################################################################################################################################################################-----------------------------------------^[#####################################################################################################################^[################################################################################################################################################################################################--------------------------------------------------------###################################################------------------------------------------------------------------------------] 93430/148112#####################################################################################################################################--------------------------------------------------------###################################################------------------------------------------------------------------------------] 93430/148112^[#####################################################################################################################^[################################################################################################################################################################################################--------------------------------------------------------^[#####################################################################################################################^[######################################################################################################################^[####################################################################################################################################------------------------------------------------------------------------------] 93430/14811^[#################################2^[#########^[#####################################################################################################################^[################################################^[#################################^[#############################################################################################################################################^[##########################################################################################################^[####################################################################################################################################-----------^[#################################^[#############################################################################################################################################^[######################################^[####################################################################################################################################----------------------------------------------^[###############################^[#################################^[#############################################################################################################################################^[######################################^[####################################################################################################################################----------------------------------------------^[###############################------------------------------------------------------------^[####################################################################################################################################-----#########################################################################^[###################################################################################################################################----------------------------------------------^[###############################------------------------------------------------------------] 93430/148112^[####################################################################################################################################-----#########################################################################^[#######################################################################################################------------------------------------------------------------] 93430/148112^[####################################################################################################################################----------------------------------------------^[########################^[#########################################------------------------------------------------------------] 93430/148112^[####################################################################################################################################----------------------------------------------^[########################^[####################################################################################################################################----------------------------------------------^[##############################################################################################################################################################################################################################################------------------------------------------------------------------------------]93430/148112 93430/148112^[####################################################################################################################################----------------------------------------------^[####################################################################################################################################----------------------------------------------------------------------^[####################################################################################################################################-------------------------###----------------------------------------------------------------------^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112^[############^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112^[######################^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112^[############^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112#####################################################################################################------------------------------------------------------------------------------] 93430/148112##################################################################------------------------------------------------------------------------------] 93430/148112^[######################^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112^[################################################################################################################################################################################################------------------------------------------------------------------------------] 93430/148112^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112^[##################################################################################^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112-----------------------------] 93430/148112^[####################################################################################################################################----------##################################################------------------------------------------------------------------------------] 93430/148112^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112^[##################################################################################################################^^[#############################################################----------^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112##################----------^[####################################################################################################################################------------------------------------------------------------------------------] 93430/1481128112##################----------^[####################################################################################################################################------------------------------------------------------------------------------] 93430/148112##################^^[#############################################################^^[#############################################################^^[#############################################################^^[#############################################################^^[#############################################################^^[#############################################################^^[#############################################################^^[#############################################################^^[#############################################################^^[#############################################################^^[#################################################################################################################################################------------------------------------------------------------------------------] 93430/148112^^[#############################################################^#######################################################################------------------------------------------------------------------------------] 93430/148112^
[4/4] 🔨  Building fresh packages...
✨  Done in 111.54s.
yarn install v1.22.19
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[#################################################################################################################################################################################----------------------------------] 29227/34804^
[5/5] 🔨  Building fresh packages...
✨  Done in 24.91s.
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 1.22s.
 🕺 Generating init files... ⠇
   _____ __ __ __________________
  / ___// //_// ____/ ____/_  __/
  \__ \/ ,<  / __/ / __/   / /
 ___/ / /| |/ /___/ /___  / /
/____/_/ |_/_____/_____/ /_/    🛠️🛠️

⚡⚡⚡ Buidl TypeScript Fullstack App Fast ⚡⚡⚡

$ cd ApptestGC
$ skeet s
Go To : http://127.0.0.1:4000/

ChatGPT API Keyの登録

作成したAppのフォルダからコマンド打つとAPIKeyの入力を求められる
API Keyの作成はここから
https://platform.openai.com/account/api-keys

ApptestGC % skeet add secret CHAT_GPT_KEY
? Enter a value for CHAT_GPT_KEY [hidden]
/secrets/CHAT_GPT_KEY/versions/1

ChatGPT Organization IDの登録

作成したAppのフォルダからコマンド打つとOrgIDの入力を求められる
Organization IDの確認はここから
https://platform.openai.com/account/org-settings

ApptestGC % skeet add secret CHAT_GPT_ORG
? Enter a value for CHAT_GPT_ORG [hidden]
/secrets/CHAT_GPT_ORG/versions/2

Appの実行

% cd ApptestGC
ApptestGC % skeet s
yarn run v1.22.19
$ run-p skeet:*
$ yarn webapp
$ firebase emulators:start --import=./tmp/data --export-on-exit
$ yarn build:development:webapp
$ yarn --cwd functions/skeet dev
$ EXPO_USE_PATH_ALIASES=1 expo start --web
$ expo export:web --dev
$ nodemon
[nodemon] 3.0.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/*
[nodemon] watching extensions: ts,mjs,js,json
[nodemon] starting `yarn nodemon`
$ npx ts-node devBuild.ts && node ./dist/index.js
Starting project at /Users/k.calc.cca1129/ApptestGC
Exporting with Webpack...
Starting Metro Bundler
Web Bundling Javascript [======                                                          ] 10%Starting Webpack on port 19006 in development mode.
npm WARN exec The following package was not found and will be installed: ts-node@10.9.1lTree:1bf7c3c15bf47d04: sill idealTree buildDeps
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▀▄█▀ ██  █ ▄▄▄▄▄ █
█ █   █ █▄   ▄█▄▄██ █   █ █
█ █▄▄▄█ █ ▀█▀█▀▀ ██ █▄▄▄█ █
█▄▄▄▄▄▄▄█ ▀▄█ █ ▀ █▄▄▄▄▄▄▄█
█▄ █▄▀█▄▄▀█ ▀█▄▀██▀  ▄▀▄▄▀█
███▄█ ▄▄  ▄▄██▀ ▀▄▄▀ ▀▀█▄▄█
█▄▀▀  █▄ ▄█▀▀ ▄ █▀█ ▄█ ██▀█
█▄▀  ██▄▄▄▀▄█ ▀▀█ ▄▄ ▀▀██▄█
█▄▄█▄▄█▄█▀ █▄▄█▄  ▄▄▄ █ ▄ █
█ ▄▄▄▄▄ █▄▄ ▀▄█   █▄█  ▀▄▄█
█ █   █ █▀█ ▄█ ▀▀▄ ▄▄ █▀▄██
█ █▄▄▄█ █▀▀▀█▄  █  █▄  ▄█▄█
█▄▄▄▄▄▄▄█▄████▄▄█▄███▄▄█▄▄█

› Metro waiting on exp://192.168.10.19:19000
› Scan the QR code above with Expo Go (Android) or the Camera app (iOS)

› Web is waiting on http://localhost:19006

› Press a │ open Android
› Press i │ open iOS simulator
› Press w │ open web

› Press j │ open debugger
› Press r │ reload app
› Press m │ toggle menu

› Press ? │ show all commands

(#########⠂�Logs for your project will appear below. Press Ctrl+C to exit.Completed in 1295ms
(node:97989) [DEP_WEBPACK_DEV_SERVER_CONSTRUCTOR] DeprecationWarning: Using 'compiler' as the first argument is deprecated. Please use 'options' as the first argument and 'compiler' as the second argument.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:97989) [DEP_WEBPACK_DEV_SERVER_LISTEN] DeprecationWarning: 'listen' is deprecated. Please use the async 'start' or 'startCallback' method.
i  emulators: Starting emulators: auth, functions, firestore, hosting, pubsub, storage
⚠  emulators: Could not find import/export metadata file, skipping data import!
⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database
i  firestore: downloading cloud-firestore-emulator-v1.17.4.jar...
Waiting for Watchman `watch-project` (10s)...
Progress: =============================================================================================================================================================================================================================================> (100% of 65MB)
i  firestore: Firestore Emulator logging to firestore-debug.log
[nodemon] clean exit - waiting for changes before restart
✔  firestore: Firestore Emulator UI websocket is running on 9150.
Watchman `watch-project` finished after 13.7s.
Waiting for Watchman `query` (13s)...
Web Bundling Javascript [========                                                        ] 12%i  pubsub: downloading pubsub-emulator-0.7.1.zip...
Progress: =============================================================================================================================================================================================================================================> (100% of 66MB)
Watchman `query` finished after 25.4s.
Web Bundling Javascript [========                                                        ] 13%i  pubsub: Pub/Sub Emulator logging to pubsub-debug.log
i  storage: downloading cloud-storage-rules-runtime-v1.1.3.jar...
Progress: =============================================================================================================================================================================================================================================> (100% of 53MB)
Web Bundling Javascript [=============                                                   ] 20%i  hosting[skeet-pj]: Serving hosting files from: web-build
✔  hosting[skeet-pj]: Local server: http://127.0.0.1:8000
i  ui: downloading ui-v1.11.6.zip...
Progress: ==============================================================================================================================================================================================================================================> (100% of 4MB)
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "/Users/k.calc.cca1129/ApptestGC/functions/skeet" for Cloud Functions...
Web Bundling Javascript [================                                                ] 25%✔  functions: Using node@18 from host.
Web Bundling Javascript [=================                                               ] 27%✔  functions: Loaded functions definitions from source: addStreamUserChatRoomMessage, addUserChatRoomMessage, addVertexMessage, authOnCreateUser, createUserChatRoom.
✔  functions[us-central1-addStreamUserChatRoomMessage]: http function initialized (http://127.0.0.1:5001/skeet-pj/us-central1/addStreamUserChatRoomMessage).
✔  functions[us-central1-addUserChatRoomMessage]: http function initialized (http://127.0.0.1:5001/skeet-pj/us-central1/addUserChatRoomMessage).
✔  functions[us-central1-addVertexMessage]: http function initialized (http://127.0.0.1:5001/skeet-pj/us-central1/addVertexMessage).
✔  functions[us-central1-authOnCreateUser]: auth function initialized.
✔  functions[us-central1-createUserChatRoom]: http function initialized (http://127.0.0.1:5001/skeet-pj/us-central1/createUserChatRoom).

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://127.0.0.1:4000/               │
└─────────────────────────────────────────────────────────────┘

┌────────────────┬────────────────┬─────────────────────────────────┐
│ Emulator       │ Host:Port      │ View in Emulator UI             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4000/auth      │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Functions      │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Firestore      │ 127.0.0.1:8080 │ http://127.0.0.1:4000/firestore │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Hosting        │ 127.0.0.1:8000 │ n/a                             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Pub/Sub        │ 127.0.0.1:8085 │ n/a                             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Storage        │ 127.0.0.1:9199 │ http://127.0.0.1:4000/storage   │
└────────────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub running at 127.0.0.1:4400
  Other reserved ports: 4500, 9150

アプリの動作確認

正常に起動した場合、しばらく待っているとWebブラウザが表示され、ログイン画面が出てくる
ブラウザが開かない場合は、CLIコンソールからアクセス先を確認する

✔  hosting[skeet-pj]: Local server: http://127.0.0.1:8000
View Emulator UI at http://127.0.0.1:4000/

貼り付けた画像_2023_09_11_16_32.png

ユーザの追加

Register your accoutをクリック
貼り付けた画像_2023_09_11_17_16.png

Email/Passwordを入力し、Agreeのチェックボックスを入れ、Registerする
貼り付けた画像_2023_09_11_16_34.png

メールの確認を求められるが、エミュレータ環境なので実際にメールは飛んでいないので、CLIに戻る
image.png

ログは色々表示されているが、先ほど追加したユーザのverify the emailのログがあるので確認
そこに記載されている、URLにアクセスすることで、ユーザ登録の認証を行う

To verify the email address xxxxx@gmail.com, follow this link:

http://127.0.0.1:9099/emulator/action?mode=verifyEmail&lang=en&oobCode=ula9EgoNlmgGELYpMrpMOEvwuA6qRSfLIbU3PChmgzo1h7P1RKrhGh&a
piKey=fake-api-key

URLにアクセスすればOK
貼り付けた画像_2023_09_11_17_20.png

ログイン確認

登録したユーザでログインする
貼り付けた画像_2023_09_11_17_23.png

ログイン後のTOPページ
image.png

Chatの作成

ログイン後、画面左上の「New Chat」より新しいチャットの作成ができる
貼り付けた画像_2023_09_11_17_25.png

gpt-4やgpt-3.5を選択できる
image.png

実際にChatGPTとチャットが可能
image.png

エミュレータの停止

Ctrl-Cで停止

i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i  Automatically exporting data using --export-on-exit "./tmp/data" please wait for the export to finish...

Gracefully shutting down from SIGINT (Ctrl+C)
i  Found running emulator hub for project skeet-pj at http://127.0.0.1:4400
i  Exporting data to: /Users/k.calc.cca1129/ApptestGC/tmp/data
i  emulators: Received export request. Exporting data to /Users/k.calc.cca1129/ApptestGC/tmp/data.
ApptestGC % ✔  emulators: Export complete.
✔  Export complete
i  emulators: Shutting down emulators.
i  ui: Stopping Emulator UI
⚠  Emulator UI has exited upon receiving signal: SIGINT
i  functions: Stopping Functions Emulator
i  hosting: Stopping Hosting Emulator
i  firestore: Stopping Firestore Emulator
i  pubsub: Stopping Pub/Sub Emulator
i  auth: Stopping Authentication Emulator
i  storage: Stopping Storage Emulator
⚠  Pub/Sub Emulator has exited upon receiving signal: SIGKILL
i  eventarc: Stopping Eventarc Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator
^@^@^@

VertexAIの利用

Google CloudのVertexAIも使うことができるので、テストする

ApptestGC % skeet iam ai
Generating AI Permissions...

gcloud iam service-accounts describe ApptestGC@skeet-pj.iam.gserviceaccount.com --project skeet-pj --format="value(email)"
Account exists: ApptestGC@skeet-pj.iam.gserviceaccount.com

created key [33a2bae671e91bcac63b40c4c8c4514ca28e3ecb] of type [json] as [./keyfile.json] for [ApptestGC@skeet-pj.iam.gserviceaccount.com]
Updated IAM policy for project [skeet-pj].
bindings:
- members:
  - serviceAccount:ApptestGC@skeet-pj.iam.gserviceaccount.com
  role: roles/aiplatform.admin
- members:
  - serviceAccount:ApptestGC@skeet-pj.iam.gserviceaccount.com
  role: roles/cloudtranslate.admin
- members:
  - serviceAccount:firebase-service-account@firebase-sa-management.iam.gserviceaccount.com
  - serviceAccount:service-93892686520@gcp-sa-firebase.iam.gserviceaccount.com
  role: roles/firebase.managementServiceAgent
- members:
  - serviceAccount:firebase-adminsdk-wd87b@skeet-pj.iam.gserviceaccount.com
  role: roles/firebase.sdkAdminServiceAgent
- members:
  - serviceAccount:firebase-adminsdk-wd87b@skeet-pj.iam.gserviceaccount.com
  role: roles/firebaseauth.admin
- members:
  - serviceAccount:service-93892686520@firebase-rules.iam.gserviceaccount.com
  role: roles/firebaserules.system
- members:
  - serviceAccount:firebase-adminsdk-wd87b@skeet-pj.iam.gserviceaccount.com
  role: roles/iam.serviceAccountTokenCreator
- members:
  - serviceAccount:ApptestGC@skeet-pj.iam.gserviceaccount.com
  role: roles/iam.serviceAccountUser
- members:
  - user:xxx@gmail.com
  role: roles/owner
- members:
  - serviceAccount:service-93892686520@gcp-sa-pubsub.iam.gserviceaccount.com
  role: roles/pubsub.serviceAgent
etag: BwYFEIgBDFQ=
version: 1
Updated IAM policy for project [skeet-pj].
bindings:
- members:
  - serviceAccount:ApptestGC@skeet-pj.iam.gserviceaccount.com
  role: roles/aiplatform.admin
- members:
  - serviceAccount:ApptestGC@skeet-pj.iam.gserviceaccount.com
  role: roles/cloudtranslate.admin
- members:
  - serviceAccount:firebase-service-account@firebase-sa-management.iam.gserviceaccount.com
  - serviceAccount:service-93892686520@gcp-sa-firebase.iam.gserviceaccount.com
  role: roles/firebase.managementServiceAgent
- members:
  - serviceAccount:firebase-adminsdk-wd87b@skeet-pj.iam.gserviceaccount.com
  role: roles/firebase.sdkAdminServiceAgent
- members:
  - serviceAccount:firebase-adminsdk-wd87b@skeet-pj.iam.gserviceaccount.com
  role: roles/firebaseauth.admin
- members:
  - serviceAccount:service-93892686520@firebase-rules.iam.gserviceaccount.com
  role: roles/firebaserules.system
- members:
  - serviceAccount:firebase-adminsdk-wd87b@skeet-pj.iam.gserviceaccount.com
  role: roles/iam.serviceAccountTokenCreator
- members:
  - serviceAccount:ApptestGC@skeet-pj.iam.gserviceaccount.com
  role: roles/iam.serviceAccountUser
- members:
  - user:xxxx@gmail.com
  role: roles/owner
- members:
  - serviceAccount:service-93892686520@gcp-sa-pubsub.iam.gserviceaccount.com
  role: roles/pubsub.serviceAgent
etag: BwYFEIgwaPM=
version: 1
Updated IAM policy for project [skeet-pj].
bindings:
- members:
  - serviceAccount:ApptestGC@skeet-pj.iam.gserviceaccount.com
  role: roles/aiplatform.admin
- members:
  - serviceAccount:ApptestGC@skeet-pj.iam.gserviceaccount.com
  role: roles/cloudtranslate.admin
- members:
  - serviceAccount:firebase-service-account@firebase-sa-management.iam.gserviceaccount.com
  - serviceAccount:service-93892686520@gcp-sa-firebase.iam.gserviceaccount.com
  role: roles/firebase.managementServiceAgent
- members:
  - serviceAccount:firebase-adminsdk-wd87b@skeet-pj.iam.gserviceaccount.com
  role: roles/firebase.sdkAdminServiceAgent
- members:
  - serviceAccount:firebase-adminsdk-wd87b@skeet-pj.iam.gserviceaccount.com
  role: roles/firebaseauth.admin
- members:
  - serviceAccount:service-93892686520@firebase-rules.iam.gserviceaccount.com
  role: roles/firebaserules.system
- members:
  - serviceAccount:firebase-adminsdk-wd87b@skeet-pj.iam.gserviceaccount.com
  role: roles/iam.serviceAccountTokenCreator
- members:
  - serviceAccount:ApptestGC@skeet-pj.iam.gserviceaccount.com
  role: roles/iam.serviceAccountUser
- members:
  - user:xxxx@gmail.com
  role: roles/owner
- members:
  - serviceAccount:service-93892686520@gcp-sa-pubsub.iam.gserviceaccount.com
  role: roles/pubsub.serviceAgent
etag: BwYFEIhqLFU=
version: 1
🚸 === Copy & Paste below command to your terminal === 🚸

export GCLOUD_PROJECT=skeet-pj
export REGION="us-central1"

🚸 =========           END           ========= 🚸


✔ Successfully Setup AI Permissions 🎉

PJ-IDとREGIONの設定をする

export GCLOUD_PROJECT=skeet-pj
export REGION="us-central1"

VertexAIを起動し、チャットしてみる

ApptestGC % skeet ai
╔═════════════╤════════════════╗
│ Option      │ Value          │
╟─────────────┼────────────────╢
│ AI Type     │ VertexAI       │
╟─────────────┼────────────────╢
│ Model       │ chat-bison@001 │
╟─────────────┼────────────────╢
│ Max Token   │ 1000           │
╟─────────────┼────────────────╢
│ Temperature │ 0              │
╚═════════════╧════════════════╝

🤖 Skeet AI Mode
 `$ <mode>` to change AI mode 🤖

$ prisma
$ typedoc
$ translate
$ firestore
$ function
$ method
$ help
$ q

VertexAI is selected 🤖 (type 'q' to quit)


? What can I do for you?

You: hello
Skeet:
Hello! How can I help you?
2
0
0

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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?