Closed Billijk closed 1 year ago
Found same issue here: https://stackoverflow.com/questions/76543136/how-to-do-function-calling-using-azure-openai
is there a known workaround ? or we need to wait for azure to support functions ?
https://learn.microsoft.com/en-us/answers/questions/1323694/error-calling-function-when-using-model-gpt-35-tur Seems Azure has known this problem and is tring to fix it.
Function support with Azure API will be supported soon, but there is not an ETA quite yet.
See this comment for more details: https://github.com/Azure/azure-rest-api-specs/pull/24534#issuecomment-1632852649
Functions are now supported with the Azure API. You can see more details here: https://learn.microsoft.com/azure/ai-services/openai/how-to/function-calling
remember update this config
openai.api_version = "2023-07-01-preview"
here what is working for me:
openai.api_version = "2023-07-01-preview"
response = openai.ChatCompletion.create(
engine="gpt-35-turbo-0613",
messages=[{"role": "user", "content": "Efficient operations on the ground and friendly, attentive employees everywhere."}],
functions=functions,
function_call="auto",
)
remember update this config
openai.api_version = "2023-07-01-preview"
You save me.
Thanks a lot for the efforts to make this work!
The question came up again.
The question came up again.
@linchpinlin can you share the error and an example of the code that reproduces it?
The question came up again.
@linchpinlin can you share the error and an example of the code that reproduces it? https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling Running the official demo also gives this error
File "text2sql.py", line 36, in gpt3_main response = openai.ChatCompletion.create( File "/home/lixaoyun/.local/lib/python3.8/site-packages/openai/api_resources/chat_completion.py", line 25, in create return super().create(*args, **kwargs) File "/home/lixaoyun/.local/lib/python3.8/site-packages/openai/api_resources/abstract/engine_apiresource.py", line 153, in create response, , api_key = requestor.request( File "/home/lixaoyun/.local/lib/python3.8/site-packages/openai/api_requestor.py", line 298, in request resp, got_stream = self._interpret_response(result, stream) File "/home/lixaoyun/.local/lib/python3.8/site-packages/openai/api_requestor.py", line 700, in _interpret_response self._interpret_response_line( File "/home/lixaoyun/.local/lib/python3.8/site-packages/openai/api_requestor.py", line 765, in _interpret_response_line raise self.handle_error_response( openai.error.InvalidRequestError: Unrecognized request argument supplied: functions
@linchpinlin I copy/pasted the example from the demo code and wasn't able to reproduce the error from it. Can you confirm that you've set the API version and model to those supported by functions?
Function calling is available in the 2023-07-01-preview API version and works with version 0613 of gpt-35-turbo, gpt-35-turbo-16k, gpt-4, and gpt-4-32k.
Thanks for your help, I redeployed this model and the problem was solved!
Issue exists with azureopenai endpoint with client config: model="gpt-35-turbo-0613"
client = AzureOpenAI( azure_endpoint=endpoint, api_key=api_key, api_version="2023-07-01-preview" )
NotFoundError: Error code: 404 - {'error': {'message': 'Unrecognized request argument supplied: functions', 'type': 'invalid_request_error', 'param': None, 'code': None}}
Describe the bug
New
functions
parameter in ChatCompletion is not recognized when calling MS Azure endpoints. I got this error when I pass in my functions:To Reproduce
Code snippets
OS
linux
Python version
python 3.8
Library version
v0.27.8