- Notifications
You must be signed in to change notification settings - Fork2k
Support OPENAI_BASE_URL in tracing#997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think this is generally not a safe backwards compatible change. For example, environments may setOPENAI_BASE_URL
to a proxy to allow tracing/cost tracking, but that proxy doens't necessarily support tracing (since only thje specific openai api supports it). Would prefer something more explicit where users opt-in to setting the tracing url.
Nod, I searched around a fair bit to see if OpenAI had any variable or name for the tracing endpoint, and couldn't find one, so I decided to piggyback instead. Given the lasting nature of an env var name like this, it seems like something y'all should define, rather than me. |
Also since the token is shared for API access and tracing access, I am not sure how a proxy would work that doesn't support both. It would be somewhat odd to give someone a real OpenAI token, then tell them to use a proxy with a different token instead. |
@rm-openai Do you think |
Yeah let's add a URL method similar to |
Agent tracing was hardcoded against the API endpoint, so any client using a proxy or alternate route to the OpenAI AI endpoint would encounter errors.
So this modify the tracing init code to use
OPENAI_BASE_URL
when present, if the local environment hasn't overridden anything.Note: Because this code path is generally executed at import time, the environment variable needs to be set prior to importing any openai-agents code.