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

interrupts.ts

17 lines435 Bytes

1import { defineInterrupt } from '@tanstack/ai'
2import { z } from 'zod'
3​
4export const BUDGET_OPTIONS = ['thrifty', 'comfort', 'splash'] as const
5​
6export const chooseBudget = defineInterrupt({
7 id: 'chooseBudget',
8 payloadSchema: z.object({
9 city: z.string(),
10 options: z.array(z.enum(BUDGET_OPTIONS)),
11 }),
12 responseSchema: z.object({
13 budget: z.enum(BUDGET_OPTIONS),
14 }),
15})
16​
17export const chatInterrupts = [chooseBudget]