microsoft / sample-app-aoai-chatGPT

Sample code for a simple web chat experience through Azure OpenAI, including Azure OpenAI On Your Data.
MIT License
1.66k stars 2.64k forks source link

Issue handling response back #349

Open balakreshnan opened 1 year ago

balakreshnan commented 1 year ago

Here is the error i am getting after updating open ai library 0.28.1 and also latest code is breaking:

Traceback (most recent call last): File "C:\Code\chatapp\sample-app-aoai-chatGPT\app.py", line 237, in stream_with_data lineJson = formatApiResponseStreaming(rawResponse) File "C:\Code\chatapp\sample-app-aoai-chatGPT\app.py", line 332, in formatApiResponseStreaming "content": rawResponse["choices"][0]["delta"]["content"], KeyError: 'delta'

used to work before.

balakreshnan commented 1 year ago

I try to correct the output schema and test still the page goes blank when we get streaming response.

sarah-widder commented 1 year ago

Hi @balakreshnan thanks for raising this issue, we will look into it. In the meantime you might try to downgrade the openai package to 0.27.7 or earlier.