Open History to see the last commit
1---
2id: resumeServerSentEventsResponse
3title: resumeServerSentEventsResponse
4---
5
6```ts
7function resumeServerSentEventsResponse<TOffset>(options): Response;
8```
9
10Defined in: packages/ai/src/stream-to-response.ts:1368
11
12Serve a resumable run from its durability log over Server-Sent Events, without
13re-running the model. Use this in a `GET` handler so a reload or a second tab
14can re-attach to an in-flight or finished run.
15
16The adapter (`memoryStream(request)` / `durableStream(request)`) captures the
17resume offset from the request. If there is none (no `Last-Event-ID` header
18and no `?offset`), there is nothing to replay and this returns a 400.
19
20## Type Parameters
21
22### TOffset
23
24`TOffset` *extends* `string` = `string`
25
26## Parameters
27
28### options
29
30`ResumeResponseOptions`\<`TOffset`\>
31
32## Returns
33
34`Response`
35
36## Example
37
38```typescript
39export async function GET(request: Request) {
40 return resumeServerSentEventsResponse({ adapter: memoryStream(request) });
41}
42```