Find answers from the community

Updated 12 months ago

How to use AzureOpenAI with function

At a glance
How to use AzureOpenAI with function calling?
Using OpenAI, it is working fine, but It is not working with AzureOpenAI
func_response = getGPT35Client(True).complete(func_prompt, tools=[relevance_fn])


def getGPT35Client(isAzure ):
client = OpenAI(model="gpt-3.5-turbo", api_key=os.environ.get('EXTOVATE_OPENAI_API_KEY'))
try:
if isAzure == True:
azureClient = AzureOpenAI(
openai_api_key=os.environ.get('MY_KEY'),
openai_api_base=os.environ.get("MY_ENDPOINT"),
openai_api_version="2023-12-01-preview",
openai_api_type="azure",
model="MyModelName"
)
return azureClient
else:
return client
except Exception as err:
print(err)
return client
m
1 comment
you need to use a newer api version 2023-12-01-preview is quite old and wont have function calling
Add a reply
Sign up and join the conversation on Discord