Selection deleted
import re
import json
import utils
---------------------------------------------------------------------------
OpenAIError Traceback (most recent call last)
Cell In[2], line 3
1 import re
2 import json
----> 3 import utils
File ~\utils.py:24
21 anthropic_api_key = os.getenv("ANTHROPIC_API_KEY")
23 # Both clients read keys from env by default; explicit is also fine:
---> 24 openai_client = OpenAI(api_key=openai_api_key) if openai_api_key else OpenAI()
25 anthropic_client = Anthropic(api_key=anthropic_api_key) if anthropic_api_key else Anthropic()
28 def get_response(model: str, prompt: str) -> str:
File ~\venv\Lib\site-packages\openai\_client.py:137, in OpenAI.__init__(self, api_key, organization, project, webhook_secret, base_url, websocket_base_url, timeout, max_retries, default_headers, default_query, http_client, _strict_response_validation)
135 api_key = os.environ.get("OPENAI_API_KEY")
136 if api_key is None:
--> 137 raise OpenAIError(
138 "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"
139 )
140 if callable(api_key):
141 self.api_key = ""
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
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