AttributeError: 'function' object has no attribute 'completions'

Hi Everyone,

I had a chatbot which was working absolutely fine until it suddenly stopped and I get the error message "AttributeError: ‘function’ object has no attribute ‘completions’ ".

This is the line it is referring to in my code:

for response in
{“role”: m[“role”], “content”: m[“content”]}
for m in st.session_state.messages

I have checked this against all of the documentation and I have ensured that I am using a suitable version of Python (version 3.11.5) and that the latest OpenAI version is installed (1.6.1).

Apologies if there is something obvious I am missing here but I would be super grateful for any help/feedback!