@dexto/core 1.9.4 → 1.9.6
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 +3 -3
- package/dist/agent/DextoAgent.d.ts +3 -3
- package/dist/agent/DextoAgent.js +3 -3
- package/dist/llm/curation-config.cjs +1 -1
- package/dist/llm/curation-config.js +1 -1
- package/dist/llm/executor/provider-options.cjs +1 -1
- package/dist/llm/executor/provider-options.d.ts.map +1 -1
- package/dist/llm/executor/provider-options.js +1 -1
- package/dist/llm/registry/sync.cjs +15 -2
- package/dist/llm/registry/sync.d.ts.map +1 -1
- package/dist/llm/registry/sync.js +15 -2
- package/dist/llm/services/factory.cjs +60 -40
- package/dist/llm/services/factory.d.ts +4 -4
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +31 -21
- package/dist/llm/services/types.d.ts +2 -2
- package/dist/llm/services/types.d.ts.map +1 -1
- package/dist/session/title-generator.cjs +2 -2
- package/dist/session/title-generator.d.ts.map +1 -1
- package/dist/session/title-generator.js +2 -2
- package/package.json +2 -2
|
@@ -1867,10 +1867,10 @@ Either:
|
|
|
1867
1867
|
* await agent.switchLLM({ model: 'gpt-5' });
|
|
1868
1868
|
*
|
|
1869
1869
|
* // Switch to a different provider with explicit API key
|
|
1870
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
1870
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5', apiKey: 'sk-ant-...' });
|
|
1871
1871
|
*
|
|
1872
1872
|
* // Switch with session options
|
|
1873
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
1873
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5' }, 'user-123');
|
|
1874
1874
|
*
|
|
1875
1875
|
* // Switch for all sessions
|
|
1876
1876
|
* await agent.switchLLM({ model: 'gpt-5' }, '*');
|
|
@@ -2014,7 +2014,7 @@ Either:
|
|
|
2014
2014
|
* const provider = agent.inferProviderFromModel('gpt-5');
|
|
2015
2015
|
* console.log(provider); // 'openai'
|
|
2016
2016
|
*
|
|
2017
|
-
* const provider2 = agent.inferProviderFromModel('claude-4-
|
|
2017
|
+
* const provider2 = agent.inferProviderFromModel('claude-sonnet-4-5');
|
|
2018
2018
|
* console.log(provider2); // 'anthropic'
|
|
2019
2019
|
*
|
|
2020
2020
|
* const provider3 = agent.inferProviderFromModel('unknown-model');
|
|
@@ -617,10 +617,10 @@ export declare class DextoAgent {
|
|
|
617
617
|
* await agent.switchLLM({ model: 'gpt-5' });
|
|
618
618
|
*
|
|
619
619
|
* // Switch to a different provider with explicit API key
|
|
620
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
620
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5', apiKey: 'sk-ant-...' });
|
|
621
621
|
*
|
|
622
622
|
* // Switch with session options
|
|
623
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
623
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5' }, 'user-123');
|
|
624
624
|
*
|
|
625
625
|
* // Switch for all sessions
|
|
626
626
|
* await agent.switchLLM({ model: 'gpt-5' }, '*');
|
|
@@ -706,7 +706,7 @@ export declare class DextoAgent {
|
|
|
706
706
|
* const provider = agent.inferProviderFromModel('gpt-5');
|
|
707
707
|
* console.log(provider); // 'openai'
|
|
708
708
|
*
|
|
709
|
-
* const provider2 = agent.inferProviderFromModel('claude-4-
|
|
709
|
+
* const provider2 = agent.inferProviderFromModel('claude-sonnet-4-5');
|
|
710
710
|
* console.log(provider2); // 'anthropic'
|
|
711
711
|
*
|
|
712
712
|
* const provider3 = agent.inferProviderFromModel('unknown-model');
|
package/dist/agent/DextoAgent.js
CHANGED
|
@@ -1818,10 +1818,10 @@ Either:
|
|
|
1818
1818
|
* await agent.switchLLM({ model: 'gpt-5' });
|
|
1819
1819
|
*
|
|
1820
1820
|
* // Switch to a different provider with explicit API key
|
|
1821
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
1821
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5', apiKey: 'sk-ant-...' });
|
|
1822
1822
|
*
|
|
1823
1823
|
* // Switch with session options
|
|
1824
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
1824
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5' }, 'user-123');
|
|
1825
1825
|
*
|
|
1826
1826
|
* // Switch for all sessions
|
|
1827
1827
|
* await agent.switchLLM({ model: 'gpt-5' }, '*');
|
|
@@ -1965,7 +1965,7 @@ Either:
|
|
|
1965
1965
|
* const provider = agent.inferProviderFromModel('gpt-5');
|
|
1966
1966
|
* console.log(provider); // 'openai'
|
|
1967
1967
|
*
|
|
1968
|
-
* const provider2 = agent.inferProviderFromModel('claude-4-
|
|
1968
|
+
* const provider2 = agent.inferProviderFromModel('claude-sonnet-4-5');
|
|
1969
1969
|
* console.log(provider2); // 'anthropic'
|
|
1970
1970
|
*
|
|
1971
1971
|
* const provider3 = agent.inferProviderFromModel('unknown-model');
|
|
@@ -34,7 +34,7 @@ function coerceBudgetTokens(tokens, minimum) {
|
|
|
34
34
|
return Math.max(minimum, Math.floor(tokens));
|
|
35
35
|
}
|
|
36
36
|
function toOpenAIReasoningEffort(reasoningVariant) {
|
|
37
|
-
return reasoningVariant === "none" || reasoningVariant === "minimal" || reasoningVariant === "low" || reasoningVariant === "medium" || reasoningVariant === "high" || reasoningVariant === "xhigh" ? reasoningVariant : void 0;
|
|
37
|
+
return reasoningVariant === "none" || reasoningVariant === "minimal" || reasoningVariant === "low" || reasoningVariant === "medium" || reasoningVariant === "high" || reasoningVariant === "xhigh" || reasoningVariant === "max" || reasoningVariant === "ultra" ? reasoningVariant : void 0;
|
|
38
38
|
}
|
|
39
39
|
function toOpenAICompatibleReasoningEffort(reasoningVariant) {
|
|
40
40
|
return reasoningVariant === "none" || reasoningVariant === "low" || reasoningVariant === "medium" || reasoningVariant === "high" ? reasoningVariant : void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-options.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/provider-options.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAelE,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,WAAW,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CAC9C;
|
|
1
|
+
{"version":3,"file":"provider-options.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/provider-options.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAelE,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,WAAW,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CAC9C;AA+LD,wBAAgB,iCAAiC,CAC7C,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,GACrE,MAAM,GAAG,SAAS,CA6BpB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,qBAAqB,GAC9B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CA4IrD"}
|
|
@@ -22,7 +22,7 @@ function coerceBudgetTokens(tokens, minimum) {
|
|
|
22
22
|
return Math.max(minimum, Math.floor(tokens));
|
|
23
23
|
}
|
|
24
24
|
function toOpenAIReasoningEffort(reasoningVariant) {
|
|
25
|
-
return reasoningVariant === "none" || reasoningVariant === "minimal" || reasoningVariant === "low" || reasoningVariant === "medium" || reasoningVariant === "high" || reasoningVariant === "xhigh" ? reasoningVariant : void 0;
|
|
25
|
+
return reasoningVariant === "none" || reasoningVariant === "minimal" || reasoningVariant === "low" || reasoningVariant === "medium" || reasoningVariant === "high" || reasoningVariant === "xhigh" || reasoningVariant === "max" || reasoningVariant === "ultra" ? reasoningVariant : void 0;
|
|
26
26
|
}
|
|
27
27
|
function toOpenAICompatibleReasoningEffort(reasoningVariant) {
|
|
28
28
|
return reasoningVariant === "none" || reasoningVariant === "low" || reasoningVariant === "medium" || reasoningVariant === "high" ? reasoningVariant : void 0;
|
|
@@ -28,6 +28,13 @@ var import_DextoValidationError = require("../../errors/DextoValidationError.js"
|
|
|
28
28
|
var import_DextoRuntimeError = require("../../errors/DextoRuntimeError.js");
|
|
29
29
|
var import_types = require("../../errors/types.js");
|
|
30
30
|
const MODELS_DEV_URL = "https://models.dev/api.json";
|
|
31
|
+
const MODELS_DEV_OPENAI_UNSUPPORTED_MODEL_IDS = /* @__PURE__ */ new Set(["gpt-5.6"]);
|
|
32
|
+
const OPENAI_SHORT_CONTEXT_INPUT_TOKENS = 272e3;
|
|
33
|
+
const OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS = /* @__PURE__ */ new Set([
|
|
34
|
+
"gpt-5.6-sol",
|
|
35
|
+
"gpt-5.6-terra",
|
|
36
|
+
"gpt-5.6-luna"
|
|
37
|
+
]);
|
|
31
38
|
function isRecord(value) {
|
|
32
39
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
33
40
|
}
|
|
@@ -179,6 +186,7 @@ function getSupportedFileTypesFromModel(provider, model) {
|
|
|
179
186
|
}
|
|
180
187
|
function getPricing(model) {
|
|
181
188
|
if (!model.cost) return void 0;
|
|
189
|
+
const isOpenAIGpt56 = OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS.has(model.id);
|
|
182
190
|
return {
|
|
183
191
|
inputPerM: model.cost.input,
|
|
184
192
|
outputPerM: model.cost.output,
|
|
@@ -189,6 +197,11 @@ function getPricing(model) {
|
|
|
189
197
|
...typeof model.cost.output_audio === "number" ? { outputAudioPerM: model.cost.output_audio } : {},
|
|
190
198
|
...model.cost.context_over_200k ? {
|
|
191
199
|
contextOver200kPerM: {
|
|
200
|
+
...isOpenAIGpt56 ? {
|
|
201
|
+
inputTokensAbove: OPENAI_SHORT_CONTEXT_INPUT_TOKENS,
|
|
202
|
+
...model.cost.cache_read !== void 0 ? { cacheReadPerM: model.cost.cache_read * 2 } : {},
|
|
203
|
+
...model.cost.cache_write !== void 0 ? { cacheWritePerM: model.cost.cache_write * 2 } : {}
|
|
204
|
+
} : {},
|
|
192
205
|
inputPerM: model.cost.context_over_200k.input,
|
|
193
206
|
outputPerM: model.cost.context_over_200k.output
|
|
194
207
|
}
|
|
@@ -207,7 +220,7 @@ function modelToModelInfo(provider, model, options) {
|
|
|
207
220
|
return {
|
|
208
221
|
name: model.id,
|
|
209
222
|
displayName: model.name,
|
|
210
|
-
maxInputTokens: model.limit.input ?? model.limit.context,
|
|
223
|
+
maxInputTokens: provider === "openai" && OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS.has(model.id) ? OPENAI_SHORT_CONTEXT_INPUT_TOKENS : model.limit.input ?? model.limit.context,
|
|
211
224
|
supportedFileTypes: getSupportedFileTypesFromModel(provider, model),
|
|
212
225
|
reasoning: requireBoolean(
|
|
213
226
|
model.reasoning,
|
|
@@ -285,7 +298,7 @@ function buildModelsByProviderFromParsedSources(params) {
|
|
|
285
298
|
bedrock: "anthropic.claude-sonnet-4-5-20250929-v1:0"
|
|
286
299
|
};
|
|
287
300
|
const include = {
|
|
288
|
-
openai: (id) => id.startsWith("gpt-") || id.startsWith("o"),
|
|
301
|
+
openai: (id) => (id.startsWith("gpt-") || id.startsWith("o")) && !MODELS_DEV_OPENAI_UNSUPPORTED_MODEL_IDS.has(id),
|
|
289
302
|
anthropic: (id) => id.startsWith("claude-"),
|
|
290
303
|
google: (id) => id.startsWith("gemini-"),
|
|
291
304
|
groq: (_id) => true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/llm/registry/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C,eAAO,MAAM,cAAc,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/llm/registry/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C,eAAO,MAAM,cAAc,gCAAgC,CAAC;AAS5D,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACtD,KAAK,iBAAiB,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC1C,CAAC;AACF,KAAK,cAAc,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,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AAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAoB5C"}
|
|
@@ -3,6 +3,13 @@ import { DextoValidationError } from "../../errors/DextoValidationError.js";
|
|
|
3
3
|
import { DextoRuntimeError } from "../../errors/DextoRuntimeError.js";
|
|
4
4
|
import { ErrorScope, ErrorType } from "../../errors/types.js";
|
|
5
5
|
const MODELS_DEV_URL = "https://models.dev/api.json";
|
|
6
|
+
const MODELS_DEV_OPENAI_UNSUPPORTED_MODEL_IDS = /* @__PURE__ */ new Set(["gpt-5.6"]);
|
|
7
|
+
const OPENAI_SHORT_CONTEXT_INPUT_TOKENS = 272e3;
|
|
8
|
+
const OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS = /* @__PURE__ */ new Set([
|
|
9
|
+
"gpt-5.6-sol",
|
|
10
|
+
"gpt-5.6-terra",
|
|
11
|
+
"gpt-5.6-luna"
|
|
12
|
+
]);
|
|
6
13
|
function isRecord(value) {
|
|
7
14
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
15
|
}
|
|
@@ -154,6 +161,7 @@ function getSupportedFileTypesFromModel(provider, model) {
|
|
|
154
161
|
}
|
|
155
162
|
function getPricing(model) {
|
|
156
163
|
if (!model.cost) return void 0;
|
|
164
|
+
const isOpenAIGpt56 = OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS.has(model.id);
|
|
157
165
|
return {
|
|
158
166
|
inputPerM: model.cost.input,
|
|
159
167
|
outputPerM: model.cost.output,
|
|
@@ -164,6 +172,11 @@ function getPricing(model) {
|
|
|
164
172
|
...typeof model.cost.output_audio === "number" ? { outputAudioPerM: model.cost.output_audio } : {},
|
|
165
173
|
...model.cost.context_over_200k ? {
|
|
166
174
|
contextOver200kPerM: {
|
|
175
|
+
...isOpenAIGpt56 ? {
|
|
176
|
+
inputTokensAbove: OPENAI_SHORT_CONTEXT_INPUT_TOKENS,
|
|
177
|
+
...model.cost.cache_read !== void 0 ? { cacheReadPerM: model.cost.cache_read * 2 } : {},
|
|
178
|
+
...model.cost.cache_write !== void 0 ? { cacheWritePerM: model.cost.cache_write * 2 } : {}
|
|
179
|
+
} : {},
|
|
167
180
|
inputPerM: model.cost.context_over_200k.input,
|
|
168
181
|
outputPerM: model.cost.context_over_200k.output
|
|
169
182
|
}
|
|
@@ -182,7 +195,7 @@ function modelToModelInfo(provider, model, options) {
|
|
|
182
195
|
return {
|
|
183
196
|
name: model.id,
|
|
184
197
|
displayName: model.name,
|
|
185
|
-
maxInputTokens: model.limit.input ?? model.limit.context,
|
|
198
|
+
maxInputTokens: provider === "openai" && OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS.has(model.id) ? OPENAI_SHORT_CONTEXT_INPUT_TOKENS : model.limit.input ?? model.limit.context,
|
|
186
199
|
supportedFileTypes: getSupportedFileTypesFromModel(provider, model),
|
|
187
200
|
reasoning: requireBoolean(
|
|
188
201
|
model.reasoning,
|
|
@@ -260,7 +273,7 @@ function buildModelsByProviderFromParsedSources(params) {
|
|
|
260
273
|
bedrock: "anthropic.claude-sonnet-4-5-20250929-v1:0"
|
|
261
274
|
};
|
|
262
275
|
const include = {
|
|
263
|
-
openai: (id) => id.startsWith("gpt-") || id.startsWith("o"),
|
|
276
|
+
openai: (id) => (id.startsWith("gpt-") || id.startsWith("o")) && !MODELS_DEV_OPENAI_UNSUPPORTED_MODEL_IDS.has(id),
|
|
264
277
|
anthropic: (id) => id.startsWith("claude-"),
|
|
265
278
|
google: (id) => id.startsWith("gemini-"),
|
|
266
279
|
groq: (_id) => true,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var factory_exports = {};
|
|
20
30
|
__export(factory_exports, {
|
|
@@ -23,22 +33,9 @@ __export(factory_exports, {
|
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(factory_exports);
|
|
25
35
|
var import_errors = require("../errors.js");
|
|
26
|
-
var import_openai = require("@ai-sdk/openai");
|
|
27
|
-
var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
28
|
-
var import_google = require("@ai-sdk/google");
|
|
29
|
-
var import_anthropic = require("@ai-sdk/anthropic");
|
|
30
|
-
var import_groq = require("@ai-sdk/groq");
|
|
31
|
-
var import_xai = require("@ai-sdk/xai");
|
|
32
|
-
var import_google_vertex = require("@ai-sdk/google-vertex");
|
|
33
|
-
var import_anthropic2 = require("@ai-sdk/google-vertex/anthropic");
|
|
34
|
-
var import_amazon_bedrock = require("@ai-sdk/amazon-bedrock");
|
|
35
|
-
var import_ai_sdk_provider = require("@openrouter/ai-sdk-provider");
|
|
36
36
|
var import_vercel = require("./vercel.js");
|
|
37
|
-
var import_cohere = require("@ai-sdk/cohere");
|
|
38
|
-
var import_ai_sdk_adapter = require("../providers/local/ai-sdk-adapter.js");
|
|
39
37
|
var import_llm = require("@dexto/llm");
|
|
40
38
|
var import_api_key_resolver = require("../../utils/api-key-resolver.js");
|
|
41
|
-
var import_codex_app_server = require("../providers/codex-app-server.js");
|
|
42
39
|
var import_codex_base_url = require("../providers/codex-base-url.js");
|
|
43
40
|
var import_execution_context = require("../../utils/execution-context.js");
|
|
44
41
|
function isLanguageModel(value) {
|
|
@@ -108,7 +105,7 @@ function logRuntimeAuthResolution(input) {
|
|
|
108
105
|
}
|
|
109
106
|
});
|
|
110
107
|
}
|
|
111
|
-
function createVercelModel(llmConfig, context) {
|
|
108
|
+
async function createVercelModel(llmConfig, context) {
|
|
112
109
|
const { provider, model, baseURL } = llmConfig;
|
|
113
110
|
const runtimeAuth = context?.authResolver?.resolveRuntimeAuth({
|
|
114
111
|
provider,
|
|
@@ -139,14 +136,16 @@ function createVercelModel(llmConfig, context) {
|
|
|
139
136
|
switch (provider.toLowerCase()) {
|
|
140
137
|
case "openai": {
|
|
141
138
|
if (usesCodexRuntimeAuth && runtimeBaseURL) {
|
|
142
|
-
|
|
139
|
+
const { createCodexLanguageModel } = await import("../providers/codex-app-server.js");
|
|
140
|
+
return createCodexLanguageModel({
|
|
143
141
|
modelId: model,
|
|
144
142
|
baseURL: runtimeBaseURL,
|
|
145
143
|
cwd: resolveProviderWorkingDirectory(context?.cwd),
|
|
146
144
|
...context?.onCodexRateLimitStatus ? { onRateLimitStatus: context.onCodexRateLimitStatus } : {}
|
|
147
145
|
});
|
|
148
146
|
}
|
|
149
|
-
|
|
147
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
148
|
+
return createOpenAI({
|
|
150
149
|
apiKey: apiKey ?? "",
|
|
151
150
|
...effectiveBaseURL ? { baseURL: effectiveBaseURL } : {},
|
|
152
151
|
...runtimeHeaders ? { headers: runtimeHeaders } : {},
|
|
@@ -158,7 +157,8 @@ function createVercelModel(llmConfig, context) {
|
|
|
158
157
|
if (!compatibleBaseURL) {
|
|
159
158
|
throw import_errors.LLMError.baseUrlMissing("openai-compatible");
|
|
160
159
|
}
|
|
161
|
-
const
|
|
160
|
+
const { createOpenAICompatible } = await import("@ai-sdk/openai-compatible");
|
|
161
|
+
const provider2 = createOpenAICompatible({
|
|
162
162
|
name: "openaiCompatible",
|
|
163
163
|
baseURL: compatibleBaseURL,
|
|
164
164
|
...apiKey?.trim() ? { apiKey } : {},
|
|
@@ -169,7 +169,8 @@ function createVercelModel(llmConfig, context) {
|
|
|
169
169
|
}
|
|
170
170
|
case "openrouter": {
|
|
171
171
|
const orBaseURL = baseURL || "https://openrouter.ai/api/v1";
|
|
172
|
-
const
|
|
172
|
+
const { createOpenRouter } = await import("@openrouter/ai-sdk-provider");
|
|
173
|
+
const provider2 = createOpenRouter({
|
|
173
174
|
apiKey: apiKey ?? "",
|
|
174
175
|
baseURL: orBaseURL,
|
|
175
176
|
compatibility: "strict"
|
|
@@ -186,7 +187,8 @@ function createVercelModel(llmConfig, context) {
|
|
|
186
187
|
}
|
|
187
188
|
case "minimax": {
|
|
188
189
|
const minimaxBaseURL = effectiveBaseURL || "https://api.minimax.chat/v1";
|
|
189
|
-
|
|
190
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
191
|
+
return createOpenAI({
|
|
190
192
|
apiKey: apiKey ?? "",
|
|
191
193
|
baseURL: minimaxBaseURL,
|
|
192
194
|
...runtimeHeaders ? { headers: runtimeHeaders } : {},
|
|
@@ -195,7 +197,8 @@ function createVercelModel(llmConfig, context) {
|
|
|
195
197
|
}
|
|
196
198
|
case "glm": {
|
|
197
199
|
const glmBaseURL = effectiveBaseURL || "https://open.bigmodel.cn/api/paas/v4";
|
|
198
|
-
|
|
200
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
201
|
+
return createOpenAI({
|
|
199
202
|
apiKey: apiKey ?? "",
|
|
200
203
|
baseURL: glmBaseURL,
|
|
201
204
|
...runtimeHeaders ? { headers: runtimeHeaders } : {},
|
|
@@ -206,7 +209,8 @@ function createVercelModel(llmConfig, context) {
|
|
|
206
209
|
if (!effectiveBaseURL) {
|
|
207
210
|
throw import_errors.LLMError.baseUrlMissing("litellm");
|
|
208
211
|
}
|
|
209
|
-
|
|
212
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
213
|
+
return createOpenAI({
|
|
210
214
|
apiKey: apiKey ?? "",
|
|
211
215
|
baseURL: effectiveBaseURL,
|
|
212
216
|
...runtimeHeaders ? { headers: runtimeHeaders } : {},
|
|
@@ -215,7 +219,8 @@ function createVercelModel(llmConfig, context) {
|
|
|
215
219
|
}
|
|
216
220
|
case "glama": {
|
|
217
221
|
const glamaBaseURL = effectiveBaseURL || "https://glama.ai/api/gateway/openai/v1";
|
|
218
|
-
|
|
222
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
223
|
+
return createOpenAI({
|
|
219
224
|
apiKey: apiKey ?? "",
|
|
220
225
|
baseURL: glamaBaseURL,
|
|
221
226
|
...runtimeHeaders ? { headers: runtimeHeaders } : {},
|
|
@@ -234,7 +239,8 @@ function createVercelModel(llmConfig, context) {
|
|
|
234
239
|
if (process.env.DEXTO_CLI_VERSION) {
|
|
235
240
|
headers[DEXTO_GATEWAY_HEADERS.CLIENT_VERSION] = process.env.DEXTO_CLI_VERSION;
|
|
236
241
|
}
|
|
237
|
-
const
|
|
242
|
+
const { createOpenAICompatible } = await import("@ai-sdk/openai-compatible");
|
|
243
|
+
const provider2 = createOpenAICompatible({
|
|
238
244
|
name: "dexto-nova",
|
|
239
245
|
baseURL: dextoBaseURL,
|
|
240
246
|
headers,
|
|
@@ -261,13 +267,15 @@ function createVercelModel(llmConfig, context) {
|
|
|
261
267
|
const location = process.env.GOOGLE_VERTEX_LOCATION;
|
|
262
268
|
if (model.includes("claude")) {
|
|
263
269
|
const headers = (0, import_llm.supportsAnthropicInterleavedThinking)(model) ? { [import_llm.ANTHROPIC_BETA_HEADER]: import_llm.ANTHROPIC_INTERLEAVED_THINKING_BETA } : void 0;
|
|
264
|
-
|
|
270
|
+
const { createVertexAnthropic } = await import("@ai-sdk/google-vertex/anthropic");
|
|
271
|
+
return createVertexAnthropic({
|
|
265
272
|
project: projectId,
|
|
266
273
|
location: location || "us-east5",
|
|
267
274
|
...headers ? { headers } : {}
|
|
268
275
|
})(model);
|
|
269
276
|
}
|
|
270
|
-
|
|
277
|
+
const { createVertex } = await import("@ai-sdk/google-vertex");
|
|
278
|
+
return createVertex({
|
|
271
279
|
project: projectId,
|
|
272
280
|
location: location || "us-central1"
|
|
273
281
|
})(model);
|
|
@@ -286,31 +294,42 @@ function createVercelModel(llmConfig, context) {
|
|
|
286
294
|
const prefix = region.startsWith("eu-") ? "eu." : "us.";
|
|
287
295
|
modelId = `${prefix}${model}`;
|
|
288
296
|
}
|
|
289
|
-
|
|
297
|
+
const { createAmazonBedrock } = await import("@ai-sdk/amazon-bedrock");
|
|
298
|
+
return createAmazonBedrock({ region })(modelId);
|
|
290
299
|
}
|
|
291
300
|
case "anthropic": {
|
|
292
301
|
const headers = mergeHeaders(
|
|
293
302
|
(0, import_llm.supportsAnthropicInterleavedThinking)(model) ? { [import_llm.ANTHROPIC_BETA_HEADER]: import_llm.ANTHROPIC_INTERLEAVED_THINKING_BETA } : void 0,
|
|
294
303
|
runtimeHeaders
|
|
295
304
|
);
|
|
296
|
-
|
|
305
|
+
const { createAnthropic } = await import("@ai-sdk/anthropic");
|
|
306
|
+
return createAnthropic({
|
|
297
307
|
apiKey: apiKey ?? "",
|
|
298
308
|
...effectiveBaseURL ? { baseURL: effectiveBaseURL } : {},
|
|
299
309
|
...headers ? { headers } : {},
|
|
300
310
|
...runtimeFetch ? { fetch: runtimeFetch } : {}
|
|
301
311
|
})(model);
|
|
302
312
|
}
|
|
303
|
-
case "google":
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
case "
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
313
|
+
case "google": {
|
|
314
|
+
const { createGoogleGenerativeAI } = await import("@ai-sdk/google");
|
|
315
|
+
return createGoogleGenerativeAI({ apiKey: apiKey ?? "" })(model);
|
|
316
|
+
}
|
|
317
|
+
case "groq": {
|
|
318
|
+
const { createGroq } = await import("@ai-sdk/groq");
|
|
319
|
+
return createGroq({ apiKey: apiKey ?? "" })(model);
|
|
320
|
+
}
|
|
321
|
+
case "xai": {
|
|
322
|
+
const { createXai } = await import("@ai-sdk/xai");
|
|
323
|
+
return createXai({ apiKey: apiKey ?? "" })(model);
|
|
324
|
+
}
|
|
325
|
+
case "cohere": {
|
|
326
|
+
const { createCohere } = await import("@ai-sdk/cohere");
|
|
327
|
+
return createCohere({ apiKey: apiKey ?? "" })(model);
|
|
328
|
+
}
|
|
311
329
|
case "ollama": {
|
|
312
330
|
const ollamaBaseURL = effectiveBaseURL || "http://localhost:11434/v1";
|
|
313
|
-
|
|
331
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
332
|
+
return createOpenAI({
|
|
314
333
|
apiKey: apiKey ?? "ollama",
|
|
315
334
|
baseURL: ollamaBaseURL,
|
|
316
335
|
...runtimeHeaders ? { headers: runtimeHeaders } : {},
|
|
@@ -318,7 +337,8 @@ function createVercelModel(llmConfig, context) {
|
|
|
318
337
|
}).chat(model);
|
|
319
338
|
}
|
|
320
339
|
case "local": {
|
|
321
|
-
|
|
340
|
+
const { createLocalLanguageModel } = await import("../providers/local/ai-sdk-adapter.js");
|
|
341
|
+
return createLocalLanguageModel({
|
|
322
342
|
modelId: model
|
|
323
343
|
});
|
|
324
344
|
}
|
|
@@ -326,7 +346,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
326
346
|
throw import_errors.LLMError.unsupportedProvider(provider);
|
|
327
347
|
}
|
|
328
348
|
}
|
|
329
|
-
function createLLMService(config, toolManager, systemPromptManager, conversationStore, sessionEventBus, sessionId, resourceManager, logger, options, languageModelFactory) {
|
|
349
|
+
async function createLLMService(config, toolManager, systemPromptManager, conversationStore, sessionEventBus, sessionId, resourceManager, logger, options, languageModelFactory) {
|
|
330
350
|
const { usageScopeId, compactionStrategy, executionControl, steerQueue, followUpQueue } = options;
|
|
331
351
|
const providerContext = {
|
|
332
352
|
sessionId,
|
|
@@ -341,11 +361,11 @@ function createLLMService(config, toolManager, systemPromptManager, conversation
|
|
|
341
361
|
});
|
|
342
362
|
}
|
|
343
363
|
};
|
|
344
|
-
const model = languageModelFactory?.({
|
|
364
|
+
const model = await (languageModelFactory?.({
|
|
345
365
|
config,
|
|
346
366
|
context: providerContext,
|
|
347
367
|
createDefaultLanguageModel: () => createVercelModel(config, providerContext)
|
|
348
|
-
}) ?? createVercelModel(config, providerContext);
|
|
368
|
+
}) ?? createVercelModel(config, providerContext));
|
|
349
369
|
return new import_vercel.VercelLLMService(
|
|
350
370
|
toolManager,
|
|
351
371
|
model,
|
|
@@ -15,9 +15,9 @@ import type { CreateLLMServiceOptions, DextoProviderContext, LanguageModelFactor
|
|
|
15
15
|
*
|
|
16
16
|
* @param llmConfig - LLM configuration from agent config
|
|
17
17
|
* @param context - Optional context for usage tracking (session ID, etc.)
|
|
18
|
-
* @returns Vercel AI SDK LanguageModel instance
|
|
18
|
+
* @returns Promise resolving to a Vercel AI SDK LanguageModel instance
|
|
19
19
|
*/
|
|
20
|
-
export declare function createVercelModel(llmConfig: ValidatedLLMConfig, context?: DextoProviderContext): LanguageModel
|
|
20
|
+
export declare function createVercelModel(llmConfig: ValidatedLLMConfig, context?: DextoProviderContext): Promise<LanguageModel>;
|
|
21
21
|
/**
|
|
22
22
|
* Create an LLM service instance using the Vercel AI SDK.
|
|
23
23
|
* All providers are routed through the unified Vercel service.
|
|
@@ -31,7 +31,7 @@ export declare function createVercelModel(llmConfig: ValidatedLLMConfig, context
|
|
|
31
31
|
* @param resourceManager Resource manager for blob storage and resource access
|
|
32
32
|
* @param logger Logger instance for dependency injection
|
|
33
33
|
* @param options Session-scoped runtime options
|
|
34
|
-
* @returns VercelLLMService instance
|
|
34
|
+
* @returns Promise resolving to a VercelLLMService instance
|
|
35
35
|
*/
|
|
36
|
-
export declare function createLLMService(config: ValidatedLLMConfig, toolManager: ToolManager, systemPromptManager: SystemPromptManager, conversationStore: ConversationStore, sessionEventBus: SessionEventBus, sessionId: string, resourceManager: import('../../resources/index.js').ResourceManager, logger: Logger, options: CreateLLMServiceOptions, languageModelFactory?: LanguageModelFactory): VercelLLMService
|
|
36
|
+
export declare function createLLMService(config: ValidatedLLMConfig, toolManager: ToolManager, systemPromptManager: SystemPromptManager, conversationStore: ConversationStore, sessionEventBus: SessionEventBus, sessionId: string, resourceManager: import('../../resources/index.js').ResourceManager, logger: Logger, options: CreateLLMServiceOptions, languageModelFactory?: LanguageModelFactory): Promise<VercelLLMService>;
|
|
37
37
|
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -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;AAEnD,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;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EACR,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACvB,MAAM,YAAY,CAAC;AAoHpB;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACnC,SAAS,EAAE,kBAAkB,EAC7B,OAAO,CAAC,EAAE,oBAAoB,GAC/B,OAAO,CAAC,aAAa,CAAC,CAiUxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,kBAAkB,EAC1B,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,mBAAmB,EACxC,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,OAAO,0BAA0B,EAAE,eAAe,EACnE,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,uBAAuB,EAChC,oBAAoB,CAAC,EAAE,oBAAoB,GAC5C,OAAO,CAAC,gBAAgB,CAAC,CAwC3B"}
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import "../../chunk-C6A6W6XS.js";
|
|
2
2
|
import { LLMError } from "../errors.js";
|
|
3
|
-
import { createOpenAI } from "@ai-sdk/openai";
|
|
4
|
-
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
5
|
-
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
6
|
-
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
7
|
-
import { createGroq } from "@ai-sdk/groq";
|
|
8
|
-
import { createXai } from "@ai-sdk/xai";
|
|
9
|
-
import { createVertex } from "@ai-sdk/google-vertex";
|
|
10
|
-
import { createVertexAnthropic } from "@ai-sdk/google-vertex/anthropic";
|
|
11
|
-
import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
|
|
12
|
-
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
13
3
|
import { VercelLLMService } from "./vercel.js";
|
|
14
|
-
import { createCohere } from "@ai-sdk/cohere";
|
|
15
|
-
import { createLocalLanguageModel } from "../providers/local/ai-sdk-adapter.js";
|
|
16
4
|
import {
|
|
17
5
|
ANTHROPIC_BETA_HEADER,
|
|
18
6
|
ANTHROPIC_INTERLEAVED_THINKING_BETA,
|
|
@@ -20,7 +8,6 @@ import {
|
|
|
20
8
|
supportsAnthropicInterleavedThinking
|
|
21
9
|
} from "@dexto/llm";
|
|
22
10
|
import { getPrimaryApiKeyEnvVar, resolveApiKeyForProvider } from "../../utils/api-key-resolver.js";
|
|
23
|
-
import { createCodexLanguageModel } from "../providers/codex-app-server.js";
|
|
24
11
|
import { isCodexBaseURL } from "../providers/codex-base-url.js";
|
|
25
12
|
import { findDextoProjectRoot } from "../../utils/execution-context.js";
|
|
26
13
|
function isLanguageModel(value) {
|
|
@@ -90,7 +77,7 @@ function logRuntimeAuthResolution(input) {
|
|
|
90
77
|
}
|
|
91
78
|
});
|
|
92
79
|
}
|
|
93
|
-
function createVercelModel(llmConfig, context) {
|
|
80
|
+
async function createVercelModel(llmConfig, context) {
|
|
94
81
|
const { provider, model, baseURL } = llmConfig;
|
|
95
82
|
const runtimeAuth = context?.authResolver?.resolveRuntimeAuth({
|
|
96
83
|
provider,
|
|
@@ -121,6 +108,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
121
108
|
switch (provider.toLowerCase()) {
|
|
122
109
|
case "openai": {
|
|
123
110
|
if (usesCodexRuntimeAuth && runtimeBaseURL) {
|
|
111
|
+
const { createCodexLanguageModel } = await import("../providers/codex-app-server.js");
|
|
124
112
|
return createCodexLanguageModel({
|
|
125
113
|
modelId: model,
|
|
126
114
|
baseURL: runtimeBaseURL,
|
|
@@ -128,6 +116,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
128
116
|
...context?.onCodexRateLimitStatus ? { onRateLimitStatus: context.onCodexRateLimitStatus } : {}
|
|
129
117
|
});
|
|
130
118
|
}
|
|
119
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
131
120
|
return createOpenAI({
|
|
132
121
|
apiKey: apiKey ?? "",
|
|
133
122
|
...effectiveBaseURL ? { baseURL: effectiveBaseURL } : {},
|
|
@@ -140,6 +129,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
140
129
|
if (!compatibleBaseURL) {
|
|
141
130
|
throw LLMError.baseUrlMissing("openai-compatible");
|
|
142
131
|
}
|
|
132
|
+
const { createOpenAICompatible } = await import("@ai-sdk/openai-compatible");
|
|
143
133
|
const provider2 = createOpenAICompatible({
|
|
144
134
|
name: "openaiCompatible",
|
|
145
135
|
baseURL: compatibleBaseURL,
|
|
@@ -151,6 +141,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
151
141
|
}
|
|
152
142
|
case "openrouter": {
|
|
153
143
|
const orBaseURL = baseURL || "https://openrouter.ai/api/v1";
|
|
144
|
+
const { createOpenRouter } = await import("@openrouter/ai-sdk-provider");
|
|
154
145
|
const provider2 = createOpenRouter({
|
|
155
146
|
apiKey: apiKey ?? "",
|
|
156
147
|
baseURL: orBaseURL,
|
|
@@ -168,6 +159,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
168
159
|
}
|
|
169
160
|
case "minimax": {
|
|
170
161
|
const minimaxBaseURL = effectiveBaseURL || "https://api.minimax.chat/v1";
|
|
162
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
171
163
|
return createOpenAI({
|
|
172
164
|
apiKey: apiKey ?? "",
|
|
173
165
|
baseURL: minimaxBaseURL,
|
|
@@ -177,6 +169,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
177
169
|
}
|
|
178
170
|
case "glm": {
|
|
179
171
|
const glmBaseURL = effectiveBaseURL || "https://open.bigmodel.cn/api/paas/v4";
|
|
172
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
180
173
|
return createOpenAI({
|
|
181
174
|
apiKey: apiKey ?? "",
|
|
182
175
|
baseURL: glmBaseURL,
|
|
@@ -188,6 +181,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
188
181
|
if (!effectiveBaseURL) {
|
|
189
182
|
throw LLMError.baseUrlMissing("litellm");
|
|
190
183
|
}
|
|
184
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
191
185
|
return createOpenAI({
|
|
192
186
|
apiKey: apiKey ?? "",
|
|
193
187
|
baseURL: effectiveBaseURL,
|
|
@@ -197,6 +191,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
197
191
|
}
|
|
198
192
|
case "glama": {
|
|
199
193
|
const glamaBaseURL = effectiveBaseURL || "https://glama.ai/api/gateway/openai/v1";
|
|
194
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
200
195
|
return createOpenAI({
|
|
201
196
|
apiKey: apiKey ?? "",
|
|
202
197
|
baseURL: glamaBaseURL,
|
|
@@ -216,6 +211,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
216
211
|
if (process.env.DEXTO_CLI_VERSION) {
|
|
217
212
|
headers[DEXTO_GATEWAY_HEADERS.CLIENT_VERSION] = process.env.DEXTO_CLI_VERSION;
|
|
218
213
|
}
|
|
214
|
+
const { createOpenAICompatible } = await import("@ai-sdk/openai-compatible");
|
|
219
215
|
const provider2 = createOpenAICompatible({
|
|
220
216
|
name: "dexto-nova",
|
|
221
217
|
baseURL: dextoBaseURL,
|
|
@@ -243,12 +239,14 @@ function createVercelModel(llmConfig, context) {
|
|
|
243
239
|
const location = process.env.GOOGLE_VERTEX_LOCATION;
|
|
244
240
|
if (model.includes("claude")) {
|
|
245
241
|
const headers = supportsAnthropicInterleavedThinking(model) ? { [ANTHROPIC_BETA_HEADER]: ANTHROPIC_INTERLEAVED_THINKING_BETA } : void 0;
|
|
242
|
+
const { createVertexAnthropic } = await import("@ai-sdk/google-vertex/anthropic");
|
|
246
243
|
return createVertexAnthropic({
|
|
247
244
|
project: projectId,
|
|
248
245
|
location: location || "us-east5",
|
|
249
246
|
...headers ? { headers } : {}
|
|
250
247
|
})(model);
|
|
251
248
|
}
|
|
249
|
+
const { createVertex } = await import("@ai-sdk/google-vertex");
|
|
252
250
|
return createVertex({
|
|
253
251
|
project: projectId,
|
|
254
252
|
location: location || "us-central1"
|
|
@@ -268,6 +266,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
268
266
|
const prefix = region.startsWith("eu-") ? "eu." : "us.";
|
|
269
267
|
modelId = `${prefix}${model}`;
|
|
270
268
|
}
|
|
269
|
+
const { createAmazonBedrock } = await import("@ai-sdk/amazon-bedrock");
|
|
271
270
|
return createAmazonBedrock({ region })(modelId);
|
|
272
271
|
}
|
|
273
272
|
case "anthropic": {
|
|
@@ -275,6 +274,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
275
274
|
supportsAnthropicInterleavedThinking(model) ? { [ANTHROPIC_BETA_HEADER]: ANTHROPIC_INTERLEAVED_THINKING_BETA } : void 0,
|
|
276
275
|
runtimeHeaders
|
|
277
276
|
);
|
|
277
|
+
const { createAnthropic } = await import("@ai-sdk/anthropic");
|
|
278
278
|
return createAnthropic({
|
|
279
279
|
apiKey: apiKey ?? "",
|
|
280
280
|
...effectiveBaseURL ? { baseURL: effectiveBaseURL } : {},
|
|
@@ -282,16 +282,25 @@ function createVercelModel(llmConfig, context) {
|
|
|
282
282
|
...runtimeFetch ? { fetch: runtimeFetch } : {}
|
|
283
283
|
})(model);
|
|
284
284
|
}
|
|
285
|
-
case "google":
|
|
285
|
+
case "google": {
|
|
286
|
+
const { createGoogleGenerativeAI } = await import("@ai-sdk/google");
|
|
286
287
|
return createGoogleGenerativeAI({ apiKey: apiKey ?? "" })(model);
|
|
287
|
-
|
|
288
|
+
}
|
|
289
|
+
case "groq": {
|
|
290
|
+
const { createGroq } = await import("@ai-sdk/groq");
|
|
288
291
|
return createGroq({ apiKey: apiKey ?? "" })(model);
|
|
289
|
-
|
|
292
|
+
}
|
|
293
|
+
case "xai": {
|
|
294
|
+
const { createXai } = await import("@ai-sdk/xai");
|
|
290
295
|
return createXai({ apiKey: apiKey ?? "" })(model);
|
|
291
|
-
|
|
296
|
+
}
|
|
297
|
+
case "cohere": {
|
|
298
|
+
const { createCohere } = await import("@ai-sdk/cohere");
|
|
292
299
|
return createCohere({ apiKey: apiKey ?? "" })(model);
|
|
300
|
+
}
|
|
293
301
|
case "ollama": {
|
|
294
302
|
const ollamaBaseURL = effectiveBaseURL || "http://localhost:11434/v1";
|
|
303
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
295
304
|
return createOpenAI({
|
|
296
305
|
apiKey: apiKey ?? "ollama",
|
|
297
306
|
baseURL: ollamaBaseURL,
|
|
@@ -300,6 +309,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
300
309
|
}).chat(model);
|
|
301
310
|
}
|
|
302
311
|
case "local": {
|
|
312
|
+
const { createLocalLanguageModel } = await import("../providers/local/ai-sdk-adapter.js");
|
|
303
313
|
return createLocalLanguageModel({
|
|
304
314
|
modelId: model
|
|
305
315
|
});
|
|
@@ -308,7 +318,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
308
318
|
throw LLMError.unsupportedProvider(provider);
|
|
309
319
|
}
|
|
310
320
|
}
|
|
311
|
-
function createLLMService(config, toolManager, systemPromptManager, conversationStore, sessionEventBus, sessionId, resourceManager, logger, options, languageModelFactory) {
|
|
321
|
+
async function createLLMService(config, toolManager, systemPromptManager, conversationStore, sessionEventBus, sessionId, resourceManager, logger, options, languageModelFactory) {
|
|
312
322
|
const { usageScopeId, compactionStrategy, executionControl, steerQueue, followUpQueue } = options;
|
|
313
323
|
const providerContext = {
|
|
314
324
|
sessionId,
|
|
@@ -323,11 +333,11 @@ function createLLMService(config, toolManager, systemPromptManager, conversation
|
|
|
323
333
|
});
|
|
324
334
|
}
|
|
325
335
|
};
|
|
326
|
-
const model = languageModelFactory?.({
|
|
336
|
+
const model = await (languageModelFactory?.({
|
|
327
337
|
config,
|
|
328
338
|
context: providerContext,
|
|
329
339
|
createDefaultLanguageModel: () => createVercelModel(config, providerContext)
|
|
330
|
-
}) ?? createVercelModel(config, providerContext);
|
|
340
|
+
}) ?? createVercelModel(config, providerContext));
|
|
331
341
|
return new VercelLLMService(
|
|
332
342
|
toolManager,
|
|
333
343
|
model,
|
|
@@ -61,9 +61,9 @@ export interface LanguageModelFactoryInput {
|
|
|
61
61
|
context: DextoProviderContext;
|
|
62
62
|
}
|
|
63
63
|
export interface LanguageModelFactoryContext extends LanguageModelFactoryInput {
|
|
64
|
-
createDefaultLanguageModel: () => LanguageModel
|
|
64
|
+
createDefaultLanguageModel: () => Promise<LanguageModel>;
|
|
65
65
|
}
|
|
66
|
-
export type LanguageModelFactory = (context: LanguageModelFactoryContext) => LanguageModel
|
|
66
|
+
export type LanguageModelFactory = (context: LanguageModelFactoryContext) => Promise<LanguageModel>;
|
|
67
67
|
/**
|
|
68
68
|
* Token usage statistics from LLM
|
|
69
69
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/llm/services/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,E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,OAAO,EAAE,2BAA2B,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAEpG;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -33,11 +33,11 @@ async function generateSessionTitle(config, userText, logger, opts = {}) {
|
|
|
33
33
|
}
|
|
34
34
|
try {
|
|
35
35
|
const providerContext = opts.providerContext ?? {};
|
|
36
|
-
const model = opts.languageModelFactory?.({
|
|
36
|
+
const model = await (opts.languageModelFactory?.({
|
|
37
37
|
config,
|
|
38
38
|
context: providerContext,
|
|
39
39
|
createDefaultLanguageModel: () => (0, import_factory.createVercelModel)(config, providerContext)
|
|
40
|
-
}) ?? (0, import_factory.createVercelModel)(config, providerContext);
|
|
40
|
+
}) ?? (0, import_factory.createVercelModel)(config, providerContext));
|
|
41
41
|
const instruction = [
|
|
42
42
|
"Generate a short conversation title from the following user message.",
|
|
43
43
|
"Rules: 3\u20138 words; no surrounding punctuation, emojis, or PII; return only the title.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"title-generator.d.ts","sourceRoot":"","sources":["../../src/session/title-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAI3F,MAAM,WAAW,8BAA8B;IAC3C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CA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BAAsB,oBAAoB,CACtC,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;IACF,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACjB,GACP,OAAO,CAAC,0BAA0B,CAAC,CAkDrC;AAsBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA8BzE"}
|
|
@@ -10,11 +10,11 @@ async function generateSessionTitle(config, userText, logger, opts = {}) {
|
|
|
10
10
|
}
|
|
11
11
|
try {
|
|
12
12
|
const providerContext = opts.providerContext ?? {};
|
|
13
|
-
const model = opts.languageModelFactory?.({
|
|
13
|
+
const model = await (opts.languageModelFactory?.({
|
|
14
14
|
config,
|
|
15
15
|
context: providerContext,
|
|
16
16
|
createDefaultLanguageModel: () => createVercelModel(config, providerContext)
|
|
17
|
-
}) ?? createVercelModel(config, providerContext);
|
|
17
|
+
}) ?? createVercelModel(config, providerContext));
|
|
18
18
|
const instruction = [
|
|
19
19
|
"Generate a short conversation title from the following user message.",
|
|
20
20
|
"Rules: 3\u20138 words; no surrounding punctuation, emojis, or PII; return only the title.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/core",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"nanoid": "^5.1.6",
|
|
163
163
|
"winston": "^3.17.0",
|
|
164
164
|
"yaml": "^2.8.3",
|
|
165
|
-
"@dexto/llm": "1.9.
|
|
165
|
+
"@dexto/llm": "1.9.6"
|
|
166
166
|
},
|
|
167
167
|
"devDependencies": {
|
|
168
168
|
"@opentelemetry/context-async-hooks": "^1.28.0",
|