webmaster-kazu.com

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

【Python】MicrosoftのBing Chat AIのリバースエンジニアリングされたAPI「EdgeGPT」のインストール

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

【Python】MicrosoftのBing Chat AIのリバースエンジニアリングされたAPI「EdgeGPT」のインストールについて解説しています。

「EdgeGPT(https://github.com/acheong08/EdgeGPT)」は、PythonでMicrosoftのBing Chat AIが利用できるようになるライブラリです。なお、リバースエンジニアリングとはソフトウェアの動作を解析するなどし、ソースコードなどを調査することを言います。なお、このライブラリはMicrosoftが公式に配布しているライブラリではないことを理解しておいてください。

■Python

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

■EdgeGPTをインストールする

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

pip install EdgeGPT

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

py -3.8 -m pip install EdgeGPT

なお、今回は上記のPythonバージョンを指定したコマンドを入力し、WindowsにインストールしてあるPythonを切り替えてインストールする。そのためにEnterキーを押します。

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

Collecting EdgeGPT

Downloading EdgeGPT-0.4.4-py3-none-any.whl (16 kB)

Collecting BingImageCreator>=0.1.2.1

Downloading BingImageCreator-0.2.0-py3-none-any.whl (6.5 kB)

Collecting rich

Downloading rich-13.3.5-py3-none-any.whl (238 kB)

|████████████████████████████████| 238 kB 1.3 MB/s

Collecting websockets

Downloading websockets-11.0.3-cp38-cp38-win_amd64.whl (124 kB)

|████████████████████████████████| 124 kB 1.6 MB/s

Collecting httpx

Downloading httpx-0.24.0-py3-none-any.whl (75 kB)

|████████████████████████████████| 75 kB 2.6 MB/s

Collecting requests

Downloading requests-2.30.0-py3-none-any.whl (62 kB)

|████████████████████████████████| 62 kB 2.3 MB/s

Collecting certifi

Downloading certifi-2023.5.7-py3-none-any.whl (156 kB)

|████████████████████████████████| 156 kB 2.2 MB/s

Collecting prompt-toolkit

Downloading prompt_toolkit-3.0.38-py3-none-any.whl (385 kB)

|████████████████████████████████| 385 kB 2.2 MB/s

Collecting regex

Downloading regex-2023.5.5-cp38-cp38-win_amd64.whl (267 kB)

|████████████████████████████████| 267 kB 2.2 MB/s

Collecting aiohttp

Downloading aiohttp-3.8.4-cp38-cp38-win_amd64.whl (324 kB)

|████████████████████████████████| 324 kB 1.3 MB/s

Collecting aiosignal>=1.1.2

Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 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

Downloading multidict-6.0.4-cp38-cp38-win_amd64.whl (28 kB)

Collecting charset-normalizer<4.0,>=2.0

Using cached charset_normalizer-3.1.0-cp38-cp38-win_amd64.whl (96 kB)

Collecting yarl<2.0,>=1.0

Downloading yarl-1.9.2-cp38-cp38-win_amd64.whl (61 kB)

|████████████████████████████████| 61 kB 37 kB/s

Collecting attrs>=17.3.0

Using cached attrs-23.1.0-py3-none-any.whl (61 kB)

Collecting frozenlist>=1.1.1

Downloading frozenlist-1.3.3-cp38-cp38-win_amd64.whl (34 kB)

Collecting idna>=2.0

Using cached idna-3.4-py3-none-any.whl (61 kB)

Collecting httpcore<0.18.0,>=0.15.0

Downloading httpcore-0.17.1-py3-none-any.whl (70 kB)

|████████████████████████████████| 70 kB 4.8 MB/s

Collecting sniffio

Downloading sniffio-1.3.0-py3-none-any.whl (10 kB)

Collecting h11<0.15,>=0.13

Downloading h11-0.14.0-py3-none-any.whl (58 kB)

|████████████████████████████████| 58 kB 1.1 MB/s

Collecting anyio<5.0,>=3.0

Downloading anyio-3.6.2-py3-none-any.whl (80 kB)

|████████████████████████████████| 80 kB 2.6 MB/s

Collecting wcwidth

Downloading wcwidth-0.2.6-py2.py3-none-any.whl (29 kB)

Collecting urllib3<3,>=1.21.1

Downloading urllib3-2.0.2-py3-none-any.whl (123 kB)

|████████████████████████████████| 123 kB 2.2 MB/s

Collecting pygments<3.0.0,>=2.13.0

Downloading Pygments-2.15.1-py3-none-any.whl (1.1 MB)

|████████████████████████████████| 1.1 MB 2.2 MB/s

Collecting typing-extensions<5.0,>=4.0.0

Downloading typing_extensions-4.5.0-py3-none-any.whl (27 kB)

Collecting markdown-it-py<3.0.0,>=2.2.0

Downloading markdown_it_py-2.2.0-py3-none-any.whl (84 kB)

|████████████████████████████████| 84 kB 1.2 MB/s

Collecting mdurl~=0.1

Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)

Installing collected packages: sniffio, multidict, idna, frozenlist, yarl, urllib3, mdurl, h11, charset-normalizer, certifi, attrs, async-timeout, anyio, aiosignal, wcwidth, typing-extensions, requests, regex, pygments, markdown-it-py, httpcore, aiohttp, websockets, rich, prompt-toolkit, httpx, BingImageCreator, EdgeGPT

WARNING: The script normalizer.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.

WARNING: The script pygmentize.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.

WARNING: The script markdown-it.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.

WARNING: The script httpx.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.

WARNING: The scripts edge-gpt-image.exe and edge-gpt.exe are 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 BingImageCreator-0.2.0 EdgeGPT-0.4.4 aiohttp-3.8.4 aiosignal-1.3.1 anyio-3.6.2 async-timeout-4.0.2 attrs-23.1.0 certifi-2023.5.7 charset-normalizer-3.1.0 frozenlist-1.3.3 h11-0.14.0 httpcore-0.17.1 httpx-0.24.0 idna-3.4 markdown-it-py-2.2.0 mdurl-0.1.2 multidict-6.0.4 prompt-toolkit-3.0.38 pygments-2.15.1 regex-2023.5.5 requests-2.30.0 rich-13.3.5 sniffio-1.3.0 typing-extensions-4.5.0 urllib3-2.0.2 wcwidth-0.2.6 websockets-11.0.3 yarl-1.9.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」と表示されます。これが表示されれば、EdgeGPTが正常にインストールされたことになります。なお、WARNING(警告)が出力されていますが、エラーではないので、今回は一旦無視しています。

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