Skip to content

Commit

Permalink
suppress openai warning
Browse files Browse the repository at this point in the history
  • Loading branch information
MadcowD committed Aug 7, 2024
1 parent 9890e0d commit 630d5f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ell/models/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ def register_openai_models(client: openai.Client):
for model_id, owned_by in model_data:
config.register_model(model_id, client)

default_client = openai.Client()
try:
default_client = openai.Client()
except openai.OpenAIError as e:
# TODO: Provide warning here.
import os
default_client = openai.Client(api_key=os.environ.get("OPENAI_API_KEY", ""))
register_openai_models(default_client)
config._default_openai_client = default_client
# assert openai.api_key is not None
Expand Down

0 comments on commit 630d5f8

Please sign in to comment.