Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

resumeHttpResponse.md

39 lines906 Bytes

1---
2id: resumeHttpResponse
3title: resumeHttpResponse
4---
5​
6```ts
7function resumeHttpResponse<TOffset>(options): Response;
8```
9​
10Defined in: [packages/ai/src/stream-to-response.ts:1211](https://github.com/TanStack/ai/blob/main/packages/ai/src/stream-to-response.ts#L1211)
11​
12Serve a resumable run from its durability log over NDJSON, without re-running
13the model. The NDJSON counterpart of [resumeServerSentEventsResponse](resumeServerSentEventsResponse.md);
14pair it with a `toHttpResponse` producer. Returns a 400 when the request
15carries no resume offset (no `Last-Event-ID` header and no `?offset`).
16​
17## Type Parameters
18​
19### TOffset
20​
21`TOffset` *extends* `string` = `string`
22​
23## Parameters
24​
25### options
26​
27`ResumeResponseOptions`\<`TOffset`\>
28​
29## Returns
30​
31`Response`
32​
33## Example
34​
35```typescript
36export async function GET(request: Request) {
37 return resumeHttpResponse({ adapter: memoryStream(request) });
39```