It would be great to support Azure OpenAI services, as an alternative. With Azure OpenAI the API call is slightly different and requires more arguments besides the API_KEY, as shown in this example:
#Note: The openai-python library support for Azure OpenAI is in preview.
import os
import openai
openai.api_type = "azure"
openai.api_base = "https://my_custom_endpoint_name.openai.azure.com/"
openai.api_version = "2023-07-01-preview"
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.ChatCompletion.create(
engine="gpt-35-turbo-v0301",
messages = [{"role":"system","content":"You are an AI assistant that helps people find information."}],
temperature=0.7,
max_tokens=800,
top_p=0.95,
frequency_penalty=0,
presence_penalty=0,
stop=None)
Here are the 5 inputs needed from the user to be able to make a succesful call (values are provided in the Azure configuration):
openai.api_type = "azure" (this is a fixed value I believe, it indicates the openai module we want to use the Azure API)
openai.api_base: the endoint, value provided by Azure upong creating the instance
openai.api_version : API version, value provided by Azure
openai.api_key : The API Key, also given in Azure portal
engine: the name of the model deployment in Azure (user defined upon creation of the model deployment)
It would be great to support Azure OpenAI services, as an alternative. With Azure OpenAI the API call is slightly different and requires more arguments besides the API_KEY, as shown in this example:
Here are the 5 inputs needed from the user to be able to make a succesful call (values are provided in the Azure configuration):