juiceo
2h
When using the Node.js SDK to fetch messages for a given run, I’m trying to use the after query parameter to fetch only relevant data:
const message = await openai.beta.threads.messages.list(threadId, {
after: "msg_id"
})
Where msg_id would be the ID of the last message sent by the User to the thread. Logically this should give me all of the messages that the assistant posted to the thread in response to that user message.
However, in practice this query always seems to return 0 results, whereas when omitting it and just fetching all of the messages in the thread, everything works as expected.
I am slightly confused by this section of the docs:
after is an object ID that defines your place in the list.
What does it mean that it’s an “Object ID” - sounds like something related to MongoDB? I am currently passing in the message ID as just a string , e.g. after: "msg_abc123" - like it is in the Message object. Is that incorrect?