webmaster-kazu.com

テクノロジー・データ分析・実践ログ・その他

【Python】生成AIサービスGoogle BARDで生成された返答を取得できる「BARD_API」のインストール

カテゴリ: Python【初歩から現場実務的なもの】

生成AIサービスGoogle BARDで生成された返答を取得できる「BARD_API」のインストールについて解説しています。

「BARD_API」(https://github.com/dsdanielpark/BARD_API)は、Google BARDのResponseをAPI経由で返すことができるPythonのライブラリです。なお、Googleが公式に配布しているライブラリではないことを理解しておいてください。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows11)

■BARD_APIをインストールする

BARD_APIをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install bardapi

起動後、上記のコマンドを入力し、Enterキーを押します。

py -3.8 -m pip install bardapi

なお、今回は上記のPythonバージョンを指定したコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable

Collecting bardapi

Downloading bardapi-0.1.2-py3-none-any.whl (4.2 kB)

Installing collected packages: bardapi

WARNING: The script bard_api.exe is installed in 'C:\Users\user_\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Successfully installed bardapi-0.1.2

WARNING: You are using pip version 21.1.1; however, version 23.1.2 is available.

You should consider upgrading via the 'C:\Program Files\Python38\python.exe -m pip install --upgrade pip' command.

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、BARD_APIが正常にインストールされたことになります。なお、WARNING(警告)が出力されていますが、エラーではないので、今回は一旦無視しています。

今回は、BARD_APIのバージョン0.1.2をインストールしました。