Skip to content

default OPENAI_TRACE_API_KEY set error #121

Closed
@xulicong-patsnap

Description

@xulicong-patsnap

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions