Pythonランタイム(runtime)でのオブジェクトの生成を OpenAI GPT に依頼するライブラリ

スポンサーリンク

Pythonランタイム(runtime)でのオブジェクトの生成を OpenAI GPT に依頼するためのライブラリ「davinci-functions」のインストールについて解説しています。

「davinci-functions(https://github.com/odashi/davinci-functions)」は、Pythonプログラムに役立つプロンプトを記録するために用意されたPythonライブラリです。なお、このライブラリを使用するためには、OpenAI 組織 ID と API キーを設定する必要があります。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)

■davinci-functionsをインストールする

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

pip install davinci-functions

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

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、バージョンの切り替えを行います。

py -3.8 -m pip install davinci-functions

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable
Collecting davinci-functions
Downloading davinci_functions-0.1.4-py3-none-any.whl (9.0 kB)
Collecting openai>=0.27.0
Downloading openai-0.27.1.tar.gz (57 kB)
---------------------------------------- 57.3/57.3 kB 603.8 kB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Collecting dill>=0.3.6
Using cached dill-0.3.6-py3-none-any.whl (110 kB)
Requirement already satisfied: requests>=2.20 in c:\users\user_\appdata\roaming\python\python38\site-packages (from openai>=0.27.0->davinci-functions) (2.28.2)
Requirement already satisfied: tqdm in c:\users\user_\appdata\roaming\python\python38\site-packages (from openai>=0.27.0->davinci-functions) (4.64.1)
Collecting aiohttp
Using cached aiohttp-3.8.4-cp38-cp38-win_amd64.whl (324 kB)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests>=2.20->openai>=0.27.0->davinci-functions) (3.0.1)
Requirement already satisfied: idna<4,>=2.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests>=2.20->openai>=0.27.0->davinci-functions) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests>=2.20->openai>=0.27.0->davinci-functions) (1.26.14)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests>=2.20->openai>=0.27.0->davinci-functions) (2022.12.7)
Requirement already satisfied: attrs>=17.3.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from aiohttp->openai>=0.27.0->davinci-functions) (22.2.0)
Collecting frozenlist>=1.1.1
Using cached frozenlist-1.3.3-cp38-cp38-win_amd64.whl (34 kB)
Collecting async-timeout<5.0,>=4.0.0a3
Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting multidict<7.0,>=4.5
Using cached multidict-6.0.4-cp38-cp38-win_amd64.whl (28 kB)
Collecting yarl<2.0,>=1.0
Using cached yarl-1.8.2-cp38-cp38-win_amd64.whl (56 kB)
Collecting aiosignal>=1.1.2
Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Requirement already satisfied: colorama in c:\users\user_\appdata\roaming\python\python38\site-packages (from tqdm->openai>=0.27.0->davinci-functions) (0.4.6)
Building wheels for collected packages: openai
Building wheel for openai (pyproject.toml) ... done
Created wheel for openai: filename=openai-0.27.1-py3-none-any.whl size=70138 sha256=98311a635e73789a9a2cee0f4abdf0e919d8bb89f948e6751e66bd304be86347
Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\f3
Defaulting to user installation because normal site-packages is not writeable
Collecting davinci-functions
Downloading davinci_functions-0.1.4-py3-none-any.whl (9.0 kB)
Collecting openai>=0.27.0
Downloading openai-0.27.1.tar.gz (57 kB)
---------------------------------------- 57.3/57.3 kB 603.8 kB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Collecting dill>=0.3.6
Using cached dill-0.3.6-py3-none-any.whl (110 kB)
Requirement already satisfied: requests>=2.20 in c:\users\user_\appdata\roaming\python\python38\site-packages (from openai>=0.27.0->davinci-functions) (2.28.2)
Requirement already satisfied: tqdm in c:\users\user_\appdata\roaming\python\python38\site-packages (from openai>=0.27.0->davinci-functions) (4.64.1)
Collecting aiohttp
Using cached aiohttp-3.8.4-cp38-cp38-win_amd64.whl (324 kB)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests>=2.20->openai>=0.27.0->davinci-functions) (3.0.1)
Requirement already satisfied: idna<4,>=2.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests>=2.20->openai>=0.27.0->davinci-functions) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests>=2.20->openai>=0.27.0->davinci-functions) (1.26.14)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests>=2.20->openai>=0.27.0->davinci-functions) (2022.12.7)
Requirement already satisfied: attrs>=17.3.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from aiohttp->openai>=0.27.0->davinci-functions) (22.2.0)
Collecting frozenlist>=1.1.1
Using cached frozenlist-1.3.3-cp38-cp38-win_amd64.whl (34 kB)
Collecting async-timeout<5.0,>=4.0.0a3
Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting multidict<7.0,>=4.5
Using cached multidict-6.0.4-cp38-cp38-win_amd64.whl (28 kB)
Collecting yarl<2.0,>=1.0
Using cached yarl-1.8.2-cp38-cp38-win_amd64.whl (56 kB)
Collecting aiosignal>=1.1.2
Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Requirement already satisfied: colorama in c:\users\user_\appdata\roaming\python\python38\site-packages (from tqdm->openai>=0.27.0->davinci-functions) (0.4.6)
Building wheels for collected packages: openai
Building wheel for openai (pyproject.toml) ... done
Created wheel for openai: filename=openai-0.27.1-py3-none-any.whl size=70138 sha256=98311a635e73789a9a2cee0f4abdf0e919d8bb89f948e6751e66bd304be86347
Stored in directory: c:\users\user_\appdata\local\pip\cache\wheels\f3\0f\40\80d12fc510872db194d1890e383da7b9f7c5d26f2481db3a33
Successfully built openai
Installing collected packages: multidict, frozenlist, dill, async-timeout, yarl, aiosignal, aiohttp, openai, davinci-functions
Successfully installed aiohttp-3.8.4 aiosignal-1.3.1 async-timeout-4.0.2 davinci-functions-0.1.4 dill-0.3.6 frozenlist-1.3.3 multidict-6.0.4 openai-0.27.1 yarl-1.8.2
fd12fc510872db194d1890e383da7b9f7c5d26f2481db3a33 Successfully built openai Installing collected packages: multidict, frozenlist, dill, async-timeout, yarl, aiosignal, aiohttp, openai, davinci-functions Successfully installed aiohttp-3.8.4 aiosignal-1.3.1 async-timeout-4.0.2 davinci-functions-0.1.4 dill-0.3.6 frozenlist-1.3.3 multidict-6.0.4 openai-0.27.1 yarl-1.8.2

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、davinci-functionsが正常にインストールされたことになります。

なお、今回はdavinci-functionsのバージョン0.1.4をインストールしました。

コメント

タイトルとURLをコピーしました