@dexto/core 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/DextoAgent.cjs +54 -0
- package/dist/agent/DextoAgent.d.ts +12 -1
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +54 -0
- package/dist/agent/agent-options.d.ts +6 -1
- package/dist/agent/agent-options.d.ts.map +1 -1
- package/dist/events/index.d.ts +9 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/llm/executor/provider-options.cjs +223 -28
- package/dist/llm/executor/provider-options.d.ts +3 -37
- package/dist/llm/executor/provider-options.d.ts.map +1 -1
- package/dist/llm/executor/provider-options.js +227 -27
- package/dist/llm/executor/stream-processor.cjs +54 -31
- package/dist/llm/executor/stream-processor.d.ts +9 -2
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +52 -29
- package/dist/llm/executor/turn-executor.cjs +63 -41
- package/dist/llm/executor/turn-executor.d.ts +2 -2
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +53 -31
- package/dist/llm/formatters/vercel.cjs +15 -3
- package/dist/llm/formatters/vercel.d.ts +1 -0
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +15 -3
- package/dist/llm/index.cjs +8 -0
- package/dist/llm/index.d.ts +2 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +7 -0
- package/dist/llm/providers/local/schemas.d.ts +2 -2
- package/dist/llm/providers/openrouter-model-registry.cjs +66 -11
- package/dist/llm/providers/openrouter-model-registry.d.ts +26 -0
- package/dist/llm/providers/openrouter-model-registry.d.ts.map +1 -1
- package/dist/llm/providers/openrouter-model-registry.js +65 -11
- package/dist/llm/reasoning/anthropic-betas.cjs +31 -0
- package/dist/llm/reasoning/anthropic-betas.d.ts +3 -0
- package/dist/llm/reasoning/anthropic-betas.d.ts.map +1 -0
- package/dist/llm/reasoning/anthropic-betas.js +7 -0
- package/dist/llm/reasoning/anthropic-thinking.cjs +79 -0
- package/dist/llm/reasoning/anthropic-thinking.d.ts +15 -0
- package/dist/llm/reasoning/anthropic-thinking.d.ts.map +1 -0
- package/dist/llm/reasoning/anthropic-thinking.js +52 -0
- package/dist/llm/reasoning/openai-reasoning-effort.cjs +86 -0
- package/dist/llm/reasoning/openai-reasoning-effort.d.ts +5 -0
- package/dist/llm/reasoning/openai-reasoning-effort.d.ts.map +1 -0
- package/dist/llm/reasoning/openai-reasoning-effort.js +61 -0
- package/dist/llm/reasoning/profile.cjs +113 -0
- package/dist/llm/reasoning/profile.d.ts +13 -0
- package/dist/llm/reasoning/profile.d.ts.map +1 -0
- package/dist/llm/reasoning/profile.js +92 -0
- package/dist/llm/reasoning/profiles/anthropic.cjs +61 -0
- package/dist/llm/reasoning/profiles/anthropic.d.ts +8 -0
- package/dist/llm/reasoning/profiles/anthropic.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/anthropic.js +45 -0
- package/dist/llm/reasoning/profiles/bedrock.cjs +54 -0
- package/dist/llm/reasoning/profiles/bedrock.d.ts +3 -0
- package/dist/llm/reasoning/profiles/bedrock.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/bedrock.js +36 -0
- package/dist/llm/reasoning/profiles/google.cjs +45 -0
- package/dist/llm/reasoning/profiles/google.d.ts +9 -0
- package/dist/llm/reasoning/profiles/google.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/google.js +21 -0
- package/dist/llm/reasoning/profiles/openai-compatible.cjs +39 -0
- package/dist/llm/reasoning/profiles/openai-compatible.d.ts +3 -0
- package/dist/llm/reasoning/profiles/openai-compatible.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/openai-compatible.js +16 -0
- package/dist/llm/reasoning/profiles/openai.cjs +41 -0
- package/dist/llm/reasoning/profiles/openai.d.ts +3 -0
- package/dist/llm/reasoning/profiles/openai.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/openai.js +18 -0
- package/dist/llm/reasoning/profiles/openrouter.cjs +83 -0
- package/dist/llm/reasoning/profiles/openrouter.d.ts +10 -0
- package/dist/llm/reasoning/profiles/openrouter.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/openrouter.js +59 -0
- package/dist/llm/reasoning/profiles/shared.cjs +80 -0
- package/dist/llm/reasoning/profiles/shared.d.ts +25 -0
- package/dist/llm/reasoning/profiles/shared.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/shared.js +53 -0
- package/dist/llm/reasoning/profiles/vertex.cjs +46 -0
- package/dist/llm/reasoning/profiles/vertex.d.ts +3 -0
- package/dist/llm/reasoning/profiles/vertex.d.ts.map +1 -0
- package/dist/llm/reasoning/profiles/vertex.js +23 -0
- package/dist/llm/registry/auto-update.cjs +18 -0
- package/dist/llm/registry/auto-update.d.ts.map +1 -1
- package/dist/llm/registry/auto-update.js +18 -0
- package/dist/llm/registry/index.cjs +126 -26
- package/dist/llm/registry/index.d.ts +48 -4
- package/dist/llm/registry/index.d.ts.map +1 -1
- package/dist/llm/registry/index.js +136 -28
- package/dist/llm/registry/models.generated.cjs +5198 -59
- package/dist/llm/registry/models.generated.d.ts +1893 -76
- package/dist/llm/registry/models.generated.d.ts.map +1 -1
- package/dist/llm/registry/models.generated.js +5196 -58
- package/dist/llm/registry/sync.cjs +72 -1
- package/dist/llm/registry/sync.d.ts +21 -1
- package/dist/llm/registry/sync.d.ts.map +1 -1
- package/dist/llm/registry/sync.js +72 -1
- package/dist/llm/resolver.cjs +13 -1
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +13 -1
- package/dist/llm/schemas.cjs +75 -14
- package/dist/llm/schemas.d.ts +80 -23
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +75 -14
- package/dist/llm/services/factory.cjs +55 -8
- package/dist/llm/services/factory.d.ts +1 -1
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +58 -8
- package/dist/llm/services/vercel.cjs +1 -1
- package/dist/llm/services/vercel.js +1 -1
- package/dist/llm/types.d.ts +9 -0
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/prompts/index.cjs +9 -0
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +10 -0
- package/dist/prompts/prompt-manager.cjs +2 -0
- package/dist/prompts/prompt-manager.d.ts.map +1 -1
- package/dist/prompts/prompt-manager.js +2 -0
- package/dist/prompts/providers/config-prompt-provider.cjs +11 -1
- package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/config-prompt-provider.js +11 -1
- package/dist/prompts/schemas.cjs +2 -2
- package/dist/prompts/schemas.js +2 -2
- package/dist/prompts/types.d.ts +6 -2
- package/dist/prompts/types.d.ts.map +1 -1
- package/dist/tools/tool-manager.cjs +88 -2
- package/dist/tools/tool-manager.d.ts +15 -1
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +88 -2
- package/dist/utils/service-initializer.d.ts +1 -0
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/package.json +6 -4
package/dist/llm/schemas.d.ts
CHANGED
|
@@ -10,29 +10,44 @@ export declare const LLMConfigBaseSchema: z.ZodObject<{
|
|
|
10
10
|
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
11
11
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
12
12
|
allowedMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
-
|
|
13
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
14
|
+
variant: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
15
|
+
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, "strict", z.ZodTypeAny, {
|
|
17
|
+
variant: string;
|
|
18
|
+
budgetTokens?: number | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
variant: string;
|
|
21
|
+
budgetTokens?: number | undefined;
|
|
22
|
+
}>>;
|
|
14
23
|
}, "strict", z.ZodTypeAny, {
|
|
15
24
|
model: string;
|
|
16
25
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
17
26
|
apiKey?: string | undefined;
|
|
18
27
|
maxInputTokens?: number | undefined;
|
|
28
|
+
reasoning?: {
|
|
29
|
+
variant: string;
|
|
30
|
+
budgetTokens?: number | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
temperature?: number | undefined;
|
|
19
33
|
maxIterations?: number | undefined;
|
|
20
34
|
baseURL?: string | undefined;
|
|
21
35
|
maxOutputTokens?: number | undefined;
|
|
22
|
-
temperature?: number | undefined;
|
|
23
36
|
allowedMediaTypes?: string[] | undefined;
|
|
24
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
25
37
|
}, {
|
|
26
38
|
model: string;
|
|
27
39
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
28
40
|
apiKey?: string | undefined;
|
|
29
41
|
maxInputTokens?: number | undefined;
|
|
42
|
+
reasoning?: {
|
|
43
|
+
variant: string;
|
|
44
|
+
budgetTokens?: number | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
temperature?: number | undefined;
|
|
30
47
|
maxIterations?: number | undefined;
|
|
31
48
|
baseURL?: string | undefined;
|
|
32
49
|
maxOutputTokens?: number | undefined;
|
|
33
|
-
temperature?: number | undefined;
|
|
34
50
|
allowedMediaTypes?: string[] | undefined;
|
|
35
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
36
51
|
}>;
|
|
37
52
|
/**
|
|
38
53
|
* LLM config schema.
|
|
@@ -51,55 +66,86 @@ export declare const LLMConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
51
66
|
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
52
67
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
53
68
|
allowedMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
54
|
-
|
|
69
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
variant: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
71
|
+
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
}, "strict", z.ZodTypeAny, {
|
|
73
|
+
variant: string;
|
|
74
|
+
budgetTokens?: number | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
variant: string;
|
|
77
|
+
budgetTokens?: number | undefined;
|
|
78
|
+
}>>;
|
|
55
79
|
}, "strict", z.ZodTypeAny, {
|
|
56
80
|
model: string;
|
|
57
81
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
58
82
|
apiKey?: string | undefined;
|
|
59
83
|
maxInputTokens?: number | undefined;
|
|
84
|
+
reasoning?: {
|
|
85
|
+
variant: string;
|
|
86
|
+
budgetTokens?: number | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
temperature?: number | undefined;
|
|
60
89
|
maxIterations?: number | undefined;
|
|
61
90
|
baseURL?: string | undefined;
|
|
62
91
|
maxOutputTokens?: number | undefined;
|
|
63
|
-
temperature?: number | undefined;
|
|
64
92
|
allowedMediaTypes?: string[] | undefined;
|
|
65
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
66
93
|
}, {
|
|
67
94
|
model: string;
|
|
68
95
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
69
96
|
apiKey?: string | undefined;
|
|
70
97
|
maxInputTokens?: number | undefined;
|
|
98
|
+
reasoning?: {
|
|
99
|
+
variant: string;
|
|
100
|
+
budgetTokens?: number | undefined;
|
|
101
|
+
} | undefined;
|
|
102
|
+
temperature?: number | undefined;
|
|
71
103
|
maxIterations?: number | undefined;
|
|
72
104
|
baseURL?: string | undefined;
|
|
73
105
|
maxOutputTokens?: number | undefined;
|
|
74
|
-
temperature?: number | undefined;
|
|
75
106
|
allowedMediaTypes?: string[] | undefined;
|
|
76
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
77
107
|
}>, {
|
|
78
108
|
model: string;
|
|
79
109
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
80
110
|
apiKey?: string | undefined;
|
|
81
111
|
maxInputTokens?: number | undefined;
|
|
112
|
+
reasoning?: {
|
|
113
|
+
variant: string;
|
|
114
|
+
budgetTokens?: number | undefined;
|
|
115
|
+
} | undefined;
|
|
116
|
+
temperature?: number | undefined;
|
|
82
117
|
maxIterations?: number | undefined;
|
|
83
118
|
baseURL?: string | undefined;
|
|
84
119
|
maxOutputTokens?: number | undefined;
|
|
85
|
-
temperature?: number | undefined;
|
|
86
120
|
allowedMediaTypes?: string[] | undefined;
|
|
87
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
88
121
|
}, {
|
|
89
122
|
model: string;
|
|
90
123
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
91
124
|
apiKey?: string | undefined;
|
|
92
125
|
maxInputTokens?: number | undefined;
|
|
126
|
+
reasoning?: {
|
|
127
|
+
variant: string;
|
|
128
|
+
budgetTokens?: number | undefined;
|
|
129
|
+
} | undefined;
|
|
130
|
+
temperature?: number | undefined;
|
|
93
131
|
maxIterations?: number | undefined;
|
|
94
132
|
baseURL?: string | undefined;
|
|
95
133
|
maxOutputTokens?: number | undefined;
|
|
96
|
-
temperature?: number | undefined;
|
|
97
134
|
allowedMediaTypes?: string[] | undefined;
|
|
98
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
99
135
|
}>;
|
|
100
136
|
export type LLMConfig = z.input<typeof LLMConfigSchema>;
|
|
101
137
|
export type ValidatedLLMConfig = z.output<typeof LLMConfigSchema>;
|
|
102
138
|
export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
|
|
139
|
+
reasoning: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
140
|
+
variant: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
141
|
+
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
}, "strict", z.ZodTypeAny, {
|
|
143
|
+
variant: string;
|
|
144
|
+
budgetTokens?: number | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
variant: string;
|
|
147
|
+
budgetTokens?: number | undefined;
|
|
148
|
+
}>>>>;
|
|
103
149
|
provider: z.ZodOptional<z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "minimax", "glm", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama", "dexto-nova"]>>;
|
|
104
150
|
model: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
105
151
|
apiKey: z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>>;
|
|
@@ -109,51 +155,62 @@ export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
|
|
|
109
155
|
maxOutputTokens: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
110
156
|
temperature: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
111
157
|
allowedMediaTypes: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
112
|
-
reasoningEffort: z.ZodOptional<z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>>;
|
|
113
158
|
}, "strip", z.ZodTypeAny, {
|
|
114
159
|
apiKey?: string | undefined;
|
|
115
160
|
model?: string | undefined;
|
|
116
161
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
117
162
|
maxInputTokens?: number | undefined;
|
|
163
|
+
reasoning?: {
|
|
164
|
+
variant: string;
|
|
165
|
+
budgetTokens?: number | undefined;
|
|
166
|
+
} | null | undefined;
|
|
167
|
+
temperature?: number | undefined;
|
|
118
168
|
maxIterations?: number | undefined;
|
|
119
169
|
baseURL?: string | undefined;
|
|
120
170
|
maxOutputTokens?: number | undefined;
|
|
121
|
-
temperature?: number | undefined;
|
|
122
171
|
allowedMediaTypes?: string[] | undefined;
|
|
123
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
124
172
|
}, {
|
|
125
173
|
apiKey?: string | undefined;
|
|
126
174
|
model?: string | undefined;
|
|
127
175
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
128
176
|
maxInputTokens?: number | undefined;
|
|
177
|
+
reasoning?: {
|
|
178
|
+
variant: string;
|
|
179
|
+
budgetTokens?: number | undefined;
|
|
180
|
+
} | null | undefined;
|
|
181
|
+
temperature?: number | undefined;
|
|
129
182
|
maxIterations?: number | undefined;
|
|
130
183
|
baseURL?: string | undefined;
|
|
131
184
|
maxOutputTokens?: number | undefined;
|
|
132
|
-
temperature?: number | undefined;
|
|
133
185
|
allowedMediaTypes?: string[] | undefined;
|
|
134
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
135
186
|
}>, {
|
|
136
187
|
apiKey?: string | undefined;
|
|
137
188
|
model?: string | undefined;
|
|
138
189
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
139
190
|
maxInputTokens?: number | undefined;
|
|
191
|
+
reasoning?: {
|
|
192
|
+
variant: string;
|
|
193
|
+
budgetTokens?: number | undefined;
|
|
194
|
+
} | null | undefined;
|
|
195
|
+
temperature?: number | undefined;
|
|
140
196
|
maxIterations?: number | undefined;
|
|
141
197
|
baseURL?: string | undefined;
|
|
142
198
|
maxOutputTokens?: number | undefined;
|
|
143
|
-
temperature?: number | undefined;
|
|
144
199
|
allowedMediaTypes?: string[] | undefined;
|
|
145
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
146
200
|
}, {
|
|
147
201
|
apiKey?: string | undefined;
|
|
148
202
|
model?: string | undefined;
|
|
149
203
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
150
204
|
maxInputTokens?: number | undefined;
|
|
205
|
+
reasoning?: {
|
|
206
|
+
variant: string;
|
|
207
|
+
budgetTokens?: number | undefined;
|
|
208
|
+
} | null | undefined;
|
|
209
|
+
temperature?: number | undefined;
|
|
151
210
|
maxIterations?: number | undefined;
|
|
152
211
|
baseURL?: string | undefined;
|
|
153
212
|
maxOutputTokens?: number | undefined;
|
|
154
|
-
temperature?: number | undefined;
|
|
155
213
|
allowedMediaTypes?: string[] | undefined;
|
|
156
|
-
reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
|
|
157
214
|
}>;
|
|
158
215
|
export type LLMUpdates = z.input<typeof LLMUpdatesSchema>;
|
|
159
216
|
export type { LLMUpdateContext } from '../llm/types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/llm/schemas.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/llm/schemas.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuFxB,4CAA4C;AAG5C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBnB,CAAC;AAEd;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyJ1B,CAAC;AAGH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAIlE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4DvB,CAAC;AACP,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/llm/schemas.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getMaxInputTokensForModel
|
|
15
15
|
} from "./registry/index.js";
|
|
16
16
|
import { LLM_PROVIDERS } from "./types.js";
|
|
17
|
+
import { getReasoningProfile, supportsReasoningVariant } from "./reasoning/profile.js";
|
|
17
18
|
const LLMConfigFields = {
|
|
18
19
|
provider: z.enum(LLM_PROVIDERS).describe("LLM provider (e.g., 'openai', 'anthropic', 'google', 'groq')"),
|
|
19
20
|
model: NonEmptyTrimmed.describe("Specific model name for the selected provider"),
|
|
@@ -31,18 +32,15 @@ const LLMConfigFields = {
|
|
|
31
32
|
'MIME type patterns for media expansion (e.g., "image/*", "application/pdf"). If omitted, uses model capabilities from registry. Supports wildcards.'
|
|
32
33
|
),
|
|
33
34
|
// Provider-specific options
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
reasoningEffort: z.enum(["none", "minimal", "low", "medium", "high", "xhigh"]).optional().describe(
|
|
45
|
-
"OpenAI reasoning effort level for reasoning models (o1, o3, codex). Options: 'none', 'minimal', 'low', 'medium' (recommended), 'high', 'xhigh'"
|
|
35
|
+
reasoning: z.object({
|
|
36
|
+
variant: NonEmptyTrimmed.describe(
|
|
37
|
+
"Model/provider-native reasoning variant (resolved by reasoning profile for the selected model)."
|
|
38
|
+
),
|
|
39
|
+
budgetTokens: z.coerce.number().int().positive().optional().describe(
|
|
40
|
+
"Advanced escape hatch for budget-based providers (e.g., Anthropic/Gemini/Bedrock/OpenRouter)."
|
|
41
|
+
)
|
|
42
|
+
}).strict().optional().describe(
|
|
43
|
+
"Reasoning configuration using model/provider-native variants (tuning only; display is controlled separately)."
|
|
46
44
|
)
|
|
47
45
|
};
|
|
48
46
|
const LLMConfigBaseSchema = z.object({
|
|
@@ -57,7 +55,7 @@ const LLMConfigBaseSchema = z.object({
|
|
|
57
55
|
temperature: LLMConfigFields.temperature,
|
|
58
56
|
allowedMediaTypes: LLMConfigFields.allowedMediaTypes,
|
|
59
57
|
// Provider-specific options
|
|
60
|
-
|
|
58
|
+
reasoning: LLMConfigFields.reasoning
|
|
61
59
|
}).strict();
|
|
62
60
|
const LLMConfigSchema = LLMConfigBaseSchema.superRefine((data, ctx) => {
|
|
63
61
|
const baseURLIsSet = data.baseURL != null && data.baseURL.trim() !== "";
|
|
@@ -147,8 +145,42 @@ const LLMConfigSchema = LLMConfigBaseSchema.superRefine((data, ctx) => {
|
|
|
147
145
|
}
|
|
148
146
|
}
|
|
149
147
|
}
|
|
148
|
+
if (data.reasoning) {
|
|
149
|
+
const profile = getReasoningProfile(data.provider, data.model);
|
|
150
|
+
const variant = data.reasoning.variant;
|
|
151
|
+
const budgetTokens = data.reasoning.budgetTokens;
|
|
152
|
+
if (!supportsReasoningVariant(profile, variant)) {
|
|
153
|
+
ctx.addIssue({
|
|
154
|
+
code: z.ZodIssueCode.custom,
|
|
155
|
+
path: ["reasoning", "variant"],
|
|
156
|
+
message: `Reasoning variant '${variant}' is not supported for provider '${data.provider}' model '${data.model}'. Supported: ${profile.variants.map((entry) => entry.id).join(", ")}`,
|
|
157
|
+
params: {
|
|
158
|
+
code: LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
159
|
+
scope: ErrorScope.LLM,
|
|
160
|
+
type: ErrorType.USER
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
if (typeof budgetTokens === "number" && !profile.supportsBudgetTokens) {
|
|
165
|
+
ctx.addIssue({
|
|
166
|
+
code: z.ZodIssueCode.custom,
|
|
167
|
+
path: ["reasoning", "budgetTokens"],
|
|
168
|
+
message: `Reasoning budgetTokens are not supported for provider '${data.provider}' model '${data.model}'. Remove reasoning.budgetTokens to use provider defaults.`,
|
|
169
|
+
params: {
|
|
170
|
+
code: LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
171
|
+
scope: ErrorScope.LLM,
|
|
172
|
+
type: ErrorType.USER
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
150
177
|
});
|
|
151
|
-
const LLMUpdatesSchema = z.object({
|
|
178
|
+
const LLMUpdatesSchema = z.object({
|
|
179
|
+
...LLMConfigFields,
|
|
180
|
+
// Special-case: allow `null` as an explicit "clear reasoning config" sentinel for switch flows.
|
|
181
|
+
// Full configs (LLMConfigSchema) still require `reasoning` to be an object when present.
|
|
182
|
+
reasoning: LLMConfigFields.reasoning.nullable()
|
|
183
|
+
}).partial().superRefine((data, ctx) => {
|
|
152
184
|
if (!data.model && !data.provider) {
|
|
153
185
|
ctx.addIssue({
|
|
154
186
|
code: z.ZodIssueCode.custom,
|
|
@@ -156,6 +188,35 @@ const LLMUpdatesSchema = z.object({ ...LLMConfigFields }).partial().superRefine(
|
|
|
156
188
|
path: []
|
|
157
189
|
});
|
|
158
190
|
}
|
|
191
|
+
if (data.reasoning && data.reasoning !== null && typeof data.provider === "string" && typeof data.model === "string") {
|
|
192
|
+
const profile = getReasoningProfile(data.provider, data.model);
|
|
193
|
+
const variant = data.reasoning.variant;
|
|
194
|
+
const budgetTokens = data.reasoning.budgetTokens;
|
|
195
|
+
if (!supportsReasoningVariant(profile, variant)) {
|
|
196
|
+
ctx.addIssue({
|
|
197
|
+
code: z.ZodIssueCode.custom,
|
|
198
|
+
path: ["reasoning", "variant"],
|
|
199
|
+
message: `Reasoning variant '${variant}' is not supported for provider '${data.provider}' model '${data.model}'. Supported: ${profile.variants.map((entry) => entry.id).join(", ")}`,
|
|
200
|
+
params: {
|
|
201
|
+
code: LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
202
|
+
scope: ErrorScope.LLM,
|
|
203
|
+
type: ErrorType.USER
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
if (typeof budgetTokens === "number" && !profile.supportsBudgetTokens) {
|
|
208
|
+
ctx.addIssue({
|
|
209
|
+
code: z.ZodIssueCode.custom,
|
|
210
|
+
path: ["reasoning", "budgetTokens"],
|
|
211
|
+
message: `Reasoning budgetTokens are not supported for provider '${data.provider}' model '${data.model}'. Remove reasoning.budgetTokens to use provider defaults.`,
|
|
212
|
+
params: {
|
|
213
|
+
code: LLMErrorCode.MODEL_INCOMPATIBLE,
|
|
214
|
+
scope: ErrorScope.LLM,
|
|
215
|
+
type: ErrorType.USER
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
159
220
|
});
|
|
160
221
|
export {
|
|
161
222
|
LLMConfigBaseSchema,
|
|
@@ -24,6 +24,7 @@ __export(factory_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(factory_exports);
|
|
25
25
|
var import_errors = require("../errors.js");
|
|
26
26
|
var import_openai = require("@ai-sdk/openai");
|
|
27
|
+
var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
27
28
|
var import_google = require("@ai-sdk/google");
|
|
28
29
|
var import_anthropic = require("@ai-sdk/anthropic");
|
|
29
30
|
var import_groq = require("@ai-sdk/groq");
|
|
@@ -31,11 +32,19 @@ var import_xai = require("@ai-sdk/xai");
|
|
|
31
32
|
var import_google_vertex = require("@ai-sdk/google-vertex");
|
|
32
33
|
var import_anthropic2 = require("@ai-sdk/google-vertex/anthropic");
|
|
33
34
|
var import_amazon_bedrock = require("@ai-sdk/amazon-bedrock");
|
|
35
|
+
var import_ai_sdk_provider = require("@openrouter/ai-sdk-provider");
|
|
34
36
|
var import_vercel = require("./vercel.js");
|
|
35
37
|
var import_cohere = require("@ai-sdk/cohere");
|
|
36
38
|
var import_ai_sdk_adapter = require("../providers/local/ai-sdk-adapter.js");
|
|
37
39
|
var import_registry = require("../registry/index.js");
|
|
38
40
|
var import_api_key_resolver = require("../../utils/api-key-resolver.js");
|
|
41
|
+
var import_anthropic_betas = require("../reasoning/anthropic-betas.js");
|
|
42
|
+
var import_anthropic_thinking = require("../reasoning/anthropic-thinking.js");
|
|
43
|
+
function isLanguageModel(value) {
|
|
44
|
+
if (!value || typeof value !== "object") return false;
|
|
45
|
+
const candidate = value;
|
|
46
|
+
return typeof candidate["modelId"] === "string" && (typeof candidate["doGenerate"] === "function" || typeof candidate["doStream"] === "function");
|
|
47
|
+
}
|
|
39
48
|
const DEXTO_GATEWAY_HEADERS = {
|
|
40
49
|
SESSION_ID: "X-Dexto-Session-ID",
|
|
41
50
|
CLIENT_SOURCE: "X-Dexto-Source",
|
|
@@ -57,11 +66,29 @@ function createVercelModel(llmConfig, context) {
|
|
|
57
66
|
if (!compatibleBaseURL) {
|
|
58
67
|
throw import_errors.LLMError.baseUrlMissing("openai-compatible");
|
|
59
68
|
}
|
|
60
|
-
|
|
69
|
+
const provider2 = (0, import_openai_compatible.createOpenAICompatible)({
|
|
70
|
+
name: "openaiCompatible",
|
|
71
|
+
baseURL: compatibleBaseURL,
|
|
72
|
+
...apiKey?.trim() ? { apiKey } : {}
|
|
73
|
+
});
|
|
74
|
+
return provider2.chatModel(model);
|
|
61
75
|
}
|
|
62
76
|
case "openrouter": {
|
|
63
77
|
const orBaseURL = baseURL || "https://openrouter.ai/api/v1";
|
|
64
|
-
|
|
78
|
+
const provider2 = (0, import_ai_sdk_provider.createOpenRouter)({
|
|
79
|
+
apiKey: apiKey ?? "",
|
|
80
|
+
baseURL: orBaseURL,
|
|
81
|
+
compatibility: "strict"
|
|
82
|
+
});
|
|
83
|
+
const chatModel = provider2.chat(model);
|
|
84
|
+
if (!isLanguageModel(chatModel)) {
|
|
85
|
+
throw import_errors.LLMError.generationFailed(
|
|
86
|
+
"OpenRouter provider returned an invalid language model instance",
|
|
87
|
+
"openrouter",
|
|
88
|
+
model
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return chatModel;
|
|
65
92
|
}
|
|
66
93
|
case "minimax": {
|
|
67
94
|
const minimaxBaseURL = baseURL || "https://api.minimax.chat/v1";
|
|
@@ -92,9 +119,22 @@ function createVercelModel(llmConfig, context) {
|
|
|
92
119
|
if (process.env.DEXTO_CLI_VERSION) {
|
|
93
120
|
headers[DEXTO_GATEWAY_HEADERS.CLIENT_VERSION] = process.env.DEXTO_CLI_VERSION;
|
|
94
121
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
122
|
+
const provider2 = (0, import_ai_sdk_provider.createOpenRouter)({
|
|
123
|
+
apiKey: apiKey ?? "",
|
|
124
|
+
baseURL: dextoBaseURL,
|
|
125
|
+
headers,
|
|
126
|
+
// This is an OpenRouter-compatible gateway; keep strict mode to enable OR features.
|
|
127
|
+
compatibility: "strict"
|
|
128
|
+
});
|
|
129
|
+
const chatModel = provider2.chat(model);
|
|
130
|
+
if (!isLanguageModel(chatModel)) {
|
|
131
|
+
throw import_errors.LLMError.generationFailed(
|
|
132
|
+
"Dexto gateway provider returned an invalid language model instance",
|
|
133
|
+
"dexto-nova",
|
|
134
|
+
model
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
return chatModel;
|
|
98
138
|
}
|
|
99
139
|
case "vertex": {
|
|
100
140
|
const projectId = process.env.GOOGLE_VERTEX_PROJECT;
|
|
@@ -106,9 +146,11 @@ function createVercelModel(llmConfig, context) {
|
|
|
106
146
|
}
|
|
107
147
|
const location = process.env.GOOGLE_VERTEX_LOCATION;
|
|
108
148
|
if (model.includes("claude")) {
|
|
149
|
+
const headers = (0, import_anthropic_thinking.supportsAnthropicInterleavedThinking)(model) ? { [import_anthropic_betas.ANTHROPIC_BETA_HEADER]: import_anthropic_betas.ANTHROPIC_INTERLEAVED_THINKING_BETA } : void 0;
|
|
109
150
|
return (0, import_anthropic2.createVertexAnthropic)({
|
|
110
151
|
project: projectId,
|
|
111
|
-
location: location || "us-east5"
|
|
152
|
+
location: location || "us-east5",
|
|
153
|
+
...headers ? { headers } : {}
|
|
112
154
|
})(model);
|
|
113
155
|
}
|
|
114
156
|
return (0, import_google_vertex.createVertex)({
|
|
@@ -132,8 +174,13 @@ function createVercelModel(llmConfig, context) {
|
|
|
132
174
|
}
|
|
133
175
|
return (0, import_amazon_bedrock.createAmazonBedrock)({ region })(modelId);
|
|
134
176
|
}
|
|
135
|
-
case "anthropic":
|
|
136
|
-
|
|
177
|
+
case "anthropic": {
|
|
178
|
+
const headers = (0, import_anthropic_thinking.supportsAnthropicInterleavedThinking)(model) ? { [import_anthropic_betas.ANTHROPIC_BETA_HEADER]: import_anthropic_betas.ANTHROPIC_INTERLEAVED_THINKING_BETA } : void 0;
|
|
179
|
+
return (0, import_anthropic.createAnthropic)({
|
|
180
|
+
apiKey: apiKey ?? "",
|
|
181
|
+
...headers ? { headers } : {}
|
|
182
|
+
})(model);
|
|
183
|
+
}
|
|
137
184
|
case "google":
|
|
138
185
|
return (0, import_google.createGoogleGenerativeAI)({ apiKey: apiKey ?? "" })(model);
|
|
139
186
|
case "groq":
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ToolManager } from '../../tools/tool-manager.js';
|
|
2
2
|
import { ValidatedLLMConfig } from '../schemas.js';
|
|
3
3
|
import { VercelLLMService } from './vercel.js';
|
|
4
|
-
import { LanguageModel } from 'ai';
|
|
4
|
+
import type { LanguageModel } from 'ai';
|
|
5
5
|
import { SessionEventBus } from '../../events/index.js';
|
|
6
6
|
import type { ConversationHistoryProvider } from '../../session/history/types.js';
|
|
7
7
|
import type { SystemPromptManager } from '../../systemPrompt/manager.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/llm/services/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/llm/services/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAYnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AA0BvD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CACxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,kBAAkB,EAC7B,OAAO,CAAC,EAAE,oBAAoB,GAC/B,aAAa,CA6Nf;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,kBAAkB,EAC1B,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,2BAA2B,EAC5C,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,OAAO,0BAA0B,EAAE,eAAe,EACnE,MAAM,EAAE,MAAM,EACd,kBAAkB,CAAC,EAAE,OAAO,mCAAmC,EAAE,kBAAkB,GAAG,IAAI,GAC3F,gBAAgB,CAelB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../../chunk-PTJYTZNU.js";
|
|
2
2
|
import { LLMError } from "../errors.js";
|
|
3
3
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
4
|
+
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
4
5
|
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
5
6
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
6
7
|
import { createGroq } from "@ai-sdk/groq";
|
|
@@ -8,11 +9,22 @@ import { createXai } from "@ai-sdk/xai";
|
|
|
8
9
|
import { createVertex } from "@ai-sdk/google-vertex";
|
|
9
10
|
import { createVertexAnthropic } from "@ai-sdk/google-vertex/anthropic";
|
|
10
11
|
import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
|
|
12
|
+
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
11
13
|
import { VercelLLMService } from "./vercel.js";
|
|
12
14
|
import { createCohere } from "@ai-sdk/cohere";
|
|
13
15
|
import { createLocalLanguageModel } from "../providers/local/ai-sdk-adapter.js";
|
|
14
16
|
import { requiresApiKey } from "../registry/index.js";
|
|
15
17
|
import { getPrimaryApiKeyEnvVar, resolveApiKeyForProvider } from "../../utils/api-key-resolver.js";
|
|
18
|
+
import {
|
|
19
|
+
ANTHROPIC_BETA_HEADER,
|
|
20
|
+
ANTHROPIC_INTERLEAVED_THINKING_BETA
|
|
21
|
+
} from "../reasoning/anthropic-betas.js";
|
|
22
|
+
import { supportsAnthropicInterleavedThinking } from "../reasoning/anthropic-thinking.js";
|
|
23
|
+
function isLanguageModel(value) {
|
|
24
|
+
if (!value || typeof value !== "object") return false;
|
|
25
|
+
const candidate = value;
|
|
26
|
+
return typeof candidate["modelId"] === "string" && (typeof candidate["doGenerate"] === "function" || typeof candidate["doStream"] === "function");
|
|
27
|
+
}
|
|
16
28
|
const DEXTO_GATEWAY_HEADERS = {
|
|
17
29
|
SESSION_ID: "X-Dexto-Session-ID",
|
|
18
30
|
CLIENT_SOURCE: "X-Dexto-Source",
|
|
@@ -34,11 +46,29 @@ function createVercelModel(llmConfig, context) {
|
|
|
34
46
|
if (!compatibleBaseURL) {
|
|
35
47
|
throw LLMError.baseUrlMissing("openai-compatible");
|
|
36
48
|
}
|
|
37
|
-
|
|
49
|
+
const provider2 = createOpenAICompatible({
|
|
50
|
+
name: "openaiCompatible",
|
|
51
|
+
baseURL: compatibleBaseURL,
|
|
52
|
+
...apiKey?.trim() ? { apiKey } : {}
|
|
53
|
+
});
|
|
54
|
+
return provider2.chatModel(model);
|
|
38
55
|
}
|
|
39
56
|
case "openrouter": {
|
|
40
57
|
const orBaseURL = baseURL || "https://openrouter.ai/api/v1";
|
|
41
|
-
|
|
58
|
+
const provider2 = createOpenRouter({
|
|
59
|
+
apiKey: apiKey ?? "",
|
|
60
|
+
baseURL: orBaseURL,
|
|
61
|
+
compatibility: "strict"
|
|
62
|
+
});
|
|
63
|
+
const chatModel = provider2.chat(model);
|
|
64
|
+
if (!isLanguageModel(chatModel)) {
|
|
65
|
+
throw LLMError.generationFailed(
|
|
66
|
+
"OpenRouter provider returned an invalid language model instance",
|
|
67
|
+
"openrouter",
|
|
68
|
+
model
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
return chatModel;
|
|
42
72
|
}
|
|
43
73
|
case "minimax": {
|
|
44
74
|
const minimaxBaseURL = baseURL || "https://api.minimax.chat/v1";
|
|
@@ -69,9 +99,22 @@ function createVercelModel(llmConfig, context) {
|
|
|
69
99
|
if (process.env.DEXTO_CLI_VERSION) {
|
|
70
100
|
headers[DEXTO_GATEWAY_HEADERS.CLIENT_VERSION] = process.env.DEXTO_CLI_VERSION;
|
|
71
101
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
102
|
+
const provider2 = createOpenRouter({
|
|
103
|
+
apiKey: apiKey ?? "",
|
|
104
|
+
baseURL: dextoBaseURL,
|
|
105
|
+
headers,
|
|
106
|
+
// This is an OpenRouter-compatible gateway; keep strict mode to enable OR features.
|
|
107
|
+
compatibility: "strict"
|
|
108
|
+
});
|
|
109
|
+
const chatModel = provider2.chat(model);
|
|
110
|
+
if (!isLanguageModel(chatModel)) {
|
|
111
|
+
throw LLMError.generationFailed(
|
|
112
|
+
"Dexto gateway provider returned an invalid language model instance",
|
|
113
|
+
"dexto-nova",
|
|
114
|
+
model
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return chatModel;
|
|
75
118
|
}
|
|
76
119
|
case "vertex": {
|
|
77
120
|
const projectId = process.env.GOOGLE_VERTEX_PROJECT;
|
|
@@ -83,9 +126,11 @@ function createVercelModel(llmConfig, context) {
|
|
|
83
126
|
}
|
|
84
127
|
const location = process.env.GOOGLE_VERTEX_LOCATION;
|
|
85
128
|
if (model.includes("claude")) {
|
|
129
|
+
const headers = supportsAnthropicInterleavedThinking(model) ? { [ANTHROPIC_BETA_HEADER]: ANTHROPIC_INTERLEAVED_THINKING_BETA } : void 0;
|
|
86
130
|
return createVertexAnthropic({
|
|
87
131
|
project: projectId,
|
|
88
|
-
location: location || "us-east5"
|
|
132
|
+
location: location || "us-east5",
|
|
133
|
+
...headers ? { headers } : {}
|
|
89
134
|
})(model);
|
|
90
135
|
}
|
|
91
136
|
return createVertex({
|
|
@@ -109,8 +154,13 @@ function createVercelModel(llmConfig, context) {
|
|
|
109
154
|
}
|
|
110
155
|
return createAmazonBedrock({ region })(modelId);
|
|
111
156
|
}
|
|
112
|
-
case "anthropic":
|
|
113
|
-
|
|
157
|
+
case "anthropic": {
|
|
158
|
+
const headers = supportsAnthropicInterleavedThinking(model) ? { [ANTHROPIC_BETA_HEADER]: ANTHROPIC_INTERLEAVED_THINKING_BETA } : void 0;
|
|
159
|
+
return createAnthropic({
|
|
160
|
+
apiKey: apiKey ?? "",
|
|
161
|
+
...headers ? { headers } : {}
|
|
162
|
+
})(model);
|
|
163
|
+
}
|
|
114
164
|
case "google":
|
|
115
165
|
return createGoogleGenerativeAI({ apiKey: apiKey ?? "" })(model);
|
|
116
166
|
case "groq":
|
|
@@ -151,7 +151,7 @@ class VercelLLMService {
|
|
|
151
151
|
temperature: this.config.temperature,
|
|
152
152
|
baseURL: this.config.baseURL,
|
|
153
153
|
// Provider-specific options
|
|
154
|
-
|
|
154
|
+
reasoning: this.config.reasoning
|
|
155
155
|
},
|
|
156
156
|
{ provider: this.config.provider, model: this.getModelId() },
|
|
157
157
|
this.logger,
|
|
@@ -88,7 +88,7 @@ class VercelLLMService {
|
|
|
88
88
|
temperature: this.config.temperature,
|
|
89
89
|
baseURL: this.config.baseURL,
|
|
90
90
|
// Provider-specific options
|
|
91
|
-
|
|
91
|
+
reasoning: this.config.reasoning
|
|
92
92
|
},
|
|
93
93
|
{ provider: this.config.provider, model: this.getModelId() },
|
|
94
94
|
this.logger,
|
package/dist/llm/types.d.ts
CHANGED
|
@@ -2,6 +2,15 @@ export declare const LLM_PROVIDERS: readonly ["openai", "openai-compatible", "an
|
|
|
2
2
|
export type LLMProvider = (typeof LLM_PROVIDERS)[number];
|
|
3
3
|
export declare const SUPPORTED_FILE_TYPES: readonly ["pdf", "image", "audio"];
|
|
4
4
|
export type SupportedFileType = (typeof SUPPORTED_FILE_TYPES)[number];
|
|
5
|
+
export type ReasoningVariant = string;
|
|
6
|
+
export interface LLMReasoningConfig {
|
|
7
|
+
variant: ReasoningVariant;
|
|
8
|
+
/**
|
|
9
|
+
* Advanced escape hatch for budget-based providers (Anthropic/Gemini/Bedrock/OpenRouter).
|
|
10
|
+
* Interpreted provider-specifically (e.g. "thinking budget", "reasoning max_tokens").
|
|
11
|
+
*/
|
|
12
|
+
budgetTokens?: number | undefined;
|
|
13
|
+
}
|
|
5
14
|
/**
|
|
6
15
|
* Context interface for message formatters.
|
|
7
16
|
* Provides runtime information for model-aware processing.
|
package/dist/llm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/llm/types.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,oMAkBhB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,oBAAoB,oCAAqC,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/llm/types.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,oMAkBhB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,oBAAoB,oCAAqC,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAItE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED;;;GAGG;AAEH,MAAM,WAAW,UAAU;IACvB,mDAAmD;IACnD,QAAQ,EAAE,WAAW,CAAC;IAEtB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
|