I switched from Azure API version
2023-07-01-preview because it supports function calling (Azure OpenAI Service REST API reference - Azure OpenAI | Microsoft Learn). But I keep receiving this error
list index out of range.
There is no problem is the way I construct the function because I can use Openai function calling feature without any problem.
Has anyone faced this issue?
There is 2023-09-01-preview now.
You should try the call with functions parameter included and omitted, and with the function_call parameter removed. Isolate exactly what part of input is causing the problem.
Have you made a single successful API call with a basic single message?
Check your JSON response.
The issue is with the 2023-07-01 versions when you enable streaming.
The first chunk in the JSON response doesn’t have any content and it breaks the existing code. This needs to be fixed!
Reverting to 2023-03-15 version works but it doesn’t have function calling.
Tried it, and received this error
OpenAI API error: list index out of range
Are you doing a try/except solely on the API call line? Then putting your own API understanding in other try/except (or just let them crash with traceback so you can see the lines with errors)
That will let you know if
list index out of range is reported from the API, or if you are getting a parse error in your own code.
I have try/catch but it prints the exact error received from calling the API.