Closed1
VertexAIでリージョンごとに利用可能なモデルの一覧
毎回わからんくなるのでメモ。言語を英語にしないと情報が古い場合がある。
これで行けるんかなと思いきや・・・
from google.colab import userdata
from google import genai
client = genai.Client(
vertexai=True,
project=userdata.get("GOOGLE_CLOUD_PROJECT"),
location="asia-northeast1",
)
for model in client.models.list():
print(model.name, model.version)
出力
publishers/google/models/chat-bison 002
publishers/google/models/text-bison 002
publishers/google/models/multimodalembedding 001
publishers/google/models/textembedding-gecko 001
publishers/google/models/text-unicorn 001
publishers/google/models/code-gecko 002
publishers/google/models/code-bison 002
publishers/google/models/codechat-bison 002
publishers/google/models/imagegeneration 006
publishers/google/models/imagetext 001
publishers/google/models/image-segmentation-001 default
response = client.models.generate_content(
model="gemini-1.5-pro-002",
contents="太陽系で最大の惑星を教えて。"
)
print(response.text)
出力
太陽系最大の惑星は木星です。
出力されてないモデルでも使えるからなあ・・・
client.models.list()
は「ベースモデル」を取得するっぽいので、多分別のAPIがあるんだと思うけども・・・
現時点ではドキュメント見るほうが速い。
このスクラップは3ヶ月前にクローズされました
ログインするとコメントできます