In assistant APIs:
-
Are the API responses or bot messages auto appended to the threads or we have to do it?
-
How do I get the input and output token count for these API responses like I used to get in completions?
Thanks.
In assistant APIs:
Are the API responses or bot messages auto appended to the threads or we have to do it?
How do I get the input and output token count for these API responses like I used to get in completions?
Thanks.
messages = client.beta.threads.messages.list(thread.id)
Thank you for that.
OpenAI mentioned that they are planning on adding the token count feature soon
I don’t think it’s always as simple as “get the last message from the thread”. The messages may appear in sequence. For example, one run can have 2 back-to-back messages from the API if asking it to leverage Code Interpreter to do some data operations on a file. You may have to be operating/checking on the Run itself.
That’s a good point, in which case you can check out the Run Steps:
https://platform.openai.com/docs/api-reference/runs/getRunStep
As this topic has an accepted solution, closing topic.