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

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

Open
jackie-pc opened this issue Nov 28, 2023 · 2 comments
Open

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

jackie-pc opened this issue Nov 28, 2023 · 2 comments

Comments

@jackie-pc
Copy link
Contributor

jackie-pc commented Nov 28, 2023

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()

@masenf
Copy link
Collaborator

masenf commented Nov 28, 2023

We just set something for that var during CI:

export OPENAI_API_KEY="dummy"

Maybe we should update these examples to use the function-wrapper workaround?

@jackie-pc
Copy link
Contributor Author

Agree we should update examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants