木曜日, 6月 5, 2025
- Advertisment -
ホームニューステックニュース【Google Colab】OpenAI APIのTypeError: Client.init() got an unexpected keyword argument 'proxies'解消方法 #Python

【Google Colab】OpenAI APIのTypeError: Client.init() got an unexpected keyword argument ‘proxies’解消方法 #Python



【Google Colab】OpenAI APIのTypeError: Client.init() got an unexpected keyword argument 'proxies'解消方法 #Python

はじめに

UdemyのRAG実装講座をGoogleColabで実行したときに発生しました。

エラー内容

from openai import OpenAI
client = OpenAI() # エラー発生
TypeError: Client.init() got an unexpected keyword argument 'proxies'

原因

実装講座で指定のopenaiバージョン(1.25.1)とGoogleColab実行環境のHTTPX(HTTP通信のライブラリ)が不整合を起こしている

# 2025年6月現在のバージョン
!pip show httpx
> Name: httpx
> Version: 0.28.1

まとめ

・OpenAI 1.25.1:proxies(複数形)を使用
・httpx0.28.1:proxy(単数形)パラメータを使用

解決方法

proxiesを使用しているhttpxバージョンにダウングレード

!pip install httpx==0.27.0 --force-reinstall





Source link

Views: 1

RELATED ARTICLES

返事を書く

あなたのコメントを入力してください。
ここにあなたの名前を入力してください

- Advertisment -