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.55k stars 2.4k forks source link

Issue handling response back #349

Open balakreshnan opened 10 months ago

balakreshnan commented 10 months 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 10 months ago

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

sarah-widder commented 10 months 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.