Inconsistent base_url behavior with module client and OpenAIClient
メンテナーはふだん 1 日以内に返信
@SmartManoj がすでに取り組んでいます。
2025年3月2日 から。
評価
調査の方向性
まず、module client と OpenAI client で base_url がどのように扱われるかを追跡し、2つの再現用スニペットを動作比較に使用します。base URL に末尾のスラッシュがない場合でも、両方のクライアントが同じ有効な completion URL を構築するようにし、その後、2つの呼び出し経路が一貫したリクエストを生成することを確認します。
索引モデルが issue の本文から書いたものです。
説明
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
The issue is that the base_url in the OpenAI client enforces a trailing slash whereas setting the module openai.base_url does not enforce.
This is 100% reproducible and while it can be worked around, the inconsistency in clients causes issues in scripts that use both clients.
To Reproduce
- Create a module client and use a
base_urlwithout a trailing slash. See error with URL for completions - Create an OpenAIClient and use a
base_urlwithout a trailing slash. See no erros.
Code snippets
This works
client = openai.OpenAI(
api_key=my_key,
base_url="https://myllmserver.com/api/v1"
)
print(client.completions.create(
model="mistralai/Mistral-7B-Instruct-v0.2",
prompt="test"
))
This does not:
openai.base_url="https://myllmserver.com/api/v1"
openai.api_key=my_key
print(openai.completions.create(
model="mistralai/Mistral-7B-Instruct-v0.2",
prompt="test"
))
Error:
https://myllmserver.com/api/v1completions "HTTP/1.1 404 Not Found"
OS
macOS
Python version
Python v3.12
Library version
openai v1.23.6
- 主要言語
- Python
- スター
- 31.8k
- フォーク
- 8k
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 137
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openai/openai-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
openai/openai-python#4022 · コメント 19 件 ·
メンテナーはふだん 1 日以内に返信
-
fix(auth): SubjectTokenProviderError drops response and duplicates error message in workload identity providers対応中かも @mohmedmm が 12 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
openai/openai-python#4017 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Querystring drops explicit empty-string scalar values対応中かも @sylvesterkaczmarek が 34 日前に担当しました。 オープンsdk-breaking-change v4
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
openai/openai-python#3837 ·
メンテナーはふだん 1 日以内に返信
-
Define + export `ServiceTiers` string literal対応中かも @SparshGarg999 が 61 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
openai/openai-python#3556 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Empty OPENAI_BASE_URL prevents fallback to default API endpoint対応中かも @Sehastrajit-S が 27 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
openai/openai-python#2927 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
openai/openai-python の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Deltares/imod-python#1940 ·
メンテナーはふだん 1 日以内に返信
-
effort: low prio: low ready
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
digitalfabrik/integreat-cms#4621 ·
メンテナーはふだん 5 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
ioos/compliance-checker#1375 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
netbox status: backlog topic: testing type: housekeeping
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
netbox-community/netbox#23395 ·
メンテナーはふだん 1 日以内に返信