Im a bit confused with the documentation regarding the API client and how to use it in order to send message to my existing assistant.
I have created an assistant with assistant_id, and already have added the required instructions, now i need to send my content or message as user, how to do so
But i was wondering if there is an approach where i can get the entire response all at once similar to the same approach being used with text completion
completion = client.chat.completions.create(
model="gpt-4-turbo",
messages=[{"role": "user", "content": prompt}]
)
if completion.choices:
response_content = completion.choices[0].message.content
return response_content
else:
return "No response was returned by the model."
After adding the messages to the thread you run it with your assistant.
The assistant while then add ’ assistant messages to the thread. You can use the ‘AssistantEventHandler’ class as demonstrated here to stream the response.
As you are just getting started you can opt to poll for updates as in the second example (there is a little toggle for with and without streaming).