Can you check if the AZURE_OPENAI_ENDPOINT environment variable exists and then use the AzureOpenAI instead of OpenAI client? We have an AzureOpenAI account that we use a lot.
change:
self._client = openai.OpenAI(api_key=self.api_key)
to:
self._client = openai.OpenAI(api_key=self.api_key) if os.getenv("AZURE_OPENAI_ENDPOINT") is None else openai.AzureOpenAI(api_key=self.api_key)
Can you check if the AZURE_OPENAI_ENDPOINT environment variable exists and then use the AzureOpenAI instead of OpenAI client? We have an AzureOpenAI account that we use a lot.
change:
self._client = openai.OpenAI(api_key=self.api_key)
to:
self._client = openai.OpenAI(api_key=self.api_key) if os.getenv("AZURE_OPENAI_ENDPOINT") is None else openai.AzureOpenAI(api_key=self.api_key)