8
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 Colab】OpenAI APIのTypeError: Client.init() got an unexpected keyword argument 'proxies'解消方法

Posted at

はじめに

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
8
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
8
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?