@jeliq/app-sdk-llm 1.1.24 → 1.2.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/lib/commonjs/controllers/genJSON.js +2 -22
- package/lib/commonjs/controllers/genJSON.js.map +1 -1
- package/lib/commonjs/controllers/genStructuredOutputs.js +46 -0
- package/lib/commonjs/controllers/genStructuredOutputs.js.map +1 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/templates/ShouldMustTemplate.js +86 -71
- package/lib/commonjs/templates/ShouldMustTemplate.js.map +1 -1
- package/lib/commonjs/types.js +128 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/createGetLLM.js +97 -79
- package/lib/commonjs/utils/createGetLLM.js.map +1 -1
- package/lib/module/controllers/genJSON.js +2 -22
- package/lib/module/controllers/genJSON.js.map +1 -1
- package/lib/module/controllers/genStructuredOutputs.js +39 -0
- package/lib/module/controllers/genStructuredOutputs.js.map +1 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/templates/ShouldMustTemplate.js +86 -71
- package/lib/module/templates/ShouldMustTemplate.js.map +1 -1
- package/lib/module/types.js +127 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/createGetLLM.js +97 -79
- package/lib/module/utils/createGetLLM.js.map +1 -1
- package/lib/typescript/src/controllers/genJSON.d.ts.map +1 -1
- package/lib/typescript/src/controllers/genStructuredOutputs.d.ts +23 -0
- package/lib/typescript/src/controllers/genStructuredOutputs.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/templates/ShouldMustTemplate.d.ts +9 -5
- package/lib/typescript/src/templates/ShouldMustTemplate.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +53 -18
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/createGetLLM.d.ts +2 -2
- package/lib/typescript/src/utils/createGetLLM.d.ts.map +1 -1
- package/package.json +8 -8
package/lib/module/types.js
CHANGED
|
@@ -1,2 +1,128 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export const ModelNameAlias = {
|
|
2
|
+
// Claude Models
|
|
3
|
+
"claude-haiku-3": {
|
|
4
|
+
"model": "claude-3-haiku-20240307",
|
|
5
|
+
"vendor": {
|
|
6
|
+
"type": "anthropic"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"claude-haiku-3.5": {
|
|
10
|
+
"model": "claude-3-5-haiku-20241022",
|
|
11
|
+
"vendor": {
|
|
12
|
+
"type": "anthropic"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"claude-sonnet-3.7": {
|
|
16
|
+
"model": "claude-3-7-sonnet-20250219",
|
|
17
|
+
"vendor": {
|
|
18
|
+
"type": "anthropic"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"claude-sonnet-4": {
|
|
22
|
+
"model": "claude-sonnet-4-20250514",
|
|
23
|
+
"vendor": {
|
|
24
|
+
"type": "anthropic"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"claude-opus-4": {
|
|
28
|
+
"model": "claude-opus-4-20250514",
|
|
29
|
+
"vendor": {
|
|
30
|
+
"type": "anthropic"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"claude-opus-4.1": {
|
|
34
|
+
"model": "claude-opus-4-1-20250805",
|
|
35
|
+
"vendor": {
|
|
36
|
+
"type": "anthropic"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"claude-sonnet-4.5": {
|
|
40
|
+
"model": "claude-sonnet-4-5-20250929",
|
|
41
|
+
"vendor": {
|
|
42
|
+
"type": "anthropic"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"claude-haiku-4.5": {
|
|
46
|
+
"model": "claude-haiku-4-5-20251001",
|
|
47
|
+
"vendor": {
|
|
48
|
+
"type": "anthropic"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"claude-opus-4.5": {
|
|
52
|
+
"model": "claude-opus-4-5-20251101",
|
|
53
|
+
"vendor": {
|
|
54
|
+
"type": "anthropic"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
// gpt-4o
|
|
58
|
+
"gpt-4o": {
|
|
59
|
+
model: "gpt-4o",
|
|
60
|
+
vendor: {
|
|
61
|
+
type: "openai"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"gpt-4o-mini": {
|
|
65
|
+
model: "gpt-4o-mini",
|
|
66
|
+
vendor: {
|
|
67
|
+
type: "openai"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
// gpt-5.1
|
|
71
|
+
"gpt-5.1-chat": {
|
|
72
|
+
model: "gpt-5.1-chat-latest",
|
|
73
|
+
vendor: {
|
|
74
|
+
type: "openai"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"gpt-5.1": {
|
|
78
|
+
model: "gpt-5.1",
|
|
79
|
+
vendor: {
|
|
80
|
+
type: "openai"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
// gpt-5.2
|
|
84
|
+
"gpt-5.2": {
|
|
85
|
+
model: "gpt-5.2",
|
|
86
|
+
vendor: {
|
|
87
|
+
type: "openai"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"gpt-5.2-chat": {
|
|
91
|
+
model: "gpt-5.2-chat-latest",
|
|
92
|
+
vendor: {
|
|
93
|
+
type: "openai"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
// Gemini Models
|
|
97
|
+
"gemini-3-pro": {
|
|
98
|
+
model: "gemini-3-pro-preview",
|
|
99
|
+
vendor: {
|
|
100
|
+
type: "google"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"gemini-3-flash": {
|
|
104
|
+
model: "gemini-3-flash-preview",
|
|
105
|
+
vendor: {
|
|
106
|
+
type: "google"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"gemini-2.5-flash": {
|
|
110
|
+
model: "gemini-2.5-flash",
|
|
111
|
+
vendor: {
|
|
112
|
+
type: "google"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"gemini-2.5-flash-lite": {
|
|
116
|
+
model: "gemini-2.5-flash-lite",
|
|
117
|
+
vendor: {
|
|
118
|
+
type: "google"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"gemini-2.5-pro": {
|
|
122
|
+
model: "gemini-2.5-pro",
|
|
123
|
+
vendor: {
|
|
124
|
+
type: "google"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
2
128
|
//# sourceMappingURL=types.js.map
|
package/lib/module/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["ModelNameAlias","model","vendor","type"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"AA4DA,OAAO,MAAMA,cAA0D,GAAG;EACtE;EACA,gBAAgB,EAAE;IACd,OAAO,EAAE,yBAAyB;IAClC,QAAQ,EAAE;MAAE,MAAM,EAAE;IAAY;EACpC,CAAC;EACD,kBAAkB,EAAE;IAChB,OAAO,EAAE,2BAA2B;IACpC,QAAQ,EAAE;MAAE,MAAM,EAAE;IAAY;EACpC,CAAC;EACD,mBAAmB,EAAE;IACjB,OAAO,EAAE,4BAA4B;IACrC,QAAQ,EAAE;MAAE,MAAM,EAAE;IAAY;EACpC,CAAC;EACD,iBAAiB,EAAE;IACf,OAAO,EAAE,0BAA0B;IACnC,QAAQ,EAAE;MAAE,MAAM,EAAE;IAAY;EACpC,CAAC;EACD,eAAe,EAAE;IACb,OAAO,EAAE,wBAAwB;IACjC,QAAQ,EAAE;MAAE,MAAM,EAAE;IAAY;EACpC,CAAC;EACD,iBAAiB,EAAE;IACf,OAAO,EA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E,kBAAkB;IACzBC,MAAM,EAAE;MAAEC,IAAI,EAAE;IAAS;EAC7B,CAAC;EACD,uBAAuB,EAAE;IACrBF,KAAK,EAAE,uBAAuB;IAC9BC,MAAM,EAAE;MAAEC,IAAI,EAAE;IAAS;EAC7B,CAAC;EACD,gBAAgB,EAAE;IACdF,KAAK,EAAE,gBAAgB;IACvBC,MAAM,EAAE;MAAEC,IAAI,EAAE;IAAS;EAC7B;AACJ,CAAU","ignoreList":[]}
|
|
@@ -1,93 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { wrapLanguageModel } from "ai";
|
|
2
|
+
import { openai } from "@ai-sdk/openai";
|
|
3
|
+
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
4
|
+
import { anthropic, createAnthropic } from "@ai-sdk/anthropic";
|
|
5
|
+
import { google, createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
6
|
+
import { azure, createAzure } from "@ai-sdk/azure";
|
|
7
|
+
function createProviderModel(vendor, modelName) {
|
|
8
|
+
if (process.env.JELIQ_LLM_REVPROXY_KEY && process.env.JELIQ_LLM_REVPROXY_ENDPOINT) {
|
|
9
|
+
const provider = createOpenAICompatible({
|
|
10
|
+
name: "jeliq-llm-revproxy",
|
|
11
|
+
apiKey: process.env.JELIQ_LLM_REVPROXY_KEY,
|
|
12
|
+
baseURL: process.env.JELIQ_LLM_REVPROXY_ENDPOINT
|
|
13
|
+
});
|
|
14
|
+
return provider(modelName);
|
|
15
|
+
}
|
|
16
|
+
if (vendor.type === "anthropic") {
|
|
17
|
+
const provider = vendor.apiKey || vendor.endpoint ? createAnthropic({
|
|
18
|
+
apiKey: vendor.apiKey,
|
|
19
|
+
...(vendor.endpoint ? {
|
|
20
|
+
baseURL: vendor.endpoint
|
|
21
|
+
} : {})
|
|
22
|
+
}) : anthropic;
|
|
23
|
+
return provider(modelName);
|
|
24
|
+
}
|
|
25
|
+
if (vendor.type === "google") {
|
|
26
|
+
const provider = vendor.apiKey || vendor.endpoint ? createGoogleGenerativeAI({
|
|
27
|
+
apiKey: vendor.apiKey,
|
|
28
|
+
...(vendor.endpoint ? {
|
|
29
|
+
baseURL: vendor.endpoint
|
|
30
|
+
} : {})
|
|
31
|
+
}) : google;
|
|
32
|
+
return provider(modelName);
|
|
33
|
+
}
|
|
34
|
+
if (vendor.type === "azure") {
|
|
35
|
+
const provider = vendor.apiKey || vendor.instanceName ? createAzure({
|
|
36
|
+
apiKey: vendor.apiKey,
|
|
37
|
+
...(vendor.instanceName ? {
|
|
38
|
+
resourceName: vendor.instanceName
|
|
39
|
+
} : {}),
|
|
40
|
+
apiVersion: vendor.apiVersion,
|
|
41
|
+
useDeploymentBasedUrls: true
|
|
42
|
+
}) : azure;
|
|
43
|
+
return provider(vendor.deploymentName || modelName);
|
|
44
|
+
}
|
|
45
|
+
return openai(modelName);
|
|
46
|
+
}
|
|
4
47
|
export default function createGetLLM(tasksModelsMap, defaultModel) {
|
|
5
48
|
function getModelAndTemperature(taskName) {
|
|
6
49
|
const model = taskName in tasksModelsMap ? tasksModelsMap[taskName] : defaultModel;
|
|
7
50
|
if (!model) {
|
|
8
51
|
throw new Error(`Model not found for task ${taskName}`);
|
|
9
52
|
}
|
|
10
|
-
|
|
53
|
+
const reasoningEffort = "reasoningEffort" in model ? model.reasoningEffort : undefined;
|
|
54
|
+
const verbosityLevel = "verbosityLevel" in model ? model.verbosityLevel : undefined;
|
|
55
|
+
return [model.model, model.vendor, model.temperature, reasoningEffort, verbosityLevel, model.timeout];
|
|
11
56
|
}
|
|
12
|
-
const getLLM = (taskName,
|
|
13
|
-
const [modelName, vendor, temperature, reasoningEffort, timeout] = getModelAndTemperature(taskName);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (content.type === "text") {
|
|
21
|
-
return content.text;
|
|
22
|
-
} else {
|
|
23
|
-
argsImageURLs.push(content.image_url);
|
|
24
|
-
return `\n[AttachedImage(${content.type}):${imageNum++}]`;
|
|
25
|
-
}
|
|
26
|
-
}).join("\n\n");
|
|
27
|
-
}).join("\n\n");
|
|
28
|
-
}
|
|
29
|
-
const thinkingModel = modelName === "o1-mini" || modelName === "o1-preview" || modelName === "o1" || modelName === "o3-mini";
|
|
30
|
-
let inputPrompts = [];
|
|
31
|
-
const llmConfig = {
|
|
32
|
-
timeout: (options === null || options === void 0 ? void 0 : options.timeout) || timeout || (thinkingModel ? 60 * 3 * 1000 : undefined),
|
|
33
|
-
modelName,
|
|
34
|
-
temperature: (options === null || options === void 0 ? void 0 : options.temperature) || temperature || 0.5,
|
|
35
|
-
reasoningEffort: thinkingModel ? (options === null || options === void 0 ? void 0 : options.reasoningEffort) || reasoningEffort || "low" : undefined,
|
|
36
|
-
callbacks: [{
|
|
37
|
-
handleLLMStart: async (llm, prompts) => {
|
|
38
|
-
inputPrompts = prompts;
|
|
39
|
-
},
|
|
40
|
-
handleLLMEnd: async output => {
|
|
41
|
-
var _output$llmOutput, _output$llmOutput2, _output$llmOutput3, _output$llmOutput4, _output$llmOutput5, _output$llmOutput6;
|
|
42
|
-
const promptTokens = (output === null || output === void 0 || (_output$llmOutput = output.llmOutput) === null || _output$llmOutput === void 0 || (_output$llmOutput = _output$llmOutput.usage_metadata) === null || _output$llmOutput === void 0 ? void 0 : _output$llmOutput.prompt_token_count) || (output === null || output === void 0 || (_output$llmOutput2 = output.llmOutput) === null || _output$llmOutput2 === void 0 || (_output$llmOutput2 = _output$llmOutput2.usage) === null || _output$llmOutput2 === void 0 ? void 0 : _output$llmOutput2.input_tokens) || (output === null || output === void 0 || (_output$llmOutput3 = output.llmOutput) === null || _output$llmOutput3 === void 0 || (_output$llmOutput3 = _output$llmOutput3.tokenUsage) === null || _output$llmOutput3 === void 0 ? void 0 : _output$llmOutput3.promptTokens) || 0;
|
|
43
|
-
const completionTokens = (output === null || output === void 0 || (_output$llmOutput4 = output.llmOutput) === null || _output$llmOutput4 === void 0 || (_output$llmOutput4 = _output$llmOutput4.usage_metadata) === null || _output$llmOutput4 === void 0 ? void 0 : _output$llmOutput4.candidates_token_count) || (output === null || output === void 0 || (_output$llmOutput5 = output.llmOutput) === null || _output$llmOutput5 === void 0 || (_output$llmOutput5 = _output$llmOutput5.usage) === null || _output$llmOutput5 === void 0 ? void 0 : _output$llmOutput5.output_tokens) || (output === null || output === void 0 || (_output$llmOutput6 = output.llmOutput) === null || _output$llmOutput6 === void 0 || (_output$llmOutput6 = _output$llmOutput6.tokenUsage) === null || _output$llmOutput6 === void 0 ? void 0 : _output$llmOutput6.completionTokens) || 0;
|
|
44
|
-
inputPrompts = [];
|
|
45
|
-
},
|
|
46
|
-
handleLLMError: error => {}
|
|
47
|
-
}]
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// Anthropic models
|
|
51
|
-
if (vendor.type === "anthropic") {
|
|
52
|
-
return new ChatAnthropic({
|
|
53
|
-
...llmConfig,
|
|
54
|
-
maxTokens: vendor.maxTokens || 7000,
|
|
55
|
-
invocationKwargs: {
|
|
56
|
-
top_p: undefined
|
|
57
|
-
}
|
|
58
|
-
});
|
|
57
|
+
const getLLM = (taskName, options, _loggingInfo) => {
|
|
58
|
+
const [modelName, vendor, temperature, reasoningEffort, verbosityLevel, timeout] = getModelAndTemperature(taskName);
|
|
59
|
+
let resolvedVendor = vendor;
|
|
60
|
+
if (vendor.type !== "openai" && vendor.type !== "anthropic" && vendor.type !== "google" && vendor.type !== "azure") {
|
|
61
|
+
resolvedVendor = {
|
|
62
|
+
...vendor,
|
|
63
|
+
type: "openai"
|
|
64
|
+
};
|
|
59
65
|
}
|
|
66
|
+
const actualModelName = (options === null || options === void 0 ? void 0 : options.model) || modelName;
|
|
67
|
+
const actualTemperature = (options === null || options === void 0 ? void 0 : options.temperature) !== undefined ? options.temperature : temperature;
|
|
68
|
+
const actualReasoningEffort = (options === null || options === void 0 ? void 0 : options.reasoningEffort) !== undefined ? options.reasoningEffort : reasoningEffort;
|
|
69
|
+
const actualVerbosityLevel = (options === null || options === void 0 ? void 0 : options.verbosityLevel) !== undefined ? options.verbosityLevel : verbosityLevel;
|
|
70
|
+
const actualTimeout = (options === null || options === void 0 ? void 0 : options.timeout) !== undefined ? options.timeout : timeout !== undefined ? timeout : undefined;
|
|
71
|
+
const model = createProviderModel(resolvedVendor, actualModelName);
|
|
60
72
|
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
68
|
-
|
|
73
|
+
// 直前に CallOptions を変形するミドルウェア
|
|
74
|
+
const mutateCallOptionsMiddleware = {
|
|
75
|
+
specificationVersion: "v3",
|
|
76
|
+
async transformParams({
|
|
77
|
+
type,
|
|
78
|
+
params
|
|
79
|
+
}) {
|
|
80
|
+
var _next$providerOptions;
|
|
81
|
+
const next = {
|
|
82
|
+
...params
|
|
83
|
+
};
|
|
69
84
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
azureOpenAIApiDeploymentName: (vendor === null || vendor === void 0 ? void 0 : vendor.deploymentName) || modelName,
|
|
76
|
-
openAIBasePath: vendor.endpoint,
|
|
77
|
-
openAIApiKey: vendor.apiKey,
|
|
78
|
-
openAIApiVersion: vendor.apiVersion,
|
|
79
|
-
temperature: llmConfig.temperature,
|
|
80
|
-
modelName: modelName,
|
|
81
|
-
callbacks: llmConfig.callbacks,
|
|
82
|
-
reasoning: {
|
|
83
|
-
effort: llmConfig.reasoningEffort
|
|
84
|
-
},
|
|
85
|
-
azureOpenAIApiInstanceName: vendor.instanceName
|
|
86
|
-
});
|
|
87
|
-
}
|
|
85
|
+
/*
|
|
86
|
+
if (type === "stream") {
|
|
87
|
+
next.maxOutputTokens = next.maxOutputTokens ?? 800;
|
|
88
|
+
}
|
|
89
|
+
*/
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
if (typeof next.temperature === "number" || typeof actualTemperature === "number") {
|
|
92
|
+
next.temperature = Math.min(2, Math.max(0, next.temperature || actualTemperature || 0));
|
|
93
|
+
}
|
|
94
|
+
next.providerOptions = {
|
|
95
|
+
...(next.providerOptions ?? {}),
|
|
96
|
+
openai: {
|
|
97
|
+
...(((_next$providerOptions = next.providerOptions) === null || _next$providerOptions === void 0 ? void 0 : _next$providerOptions.openai) ?? {}),
|
|
98
|
+
reasoningEffort: actualReasoningEffort,
|
|
99
|
+
textVerbosity: actualVerbosityLevel
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return next;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return wrapLanguageModel({
|
|
106
|
+
model: model,
|
|
107
|
+
middleware: mutateCallOptionsMiddleware
|
|
108
|
+
});
|
|
91
109
|
};
|
|
92
110
|
return getLLM;
|
|
93
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["wrapLanguageModel","openai","createOpenAICompatible","anthropic","createAnthropic","google","createGoogleGenerativeAI","azure","createAzure","createProviderModel","vendor","modelName","process","env","JELIQ_LLM_REVPROXY_KEY","JELIQ_LLM_REVPROXY_ENDPOINT","provider","name","apiKey","baseURL","type","endpoint","instanceName","resourceName","apiVersion","useDeploymentBasedUrls","deploymentName","createGetLLM","tasksModelsMap","defaultModel","getModelAndTemperature","taskName","model","Error","reasoningEffort","undefined","verbosityLevel","temperature","timeout","getLLM","options","_loggingInfo","resolvedVendor","actualModelName","actualTemperature","actualReasoningEffort","actualVerbosityLevel","actualTimeout","mutateCallOptionsMiddleware","specificationVersion","transformParams","params","_next$providerOptions","next","Math","min","max","providerOptions","textVerbosity","middleware"],"sourceRoot":"../../../src","sources":["utils/createGetLLM.ts"],"mappings":"AAAA,SACIA,iBAAiB,QAEd,IAAI;AAGX,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,sBAAsB,QAAQ,2BAA2B;AAClE,SAASC,SAAS,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AAE;QAAA,IAAAC,qBAAA;QACnE,MAAMC,IAAI,GAAG;UAAE,GAAGF;QAAO,CAAC;;QAE1B;AAChB;AACA;AACA;AACA;;QAEgB,IAAI,OAAOE,IAAI,CAAChB,WAAW,KAAK,QAAQ,IAAI,OAAOO,iBAAiB,KAAK,QAAQ,EAAE;UAC/ES,IAAI,CAAChB,WAAW,GAAGiB,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,GAAG,CAAC,CAAC,EAAEH,IAAI,CAAChB,WAAW,IAAIO,iBAAiB,IAAI,CAAC,CAAC,CAAC;QAC3F;QAEAS,IAAI,CAACI,eAAe,GAAG;UACnB,IAAIJ,IAAI,CAACI,eAAe,IAAI,CAAC,CAAC,CAAC;UAC/BxD,MAAM,EAAE;YACJ,IAAI,EAAAmD,qBAAA,GAACC,IAAI,CAACI,eAAe,cAAAL,qBAAA,uBAArBA,qBAAA,CAA+BnD,MAAM,KAAI,CAAC,CAAC,CAAC;YAChDiC,eAAe,EAAEW,qBAAqB;YACtCa,aAAa,EAAEZ;UACnB;QACJ,CAAC;QAED,OAAOO,IAAI;MACf;IACJ,CAAC;IAED,OAAOrD,iBAAiB,CAAC;MACrBgC,KAAK,EAAEA,KAAY;MACnB2B,UAAU,EAAEX;IAChB,CAAC,CAAC;EACN,CAAC;EAED,OAAOT,MAAM;AACjB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genJSON.d.ts","sourceRoot":"","sources":["../../../../src/controllers/genJSON.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"genJSON.d.ts","sourceRoot":"","sources":["../../../../src/controllers/genJSON.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAKhC,wBAA8B,OAAO,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,MAAM,EACpF,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,EAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE;IACN,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;CACnF,EACD,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EAClD,OAAO,CAAC,EAAE;IACN,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,GACF,OAAO,CAAC,MAAM,CAAC,CAOjB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BackendContext } from "@jeliq/app-sdk-core";
|
|
2
|
+
import { ZodSchema } from "zod";
|
|
3
|
+
import { InputDefObj, PromptElement } from "../types";
|
|
4
|
+
type StructuredTemplate<InputKeys extends string | number | symbol, Output> = {
|
|
5
|
+
type: "ShouldMust";
|
|
6
|
+
inputDef: InputDefObj<InputKeys>;
|
|
7
|
+
summary: string;
|
|
8
|
+
outputSchema: ZodSchema<Output>;
|
|
9
|
+
shouldSection?: PromptElement[];
|
|
10
|
+
mustSection?: PromptElement[];
|
|
11
|
+
example?: PromptElement[];
|
|
12
|
+
partialVars?: Record<string, string | (() => Promise<string> | (() => string))>;
|
|
13
|
+
};
|
|
14
|
+
export type GenStructuredOutputsOptions = {
|
|
15
|
+
model?: string;
|
|
16
|
+
temperature?: number;
|
|
17
|
+
reasoningEffort?: "low" | "medium" | "high";
|
|
18
|
+
timeout?: number;
|
|
19
|
+
maxRetries?: number;
|
|
20
|
+
};
|
|
21
|
+
export default function genStructuredOutputs<InputKeys extends string | number | symbol, Output>(context: BackendContext<any>, taskName: string, template: StructuredTemplate<InputKeys, Output>, args: Record<InputKeys, string | undefined | null>, options?: GenStructuredOutputsOptions): Promise<Output>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=genStructuredOutputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genStructuredOutputs.d.ts","sourceRoot":"","sources":["../../../../src/controllers/genStructuredOutputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEtD,KAAK,kBAAkB,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,MAAM,IAAI;IAC1E,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;CACnF,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAA8B,oBAAoB,CAC9C,SAAS,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAC1C,MAAM,EAEN,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,EAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,EAC/C,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EAClD,OAAO,CAAC,EAAE,2BAA2B,GACtC,OAAO,CAAC,MAAM,CAAC,CAsDjB"}
|
|
@@ -2,5 +2,6 @@ export type { GetLLM, LLM_VENDOR, SystemPrompt, SystemPromptWithTemplateInfo, In
|
|
|
2
2
|
import createShouldMustTemplate from "./templates/ShouldMustTemplate";
|
|
3
3
|
import createGetLLM from "./utils/createGetLLM";
|
|
4
4
|
import genJSON from "./controllers/genJSON";
|
|
5
|
-
|
|
5
|
+
import genStructuredOutputs from "./controllers/genStructuredOutputs";
|
|
6
|
+
export { genJSON, genStructuredOutputs, createShouldMustTemplate, createGetLLM, };
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,MAAM,EACN,UAAU,EACV,YAAY,EACZ,4BAA4B,EAC5B,WAAW,IAAI,QAAQ,EACvB,aAAa,EACb,gBAAgB,GACnB,MAAM,SAAS,CAAC;AAEjB,OAAO,wBAAwB,MAAM,gCAAgC,CAAC;AACtE,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,OAAO,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,MAAM,EACN,UAAU,EACV,YAAY,EACZ,4BAA4B,EAC5B,WAAW,IAAI,QAAQ,EACvB,aAAa,EACb,gBAAgB,GACnB,MAAM,SAAS,CAAC;AAEjB,OAAO,wBAAwB,MAAM,gCAAgC,CAAC;AACtE,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,oBAAoB,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EACH,OAAO,EACP,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,GACf,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { SystemModelMessage, UserModelMessage } from "ai";
|
|
2
|
+
import { InputDef, PromptElement } from "../types";
|
|
3
|
+
type TemplateArgs = Record<string, string | undefined | null>;
|
|
4
|
+
type ModelMessages = Array<SystemModelMessage | UserModelMessage>;
|
|
5
|
+
type ShouldMustPromptTemplate = {
|
|
6
|
+
formatMessages: (args: TemplateArgs) => Promise<ModelMessages>;
|
|
7
|
+
};
|
|
8
|
+
export default function createShouldMustTemplate(inputDef: InputDef[], summary: string, shouldSection?: PromptElement[], mustSection?: PromptElement[], example?: PromptElement[], partialVars?: Record<string, string | (() => Promise<string> | (() => string))>): Promise<ShouldMustPromptTemplate>;
|
|
9
|
+
export {};
|
|
6
10
|
//# sourceMappingURL=ShouldMustTemplate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShouldMustTemplate.d.ts","sourceRoot":"","sources":["../../../../src/templates/ShouldMustTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ShouldMustTemplate.d.ts","sourceRoot":"","sources":["../../../../src/templates/ShouldMustTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,kBAAkB,EAAY,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEnD,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;AAE9D,KAAK,aAAa,GAAG,KAAK,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,CAAC;AAElE,KAAK,wBAAwB,GAAG;IAC5B,cAAc,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CAClE,CAAC;AA0CF,wBAA8B,wBAAwB,CAClD,QAAQ,EAAE,QAAQ,EAAE,EACpB,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,aAAa,EAAE,EAC/B,WAAW,CAAC,EAAE,aAAa,EAAE,EAC7B,OAAO,CAAC,EAAE,aAAa,EAAE,EACzB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,GAChF,OAAO,CAAC,wBAAwB,CAAC,CAiJnC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ChatAnthropic } from "@langchain/anthropic";
|
|
3
|
-
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
|
|
4
|
-
import { BaseMessage } from "@langchain/core/messages";
|
|
1
|
+
import type { LanguageModel } from "ai";
|
|
5
2
|
export declare type AttachedFileData = {
|
|
6
3
|
url: string;
|
|
7
4
|
data: string;
|
|
@@ -35,31 +32,69 @@ export type SystemPromptWithTemplateInfo = SystemPrompt & {
|
|
|
35
32
|
frameworkBranchName: string | null;
|
|
36
33
|
abTest?: boolean;
|
|
37
34
|
};
|
|
38
|
-
|
|
39
|
-
type: "openai" | "anthropic" | "google"
|
|
35
|
+
type BaseLLMVendor = {
|
|
36
|
+
type: "openai" | "anthropic" | "google";
|
|
40
37
|
maxTokens?: number;
|
|
41
38
|
endpoint?: string;
|
|
42
39
|
apiKey?: string;
|
|
43
|
-
apiVersion?: string;
|
|
44
|
-
deploymentName?: string;
|
|
45
|
-
instanceName?: string;
|
|
46
40
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
type AzureLLMVendor = {
|
|
42
|
+
type: "azure";
|
|
43
|
+
maxTokens?: number;
|
|
44
|
+
endpoint?: string;
|
|
45
|
+
apiKey?: string;
|
|
46
|
+
apiVersion: string;
|
|
47
|
+
deploymentName: string;
|
|
48
|
+
instanceName: string;
|
|
53
49
|
};
|
|
54
|
-
export type
|
|
50
|
+
export type LLM_VENDOR = BaseLLMVendor | AzureLLMVendor;
|
|
51
|
+
export type LLM_ALIAS = "claude-haiku-3" | "claude-haiku-3.5" | "claude-sonnet-3.7" | "claude-sonnet-4" | "claude-opus-4" | "claude-opus-4.1" | "claude-sonnet-4.5" | "claude-haiku-4.5" | "claude-opus-4.5" | "gpt-4o" | "gpt-4o-mini" | "gpt-5.1-chat" | "gpt-5.1" | "gpt-5.2" | "gpt-5.2-chat" | "gemini-3-pro" | "gemini-3-flash" | "gemini-2.5-flash" | "gemini-2.5-flash-lite" | "gemini-2.5-pro";
|
|
52
|
+
export declare const ModelNameAlias: {
|
|
53
|
+
[key in LLM_ALIAS]: LLM_CONFIG<string>;
|
|
54
|
+
};
|
|
55
|
+
export type MODEL_NAME_ALIAS = keyof typeof ModelNameAlias | string;
|
|
56
|
+
export type REASONING_EFFORT = "none" | "low" | "medium" | "high";
|
|
57
|
+
export type VERBOSITY_LEVEL = "low" | "medium" | "high";
|
|
58
|
+
type LLM_CONFIG_MODEL<M extends MODEL_NAME_ALIAS> = {
|
|
59
|
+
model: "gpt-5.1" | "gpt-5.1-chat";
|
|
60
|
+
temperature?: number;
|
|
61
|
+
reasoningEffort?: "none";
|
|
62
|
+
verbosityLevel?: VERBOSITY_LEVEL;
|
|
63
|
+
} | {
|
|
64
|
+
model: "gpt-5.1" | "gpt-5.1-chat";
|
|
55
65
|
temperature?: number;
|
|
56
|
-
reasoningEffort?:
|
|
66
|
+
reasoningEffort?: Omit<REASONING_EFFORT, "none">;
|
|
67
|
+
verbosityLevel?: VERBOSITY_LEVEL;
|
|
68
|
+
} | {
|
|
69
|
+
model: "gpt-5.2" | "gpt-5.2-chat";
|
|
70
|
+
temperature?: number;
|
|
71
|
+
reasoningEffort?: "none";
|
|
72
|
+
verbosityLevel?: VERBOSITY_LEVEL;
|
|
73
|
+
} | {
|
|
74
|
+
model: "gpt-5.2" | "gpt-5.2-chat";
|
|
75
|
+
temperature?: number;
|
|
76
|
+
reasoningEffort?: Omit<REASONING_EFFORT, "none"> | "xhigh";
|
|
77
|
+
verbosityLevel?: VERBOSITY_LEVEL;
|
|
78
|
+
} | {
|
|
79
|
+
model: Omit<M, "gpt-5.1" | "gpt-5.1-chat" | "gpt-5.2" | "gpt-5.2-chat">;
|
|
80
|
+
temperature?: number;
|
|
81
|
+
};
|
|
82
|
+
export type LLM_CONFIG<M extends MODEL_NAME_ALIAS> = {
|
|
83
|
+
vendor: LLM_VENDOR;
|
|
84
|
+
timeout?: number;
|
|
85
|
+
} & LLM_CONFIG_MODEL<M>;
|
|
86
|
+
export type GetLLM<TASK_NAME extends string> = (taskName: TASK_NAME | string, options?: {
|
|
87
|
+
model?: LLM_ALIAS | string;
|
|
57
88
|
timeout?: number;
|
|
58
|
-
|
|
89
|
+
temperature?: number;
|
|
90
|
+
reasoningEffort?: REASONING_EFFORT;
|
|
91
|
+
verbosityLevel?: VERBOSITY_LEVEL;
|
|
92
|
+
}, loggingInfo?: any) => LanguageModel;
|
|
59
93
|
export type InputDefObj<InputKeys extends string | number | symbol> = {
|
|
60
94
|
[name in InputKeys]: {
|
|
61
95
|
type: InputDef["type"];
|
|
62
96
|
description: InputDef["description"];
|
|
63
97
|
};
|
|
64
98
|
};
|
|
99
|
+
export {};
|
|
65
100
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAExC,MAAM,CAAC,OAAO,MAAM,gBAAgB,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,aAAa,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,QAAQ,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,QAAQ,GAAG,cAAc,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACN,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;QAChC,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;QAC9B,OAA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AAC,CAAC,CAAC;AAExB,MAAM,MAAM,MAAM,CAAC,SAAS,SAAS,MAAM,IAAI,CAC3C,QAAQ,EAAE,SAAS,GAAG,MAAM,EAC5B,OAAO,CAAC,EAAE;IACN,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,gBAAgB,CAAC;IACnC,cAAc,CAAC,EAAE,eAAe,CAAC;CACpC,EACD,WAAW,CAAC,EAAE,GAAG,KAChB,aAAa,CAAC;AAEnB,MAAM,MAAM,WAAW,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI;KACjE,IAAI,IAAI,SAAS,GAAG;QACjB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvB,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;KACxC;CACJ,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GetLLM, LLM_CONFIG } from "../types";
|
|
2
|
-
export default function createGetLLM<TASK_NAME extends string, LLM_MODEL extends
|
|
1
|
+
import { GetLLM, LLM_CONFIG, MODEL_NAME_ALIAS } from "../types";
|
|
2
|
+
export default function createGetLLM<TASK_NAME extends string, LLM_MODEL extends MODEL_NAME_ALIAS>(tasksModelsMap: Record<TASK_NAME, LLM_CONFIG<LLM_MODEL>>, defaultModel: LLM_CONFIG<LLM_MODEL>): GetLLM<TASK_NAME>;
|
|
3
3
|
//# sourceMappingURL=createGetLLM.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGetLLM.d.ts","sourceRoot":"","sources":["../../../../src/utils/createGetLLM.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createGetLLM.d.ts","sourceRoot":"","sources":["../../../../src/utils/createGetLLM.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,MAAM,EAAE,UAAU,EAAqC,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAqD/G,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,gBAAgB,EAC7F,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,EACxD,YAAY,EAAE,UAAU,CAAC,SAAS,CAAC,GACpC,MAAM,CAAC,SAAS,CAAC,CAmGnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeliq/app-sdk-llm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"homepage": "https://jeliq.ai/",
|
|
5
5
|
"author": "Jeliq.ai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"@
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
"langchain": "^0.3.27",
|
|
20
|
+
"@ai-sdk/anthropic": "^3.0.6",
|
|
21
|
+
"@ai-sdk/azure": "^3.0.4",
|
|
22
|
+
"@ai-sdk/google": "^3.0.3",
|
|
23
|
+
"@ai-sdk/openai": "^3.0.4",
|
|
24
|
+
"@ai-sdk/openai-compatible": "^2.0.4",
|
|
25
|
+
"ai": "^6.0.11",
|
|
27
26
|
"lodash": "^4.17.21",
|
|
28
27
|
"ts-node": "^10.9.2"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@types/jest": "^30.0.0",
|
|
32
31
|
"@types/lodash": "^4.17.21",
|
|
32
|
+
"@types/node": "^22.19.3",
|
|
33
33
|
"dotenv": "^17.2.3",
|
|
34
34
|
"husky": "^8.0.3",
|
|
35
35
|
"jest": "^30.2.0",
|