Repository navigation
Replies: 2 comments 1 reply
|
With the current OpenAI Responses adapter, the ID is exposed on the let responseId: string | undefined
for await (const event of stream) {
if (event.type === 'RUN_FINISHED') {
responseId =
event.metadata?.tanstack?.responseId ?? event.responseId
}
}The metadata path works on the server stream. The top-level fallback also handles events where the client has restored TanStack metadata. This is the provider's For the next turn, pass it through const nextStream = chat({
adapter,
messages: [{ role: 'user', content: followUp }],
modelOptions: {
previous_response_id: responseId,
store: true,
},
})Capture a defined ID before starting that continuation, and keep response storage enabled on the initial request too. Send your system instructions again on subsequent requests; I verified this with Relevant source: Responses finish event and continuation option. |
|
Tested with {
"type": "RUN_FINISHED",
"runId": "7f0c40fc-61de-4ea3-9a47-7d71baba6a21",
"threadId": "responses-test-0d0c9c64-9b1a-4d08-8128-9168c12b2c1f",
"timestamp": 1791906732006,
"usage": {
"promptTokens": 22,
"completionTokens": 96,
"totalTokens": 118,
"completionTokensDetails": {
"reasoningTokens": 87
}
},
"metadata": {
"tanstack": {
"model": "gpt-6-luna",
"finishReason": "stop"
}
}
}Tested with {
"type": "RUN_FINISHED",
"metadata": {
"tanstack": {
"responseItems": [
{
"id": "msg_0bf10f3d323473f9006acf364c99dc87d1a3b7e20970fa30f0",
"phase": "final_answer"
}
],
"source": {
"provider": "openai",
"api": "openai-responses",
"model": "gpt-6-luna"
},
"model": "gpt-6-luna",
"responseId": "resp_0bf10f3d323473f9006acf364a871087d18c3526104a916565",
"finishReason": "stop"
}
},
"runId": "2ed67396-8c45-468d-9d4a-bb9c04725c13",
"threadId": "responses-test-33773070-7077-423f-b0f8-0799fd38dd9e",
"timestamp": 1791964748941,
"usage": {
"promptTokens": 22,
"completionTokens": 131,
"totalTokens": 153,
"completionTokensDetails": {
"reasoningTokens": 122
}
}
} |
Uh oh!
There was an error while loading. Please reload this page.
Hi.
Now I can get the Gemini Interaction ID via an AG-UI CUSTOM event named
geminiinteractionId, but how can I get this value but for a OpenAI responses, so I can resume the conversation from an ID instead of a full messages conversation??All reactions