I am using streamlit version 1.28.1 and openai version: 1.1.1.
It seem the tutorial “Build a ChatGPT Like App” is probably build on a different version of either streamlit or openai. If you literally copy the code across and run it on the above version, it doesn’t work. I have two questions:
- May I know the tutorial was build on which versions (Streamlit/openai)?
- I manage to resolve most of the issues except this error. Any one know what is the issue?
AttributeError: ‘list’ object has no attribute ‘delta’
Traceback:
File "C:\Users\xxxx\Documents\test\myenv\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 534, in _run_script
exec(code, module.__dict__)File "C:\Users\xxxx\demo.py", line 36, in <module>
full_response += response.choices.delta.get("content","")
This is the code block (literally from the tutorial) that is probably giving the error above:
full_response += response.choices[0].delta.get(“content”, “”)
message_placeholder.markdown(full_response + “▌”)
message_placeholder.markdown(full_response)
st.session_state.messages.append({“role”: “assistant”, “content”: full_response})