# Append assistant response to the chat history
messages.append(
    {"role": "assistant", "content": response.message.content[0].text}
)