Hello! Can someone help me with the following:
My app is running great on local server, but when I try to deploy I keep getting this error:
–important:
My OPEN AI PI KEY is in a .env
My code for call the key is like follows:
# Load environment variables from .env file
_ = load_dotenv(find_dotenv()) # read local .env file
openai.api_key = os.environ["OPENAI_API_KEY"]
# Initialize OpenAI client
client = openai.Client()
def get_completion_from_messages(messages, model="gpt-3.5-turbo", temperature=0.4):
response = client.chat.completions.create(
model=model,
messages=messages,
temperature=temperature, # this is the degree of randomness of the model's output
)
return response.choices[0].message.content
I also did what is instructed here on Open AI website:
And still now working.
If anyone could please bring some light, I would really apprecciate!!!