Hey! I’m trying to build a chatbot using the Assistants API, and have a few questions regarding “best practices” of using the API.
- What is the intended way to get the assistant’s reply to a given message?
The current flow we have is:
- Create a new user message in the thread
- Create a new run for the thread
- Wait until the run status is “completed”
- Query the messages in the thread, and filter to the ones where
run_idmatches the ID of the run we created earlier
This seems to work mostly, but sometimes leads to a case where the run is in a
completed state but we get an empty array of messages as the assistant’s response. Is there something wrong with our flow, would there be a better way to get the assistant response?
- Is it possible for the assistant to respond to a given user message with more than one assistant message?
Seems like so far the assistant has always responded with just a single Message object to any given user message. Couldn’t find in the documentation anything about this, so is it safe to assume that this is always the case? And if the assistant response would be in multiple parts, this would be reflected in the
message.content array, correct? Also appreciated if anyone can give some practical example cases where the
message.content array would have multiple items in it