azure-search-openai-demo: TypeError: Cannot read properties of undefined (reading '0') error from chat completion

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Ask a question and submit on chat with your data page. Error in response. When clicking on ask a question the completion and response is received ok from data. Not sure what the issue is, logs below

Any log messages given by the failure

2023-10-10T10:05:43.130337042Z [2023-10-10 10:05:43 +0000] [74] [ERROR] Exception in ASGI application 2023-10-10T10:05:43.131131041Z Traceback (most recent call last): 2023-10-10T10:05:43.131141341Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/uvicorn/protocols/http/”, line 426, in run_asgi 2023-10-10T10:05:43.131145641Z result = await app( # type: ignore[func-returns-value] 2023-10-10T10:05:43.131148941Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/uvicorn/middleware/”, line 84, in call 2023-10-10T10:05:43.131152441Z return await, receive, send) 2023-10-10T10:05:43.131155741Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/quart/”, line 1620, in call 2023-10-10T10:05:43.131159041Z await self.asgi_app(scope, receive, send) 2023-10-10T10:05:43.131162341Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/opentelemetry/instrumentation/asgi/”, line 596, in call 2023-10-10T10:05:43.131174841Z await, otel_receive, otel_send) 2023-10-10T10:05:43.131178341Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/quart/”, line 1646, in asgi_app 2023-10-10T10:05:43.131181441Z await asgi_handler(receive, send) 2023-10-10T10:05:43.131184741Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/quart/”, line 52, in call 2023-10-10T10:05:43.131187841Z raise_task_exceptions(done) 2023-10-10T10:05:43.131190741Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/quart/”, line 187, in raise_task_exceptions 2023-10-10T10:05:43.131193941Z raise task.exception() 2023-10-10T10:05:43.131196841Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/quart/”, line 107, in handle_request 2023-10-10T10:05:43.131199941Z await asyncio.wait_for(self._send_response(send, response), timeout=timeout) 2023-10-10T10:05:43.131203041Z File “/opt/python/3.10.12/lib/python3.10/asyncio/”, line 408, in wait_for 2023-10-10T10:05:43.131206041Z return await fut 2023-10-10T10:05:43.131209041Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/quart/”, line 134, in _send_response 2023-10-10T10:05:43.131235041Z async for data in response_body: 2023-10-10T10:05:43.131238341Z File “/tmp/8dbc9762d29380d/”, line 127, in format_as_ndjson 2023-10-10T10:05:43.131241441Z async for event in r: 2023-10-10T10:05:43.131244541Z File “/tmp/8dbc9762d29380d/approaches/”, line 237, in run_with_streaming 2023-10-10T10:05:43.131247741Z extra_info, chat_coroutine = await self.run_until_final_call( 2023-10-10T10:05:43.131250941Z File “/tmp/8dbc9762d29380d/approaches/”, line 119, in run_until_final_call 2023-10-10T10:05:43.131256141Z chat_completion = await openai.ChatCompletion.acreate( 2023-10-10T10:05:43.131259541Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/openai/api_resources/”, line 45, in acreate 2023-10-10T10:05:43.131262741Z return await super().acreate(*args, **kwargs) 2023-10-10T10:05:43.131265841Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/openai/api_resources/abstract/”, line 219, in acreate 2023-10-10T10:05:43.131269141Z response, _, api_key = await requestor.arequest( 2023-10-10T10:05:43.131272141Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/openai/”, line 384, in arequest 2023-10-10T10:05:43.131275341Z resp, got_stream = await self._interpret_async_response(result, stream) 2023-10-10T10:05:43.131278541Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/openai/”, line 738, in _interpret_async_response 2023-10-10T10:05:43.131285441Z self._interpret_response_line( 2023-10-10T10:05:43.131288641Z File “/tmp/8dbc9762d29380d/antenv/lib/python3.10/site-packages/openai/”, line 775, in _interpret_response_line 2023-10-10T10:05:43.131295841Z raise self.handle_error_response( 2023-10-10T10:05:43.131299041Z openai.error.InvalidRequestError: Unrecognized request argument supplied: functions

2023-10-10T10:05:43.174373581Z fail: Middleware[0] 2023-10-10T10:05:43.174412381Z Failed to forward request to Encountered a System.IO.IOException exception after 1767.901ms with message: The response ended prematurely… Check application logs to verify the application is properly handling HTTP traffic.

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

azd version?

run azd version and copy paste here. latest


occurs with Python 3.10 and 3.11 for dev container and app runtime.

Mention any other details that might be useful

Thanks! We’ll be in touch soon. error


About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Comments: 15

Most upvoted comments

Yes, function call is not supported in 0301. Default Model version in repo is 0613 and funcation call is enabled by default. To disable it use funcation_call=‘none’

Our Bicep file now creates models with version 0613-

It is no longer possible to deploy 0301 version models anymore, so presumably you created it a while ago.

It’s probably fine to not use functions for the query generation, but we may want to use functions for more aspects of the process as well, since it can add more structure to responses. For example, we may use functions to get follow-up questions returned in a more consistent format.

Could you update to 0613? That would enable you to use functions in this case and also future uses.

@suma-sai-paluri yes definitely, let’s leave this issue open and wait for feedback 😃

Thank you @mattjames1978 , i can now get the responses ,but i am curious to understand how and why are these functions useful and what are the repercussions of eliminating them.

@suma-sai-paluri ok thanks, interesting, so we think it is related to the GPT model version we are using 0301. Thanks, hopefully Pamela and the team will come back with a solution for us. thanks

Hi @mattjames1978 I am also facing the same issues, I also deployed the application using 0301 and api version 2023-07-01. And the deployed app was able to respond in ask approach and no response in chat approach Screenshot 2023-10-10 153041