Skip to content

GPT example should not need OPENAI_API_KEY at export time. #177

@jackie-pc

Description

@jackie-pc

openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

Solution is probably just to defer client instantiation by one function call.

client = OpenAI()
to become

def get_client():
    return OpenAI()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions