@primero.ai/temporal-graph-tools 1.4.0 → 1.4.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-model.d.ts","sourceRoot":"","sources":["../../../src/mastra/ai-model.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGvC,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAA;AAElG,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,mBAAmB,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;
|
|
1
|
+
{"version":3,"file":"ai-model.d.ts","sourceRoot":"","sources":["../../../src/mastra/ai-model.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGvC,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAA;AAElG,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,mBAAmB,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAqCD,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,GAAG,iBAAiB,CAAM,GAC1E,mBAAmB,CAuBrB;AAED,wBAAgB,cAAc,CAC5B,OAAO,GAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,GAAG,cAAc,CAAM,GACpE,MAAM,CAeR;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,uBAA4B,GAAG;IACzE,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,KAAK,EAAE,MAAM,CAAA;CACd,CAKA;AAED,wBAAgB,aAAa,CAAC,OAAO,GAAE,uBAA4B,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CA4B9F"}
|
|
@@ -16,11 +16,28 @@ function normalizeString(value) {
|
|
|
16
16
|
const normalized = value.trim();
|
|
17
17
|
return normalized.length > 0 ? normalized : undefined;
|
|
18
18
|
}
|
|
19
|
+
function readDagAiConfig() {
|
|
20
|
+
const raw = process.env.PRIMERO_DAG_AI_CONFIG;
|
|
21
|
+
if (!raw) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const parsed = JSON.parse(raw);
|
|
26
|
+
return {
|
|
27
|
+
provider: typeof parsed.provider === 'string' ? parsed.provider : undefined,
|
|
28
|
+
model: typeof parsed.model === 'string' ? parsed.model : undefined,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
19
35
|
export function resolveAiProvider(options = {}) {
|
|
20
|
-
var _a, _b, _c, _d;
|
|
21
|
-
const
|
|
36
|
+
var _a, _b, _c, _d, _e;
|
|
37
|
+
const dagAiConfig = readDagAiConfig();
|
|
38
|
+
const candidate = (_d = (_c = (_b = (_a = normalizeString(options.provider)) !== null && _a !== void 0 ? _a : normalizeString(dagAiConfig.provider)) !== null && _b !== void 0 ? _b : normalizeString(process.env.AI_PROVIDER)) !== null && _c !== void 0 ? _c : options.defaultProvider) !== null && _d !== void 0 ? _d : DEFAULT_PROVIDER;
|
|
22
39
|
const lowered = candidate.toLowerCase();
|
|
23
|
-
const resolved = (
|
|
40
|
+
const resolved = (_e = PROVIDER_ALIASES[lowered]) !== null && _e !== void 0 ? _e : lowered;
|
|
24
41
|
if (resolved === 'openai' ||
|
|
25
42
|
resolved === 'anthropic' ||
|
|
26
43
|
resolved === 'google' ||
|
|
@@ -32,10 +49,11 @@ export function resolveAiProvider(options = {}) {
|
|
|
32
49
|
throw new Error(`Unsupported AI provider '${candidate}'.`);
|
|
33
50
|
}
|
|
34
51
|
export function resolveAiModel(options = {}) {
|
|
35
|
-
var _a, _b;
|
|
36
|
-
const
|
|
52
|
+
var _a, _b, _c;
|
|
53
|
+
const dagAiConfig = readDagAiConfig();
|
|
54
|
+
const model = (_c = (_b = (_a = normalizeString(options.model)) !== null && _a !== void 0 ? _a : normalizeString(dagAiConfig.model)) !== null && _b !== void 0 ? _b : normalizeString(process.env.AI_MODEL)) !== null && _c !== void 0 ? _c : normalizeString(options.defaultModel);
|
|
37
55
|
if (!model) {
|
|
38
|
-
throw new Error('No AI model configured. Pass a model option or set
|
|
56
|
+
throw new Error('No AI model configured. Pass a model option, set PRIMERO_DAG_AI_CONFIG, or set AI_MODEL in the environment.');
|
|
39
57
|
}
|
|
40
58
|
return model;
|
|
41
59
|
}
|
|
@@ -65,5 +83,5 @@ export function selectAiModel(options = {}) {
|
|
|
65
83
|
if (provider === 'azure') {
|
|
66
84
|
return azure(model);
|
|
67
85
|
}
|
|
68
|
-
throw new Error(
|
|
86
|
+
throw new Error('Unsupported AI provider.');
|
|
69
87
|
}
|
package/package.json
CHANGED