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

[Google Cloud][Gemini]gemini-pro-experimental使ってみた

Posted at

はじめに

Gemini Pro Experimaentalが来たという話を聞いたので、使ってみました

コンソール利用

gemini-flash-experimental、gemini-pro-experimentalが選択できるようになってます

スクリーンショット 2024-08-29 22.14.47.png

experimentalを選択すると、リージョンが選択できなくなります。(理由はわからず。
Funcitonsの項目が追加されています。

スクリーンショット 2024-08-29 22.51.58.png

API利用

#/bin/bash

LOCATION="us-central1"
MODEL_ID="gemini-pro-experimental" #モデル変えるだけ!
PROJECT_ID="test-project"
GENERATE_RESPONSE_METHOD="generateContent"

curl \
-X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://${LOCATION}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/publishers/google/models/${MODEL_ID}:${GENERATE_RESPONSE_METHOD} -d \
$'{
  "contents": [
    {
    "role": "user",
    "parts": { "text": "Hello!" }
    },
    {
    "role": "model",
    "parts": { "text": "Argh! What brings ye to my ship?" }
    },
    {
    "role": "user",
    "parts": { "text": "Wow! You are a real-life pirate!" }
    }
  ],
  "safety_settings": {
    "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
    "threshold": "BLOCK_LOW_AND_ABOVE"
  },
  "generation_config": {
    "temperature": 0.9,
    "topP": 1,
    "candidateCount": 1,
    "maxOutputTokens": 2048
  }
}'

(参考)

東京リージョン(asia-northeast1)にリクエストすると404になりました。
us-central1はとりあえず使えるようです。
東京リージョンはもう少し待ちましょう。

最後に

まだあまり触れてないので、触ったら所感等更新したいと思います。

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