0
1

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 Geminiを使ってみた!

Last updated at Posted at 2023-12-16

はじめに

Google が ChatGPTに対抗してリリースする Google Geminiを使ってみました。
無料枠に非常にお世話になっているので、Google大先生には感謝してます。

いろんなナレッジを生かして、投資サイトを作ろうと画策してます

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
https://cloud.google.com/vertex-ai/docs/generative-ai/chat/test-chat-prompts?hl=ja
を貼り付け

質問部分だけリストアップ

 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.

あとは翻訳APIにかませてください

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?