1. Pythonライブラリのインストール
pip install google-cloud-aiplatform Successfully installed google-auth-2.25.2 google-cloud-aiplatform-1.38.1 google-cloud-resource-manager-1.11.0 google-cloud-storage-2.14.0 google-resumable-media-2.7.0 grpc-google-iam-v1-0.13.0 shapely-2.0.2
2. サンプルのテスト
テストプログラム作成
vi gemini_test.py
コード抜粋
chat = chat_model.start_chat(
context="My name is Miles. You are an astronomer, knowledgeable about the solar system.",
examples=[
InputOutputTextPair(
input_text="How many moons does Mars have?",
output_text="The planet Mars has two moons, Phobos and Deimos.",
),
],
)
- 実行
Google Cloud上のサーバで実行しました。
python3 gemini_test.py
- ちゃんと結果が来た
Response from Model: There are eight planets in the solar system: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune.

