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

features.ts

105 lines2.3 KB

1import type { Feature, Provider } from '@/lib/types'
2import { getGuitars, compareGuitars, addToCart } from '@/lib/tools'
3​
4interface FeatureConfig {
5 tools: Array<any>
6 modelOptions: Record<string, any>
7 modelOverrides?: Partial<Record<Provider, string>>
8 dedicatedRoute?: string
9 /**
10 * Optional system prompt override. Defaults (in `api.chat.ts`) to the
11 * guitar-store assistant prompt that covers most features; only set this
12 * when the feature genuinely needs a different persona (e.g. the
13 * `multi-turn-structured` chef recipe-builder).
14 */
15 systemPrompt?: string
17​
18export const featureConfigs: Record<Feature, FeatureConfig> = {
19 chat: {
20 tools: [],
21 modelOptions: {},
22 },
23 'one-shot-text': {
24 tools: [],
25 modelOptions: {},
26 },
27 reasoning: {
28 tools: [],
29 modelOptions: { reasoning: { effort: 'high' } },
30 modelOverrides: {
31 openai: 'o3',
32 anthropic: 'claude-sonnet-4-5',
33 },
34 },
35 'multi-turn': {
36 tools: [],
37 modelOptions: {},
38 },
39 'tool-calling': {
40 tools: [getGuitars],
41 modelOptions: {},
42 },
43 'parallel-tool-calls': {
44 tools: [getGuitars, compareGuitars],
45 modelOptions: {},
46 },
47 'tool-approval': {
48 tools: [addToCart],
49 modelOptions: {},
50 },
51 'text-tool-text': {
52 tools: [getGuitars],
53 modelOptions: {},
54 },
55 'structured-output': {
56 tools: [],
57 modelOptions: {},
58 },
59 'structured-output-stream': {
60 tools: [],
61 modelOptions: {},
62 },
63 'multi-turn-structured': {
64 tools: [],
65 modelOptions: {},
66 systemPrompt:
67 'You are a chef assistant that always responds with a single recipe matching the provided JSON schema. When the user asks for modifications, produce a new recipe in the same shape that reflects the change. Stay terse — short titles, short steps.',
68 },
69 'agentic-structured': {
70 tools: [getGuitars],
71 modelOptions: {},
72 },
73 'multimodal-image': {
74 tools: [],
75 modelOptions: {},
76 },
77 'multimodal-structured': {
78 tools: [],
79 modelOptions: {},
80 },
81 summarize: {
82 tools: [],
83 modelOptions: {},
84 },
85 'summarize-stream': {
86 tools: [],
87 modelOptions: {},
88 },
89 'image-gen': {
90 tools: [],
91 modelOptions: {},
92 },
93 tts: {
94 tools: [],
95 modelOptions: {},
96 },
97 transcription: {
98 tools: [],
99 modelOptions: {},
100 },
101 'video-gen': {
102 tools: [],
103 modelOptions: {},
104 },