-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed as not planned
Labels
bugSomething isn't workingSomething isn't working
Description
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
We've recently upgraded the openai client to >1.0.0 and found that our "organization switching" logic stopped working.
Before 1.0.0, organization was being set by setting global openai.organization
. All clients created used that as the default organization.
Post 1.0.0, the logic doesn't work.
Having the ability to set the property, but property not being used is very surprising.
To Reproduce
Snippet is below. I've used opentelemetry httpx instrumentation to intercept the request and verify that header is not being set.
Example headers after running the provided code below. Observe that there's no "Openai-organization" header set.
Headers({'host': 'api.openai.com', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'accept': 'application/json', 'content-type': 'application/json', 'user-agent': 'OpenAI/Python 1.3.5', 'x-stainless-lang': 'python', 'x-stainless-package-version': '1.3.5', 'x-stainless-os': 'MacOS', 'x-stainless-arch': 'arm64', 'x-stainless-runtime': 'CPython', 'x-stainless-runtime-version': '3.11.7', 'authorization': '[secure]', 'content-length': '84', 'sentry-trace': 'cf394dd2ce8b4682843e13cbf98782d1-894bb0e05b111a50', 'baggage': 'sentry-trace_id=cf394dd2ce8b4682843e13cbf98782d1,sentry-environment=development,sentry-release=unknown-development'})
Code snippets
import openai
openai.organization = "some_id"
from openai import OpenAI
client = OpenAI(
# Defaults to os.environ.get("OPENAI_API_KEY")
)
chat_completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": "Hello world"}]
)
OS
macOs
Python version
v3.11.7
Library version
openai 1.3.5
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working