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})