Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default OPENAI_TRACE_API_KEY set error #121

Closed
xulicong-patsnap opened this issue Mar 13, 2025 · 1 comment · Fixed by #146
Closed

default OPENAI_TRACE_API_KEY set error #121

xulicong-patsnap opened this issue Mar 13, 2025 · 1 comment · Fixed by #146
Labels
bug Something isn't working

Comments

@xulicong-patsnap
Copy link

class BackendSpanExporter(TracingExporter):
def init(
self,
api_key: str | None = None,
organization: str | None = None,
project: str | None = None,
endpoint: str = "https://api.openai.com/v1/traces/ingest",
max_retries: int = 3,
base_delay: float = 1.0,
max_delay: float = 30.0,
):
"""
Args:
api_key: The API key for the "Authorization" header. Defaults to
os.environ["OPENAI_TRACE_API_KEY"] if not provided.
organization: The OpenAI organization to use. Defaults to
os.environ["OPENAI_ORG_ID"] if not provided.
project: The OpenAI project to use. Defaults to
os.environ["OPENAI_PROJECT_ID"] if not provided.
endpoint: The HTTP endpoint to which traces/spans are posted.
max_retries: Maximum number of retries upon failures.
base_delay: Base delay (in seconds) for the first backoff.
max_delay: Maximum delay (in seconds) for backoff growth.
"""
self.api_key = api_key or os.environ.get("OPENAI_API_KEY") # should be OPENAI_TRACE_API_KEY, right ?
self.organization = organization or os.environ.get("OPENAI_ORG_ID")
self.project = project or os.environ.get("OPENAI_PROJECT_ID")

get the wrong environment variable.

@xulicong-patsnap xulicong-patsnap added the bug Something isn't working label Mar 13, 2025
@rm-openai
Copy link
Collaborator

Thanks for the report. Actually the documentation is wrong, updated here: #146

nakasy000 pushed a commit to nakasy000/openai-agents-python that referenced this issue Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants