You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the issue
Missing API keys show up in logs/errors as timeouts/retries that require an interruption to proceed.
Describe the solution you'd like
Could we surface a "missing api key" error that halts the script execution?
Additional context
from griptape.structures import Agent
agent = Agent()
agent.run('What are the colors of the rainbow?')
Results in:
[12/17/24 09:47:05] INFO PromptTask 688ec1b7830f4d6ebf2df8310b5c41e6
Input: What are the colors of the rainbow?
WARNING:root:<RetryCallState 4383057408: attempt #1; slept for 0.0; last result: failed (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)>
WARNING:root:<RetryCallState 4383057408: attempt #2; slept for 2.0; last result: failed (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)>
WARNING:root:<RetryCallState 4383057408: attempt #3; slept for 4.0; last result: failed (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)>
...<interrupted>
The text was updated successfully, but these errors were encountered:
I think failing faster would be great - but also, it'd be nice to fail with a clear message. for some reason this:
WARNING:root:<RetryCallState 4383057408: attempt #1; slept for 0.0; last result: failed (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)>
is really hard to read for users. I get lots of messages where people go "Your stuff is broken!" but when I look at the logs I see this message all over the place.
I wonder if we could clean up the message a bit.. even:
WARNING:root:IMPORTANT: OpenAI API key is missing or invalid. Set it by passing `api_key` to the client or defining `OPENAI_API_KEY` as an environment variable. Error Details: 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
or if we want to get fancy..
WARNING:root:
IMPORTANT: OpenAI API key is missing or invalid.
To resolve this issue, set the API key by:
1. Passing `api_key` to the client explicitly, OR
2. Setting the `OPENAI_API_KEY` environment variable.
Error Details: 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
Describe the issue
Missing API keys show up in logs/errors as timeouts/retries that require an interruption to proceed.
Describe the solution you'd like
Could we surface a "missing api key" error that halts the script execution?
Additional context
Results in:
The text was updated successfully, but these errors were encountered: