Open History to see the last commit
1---
2id: resumeJsonResponse
3title: resumeJsonResponse
4---
5
6```ts
7function resumeJsonResponse<TOffset>(options): Promise<Response>;
8```
9
10Defined in: packages/ai/src/stream-to-response.ts:1815
11
12Serve a resumable run from its durability log as one JSON body, without
13re-running the model. The JSON counterpart of
14[resumeServerSentEventsResponse](resumeServerSentEventsResponse.md); pair it with a `toJsonResponse`
15producer. `fetchJson` calls it with `?runId=<id>&offset=<offset>` while a
16reply says `done: false`, and with `offset=-1` to join a run from the start.
17
18The reply holds every chunk strictly after the offset. It is `done: true`
19once the log is closed, or `done: false` after `maxWaitMs` (default 1000) on a
20run that is still going. Returns a 400 when the request carries no resume
21offset (no `Last-Event-ID` header and no `?offset`).
22
23## Type Parameters
24
25### TOffset
26
27`TOffset` *extends* `string` = `string`
28
29## Parameters
30
31### options
32
33`ResponseInit` & `object` & `object`
34
35## Returns
36
37`Promise`\<`Response`\>
38
39## Example
40
41```typescript
42export async function GET(request: Request) {
43 return resumeJsonResponse({ adapter: memoryStream(request) });
44}
45```