@jeliq/app-sdk-llm 1.1.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.
- package/README.md +30 -0
- package/lib/commonjs/controllers/genJSON.js +50 -0
- package/lib/commonjs/controllers/genJSON.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/templates/ShouldMustTemplate.js +75 -0
- package/lib/commonjs/templates/ShouldMustTemplate.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/createGetLLM.js +97 -0
- package/lib/commonjs/utils/createGetLLM.js.map +1 -0
- package/lib/module/controllers/genJSON.js +43 -0
- package/lib/module/controllers/genJSON.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/templates/ShouldMustTemplate.js +69 -0
- package/lib/module/templates/ShouldMustTemplate.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/createGetLLM.js +91 -0
- package/lib/module/utils/createGetLLM.js.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/src/controllers/genJSON.d.ts +14 -0
- package/lib/typescript/src/controllers/genJSON.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/templates/ShouldMustTemplate.d.ts +6 -0
- package/lib/typescript/src/templates/ShouldMustTemplate.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +58 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/createGetLLM.d.ts +9 -0
- package/lib/typescript/src/utils/createGetLLM.d.ts.map +1 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Jeliq App SDK Next.js Router
|
|
2
|
+
|
|
3
|
+
This package is designed for using Next.js in applications generated with Jeliq.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
$ pnpm add @jeliq/app-sdk-next-router
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Package Structure
|
|
12
|
+
This package exports the following components and utilities:
|
|
13
|
+
|
|
14
|
+
### Providers / Hooks / Components (`src/*`)
|
|
15
|
+
|
|
16
|
+
- **NavigationProvider**: A provider component that manages the navigation state across the application.
|
|
17
|
+
- **useNavigation / useRouter**: React hooks that provide the current navigation state and navigation functions.
|
|
18
|
+
- **Link**: A link component that wraps Next.js's link component, adapted to work with Jeliq's routing configuration.
|
|
19
|
+
|
|
20
|
+
### Scripts (`bin/*`)
|
|
21
|
+
|
|
22
|
+
- **gen-app-router**: Generate Next.js app router code from Jeliq routing configuration.
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
MIT
|
|
27
|
+
|
|
28
|
+
## Related Links
|
|
29
|
+
|
|
30
|
+
- [Jeliq Official Website](https://jeliq.ai/)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = genJSON;
|
|
7
|
+
var _chains = require("langchain/chains");
|
|
8
|
+
var _output_parsers = require("langchain/output_parsers");
|
|
9
|
+
var _ShouldMustTemplate = _interopRequireDefault(require("../templates/ShouldMustTemplate"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
async function genJSON(context, taskName, template, args) {
|
|
12
|
+
if (!(context !== null && context !== void 0 && context.getLLM)) {
|
|
13
|
+
throw new Error("getLLM is not set");
|
|
14
|
+
}
|
|
15
|
+
const outputParser = _output_parsers.StructuredOutputParser.fromZodSchema(template.outputSchema);
|
|
16
|
+
const promptTemplate = await (0, _ShouldMustTemplate.default)(Object.keys(template.inputDef).map(key => ({
|
|
17
|
+
name: key,
|
|
18
|
+
type: template.inputDef[key].type,
|
|
19
|
+
description: template.inputDef[key].description
|
|
20
|
+
})), outputParser, template.summary, template.shouldSection, template.mustSection, template.example, template.partialVars);
|
|
21
|
+
const parser = outputParser;
|
|
22
|
+
if (!parser) {
|
|
23
|
+
throw new Error("outputParser is not set");
|
|
24
|
+
}
|
|
25
|
+
const llm = context.getLLM(taskName, await promptTemplate.format(args));
|
|
26
|
+
const chain = new _chains.LLMChain({
|
|
27
|
+
llm,
|
|
28
|
+
prompt: promptTemplate
|
|
29
|
+
});
|
|
30
|
+
const response = await chain.call(args);
|
|
31
|
+
try {
|
|
32
|
+
return await parser.parse(response.text);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
let count = 0;
|
|
35
|
+
async function doFix() {
|
|
36
|
+
count++;
|
|
37
|
+
try {
|
|
38
|
+
const llmFixingParser = context.getLLM(taskName, await promptTemplate.format(args), args);
|
|
39
|
+
const fixParser = _output_parsers.OutputFixingParser.fromLLM(llmFixingParser, parser);
|
|
40
|
+
const fixed = await fixParser.parse(response.text);
|
|
41
|
+
return fixed;
|
|
42
|
+
} catch (e) {
|
|
43
|
+
if (count > 5) throw e;
|
|
44
|
+
return await doFix();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return await doFix();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=genJSON.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chains","require","_output_parsers","_ShouldMustTemplate","_interopRequireDefault","e","__esModule","default","genJSON","context","taskName","template","args","getLLM","Error","outputParser","StructuredOutputParser","fromZodSchema","outputSchema","promptTemplate","createShouldMustTemplate","Object","keys","inputDef","map","key","name","type","description","summary","shouldSection","mustSection","example","partialVars","parser","llm","format","chain","LLMChain","prompt","response","call","parse","text","count","doFix","llmFixingParser","fixParser","OutputFixingParser","fromLLM","fix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cAAc,CAACiB,MAAM,CAACxB,IAAI,CACpC,CAAC;EAED,MAAMyB,KAAK,GAAG,IAAIC,gBAAQ,CAAC;IACvBH,GAAG;IACHI,MAAM,EAAEpB;EACZ,CAAC,CAAC;EAEF,MAAMqB,QAAQ,GAAG,MAAMH,KAAK,CAACI,IAAI,CAAC7B,IAAI,CAAC;EAEvC,IAAI;IACA,OAAO,MAAMsB,MAAM,CAACQ,KAAK,CAACF,QAAQ,CAACG,IAAI,CAAC;EAC5C,CAAC,CAAC,OAAOtC,CAAM,EAAE;IACb,IAAIuC,KAAK,GAAG,CAAC;IACb,eAAeC,KAAKA,CAAA,EAAoB;MACpCD,KAAK,EAAE;MACP,IAAI;QACA,MAAME,eAAe,GAAGrC,OAAO,CAACI,MAAM,CAClCH,QAAQ,EACR,MAAMS,cAAc,CAACiB,MAAM,CAACxB,IAAI,CAAC,EACjCA,IACJ,CAAC;QAED,MAAMmC,SAAS,GAAGC,kCAAkB,CAACC,OAAO,CACxCH,eAAe,EACfZ,MACJ,CAAC;QAED,MAAMgB,KAAK,GAAG,MAAMH,SAAS,CAACL,KAAK,CAACF,QAAQ,CAACG,IAAI,CAAC;QAClD,OAAOO,KAAK;MAChB,CAAC,CAAC,OAAO7C,CAAM,EAAE;QACb,IAAIuC,KAAK,GAAG,CAAC,EAAE,MAAMvC,CAAC;QACtB,OAAO,MAAMwC,KAAK,CAAC,CAAC;MACxB;IACJ;IAEA,OAAO,MAAMA,KAAK,CAAC,CAAC;EACxB;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "createGetLLM", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _createGetLLM.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "createShouldMustTemplate", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _ShouldMustTemplate.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "genJSON", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _genJSON.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _ShouldMustTemplate = _interopRequireDefault(require("./templates/ShouldMustTemplate"));
|
|
25
|
+
var _createGetLLM = _interopRequireDefault(require("./utils/createGetLLM"));
|
|
26
|
+
var _genJSON = _interopRequireDefault(require("./controllers/genJSON"));
|
|
27
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ShouldMustTemplate","_interopRequireDefault","require","_createGetLLM","_genJSON","e","__esModule","default"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA4C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = createShouldMustTemplate;
|
|
7
|
+
var _prompts = require("@langchain/core/prompts");
|
|
8
|
+
async function createShouldMustTemplate(inputDef, outputParser, summary, shouldSection, mustSection, example, partialVars, o1) {
|
|
9
|
+
const outputFormat = outputParser.getFormatInstructions();
|
|
10
|
+
|
|
11
|
+
// create should section prompt
|
|
12
|
+
const shouldSectionPrompt = (() => {
|
|
13
|
+
if (!shouldSection) return "";
|
|
14
|
+
const shouldSectionCount = shouldSection.length;
|
|
15
|
+
if (shouldSectionCount === 0) return "";
|
|
16
|
+
|
|
17
|
+
// create should section header
|
|
18
|
+
const shouldSectionHeader = `# You Should\n
|
|
19
|
+
The tasks assigned to you are you are from (a1) to (a${shouldSectionCount}) below.`;
|
|
20
|
+
// create should section
|
|
21
|
+
const shouldSectionBody = shouldSection.map(elem => {
|
|
22
|
+
const baseBody = `## (a${elem.no}) ${elem.title}`;
|
|
23
|
+
if (elem.content) return `${baseBody}\n${elem.content}`;else return baseBody;
|
|
24
|
+
}).join("\n\n");
|
|
25
|
+
return shouldSectionHeader + shouldSectionBody;
|
|
26
|
+
})();
|
|
27
|
+
|
|
28
|
+
// create must section prompt
|
|
29
|
+
const mustSectionPrompt = (() => {
|
|
30
|
+
if (!mustSection) return "";
|
|
31
|
+
const mustSectionCount = mustSection.length;
|
|
32
|
+
if (mustSectionCount === 0) return "";
|
|
33
|
+
|
|
34
|
+
// create must section header
|
|
35
|
+
const mustSectionHeader = `# You Must\n
|
|
36
|
+
You must satisfy the following tasks from (b1) to (b${mustSectionCount}) below.\n\n`;
|
|
37
|
+
// create must section
|
|
38
|
+
const mustSectionBody = mustSection.map(elem => {
|
|
39
|
+
const baseBody = `## (b${elem.no}) ${elem.title}`;
|
|
40
|
+
if (elem.content) return `${baseBody}\n${elem.content}`;else return baseBody;
|
|
41
|
+
}).join("\n\n");
|
|
42
|
+
return mustSectionHeader + mustSectionBody;
|
|
43
|
+
})();
|
|
44
|
+
|
|
45
|
+
// create example section prompt
|
|
46
|
+
const exampleSectionPrompt = (() => {
|
|
47
|
+
if (!example) return "";
|
|
48
|
+
const exampleSectionCount = example.length;
|
|
49
|
+
if (exampleSectionCount === 0) return "";
|
|
50
|
+
|
|
51
|
+
// create example section header
|
|
52
|
+
const exampleSectionHeader = `# Example\n\n`;
|
|
53
|
+
|
|
54
|
+
// create example section
|
|
55
|
+
const exampleSectionBody = example.map(elem => `## (c${elem.no}) ${elem.title}\n${elem.content}`).join("\n\n");
|
|
56
|
+
return exampleSectionHeader + exampleSectionBody;
|
|
57
|
+
})();
|
|
58
|
+
const systemPrompt = `${summary}\n\n${shouldSectionPrompt}\n\n${mustSectionPrompt}\n\n${exampleSectionPrompt}`;
|
|
59
|
+
const humanPrompt = [inputDef.filter(elem => elem.type === "string").map(elem => `# ${elem.name}${elem.description ? "\n" + elem.description : ""}
|
|
60
|
+
{${elem.name}}`).join("\n\n")].concat(inputDef.filter(elem => elem.type === "imageDataURL" && !o1).map(elem => {
|
|
61
|
+
return {
|
|
62
|
+
type: "image_url",
|
|
63
|
+
image_url: `{${elem.name}}`
|
|
64
|
+
};
|
|
65
|
+
}));
|
|
66
|
+
return new _prompts.ChatPromptTemplate({
|
|
67
|
+
promptMessages: [_prompts.HumanMessagePromptTemplate.fromTemplate([systemPrompt + "\n\n{outputFormat}"].concat(humanPrompt))],
|
|
68
|
+
inputVariables: inputDef.filter(elem => elem.type === "string" || elem.type === "imageDataURL" && !o1).map(elem => elem.name),
|
|
69
|
+
partialVariables: {
|
|
70
|
+
outputFormat,
|
|
71
|
+
...partialVars
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=ShouldMustTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_prompts","require","createShouldMustTemplate","inputDef","outputParser","summary","shouldSection","mustSection","example","partialVars","o1","outputFormat","getFormatInstructions","shouldSectionPrompt","shouldSectionCount","length","shouldSectionHeader","shouldSectionBody","map","elem","baseBody","no","title","content","join","mustSectionPrompt","mustSectionCount","mustSectionHeader","mustSectionBody","exampleSectionPrompt","exampleSectionCount","exampleSectionHeader","exampleSectionBody","systemPrompt","humanPrompt","filter","type","name","description","concat","image_url","ChatPromptTemplate","promptMessages","HumanMessagePromptTemplate","fromTemplate","inputVariables","partialVariables"],"sourceRoot":"../../../src","sources":["templates/ShouldMustTemplate.ts"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAKe,eAAeC,wBAAwBA,CAClDC,QAAoB,EACpBC,YAA8B,EAC9BC,OAAe,EACfC,aAA+B,EAC/BC,WAA6B,EAC7BC,OAAyB,EACzBC,WAA+E,EAC/EC,EAAY,EACyB;EACrC,MAAMC,YAAoB,GAAGP,YAAY,CAACQ,qBAAqB,CAAC,CAAC;;EAEjE;EACA,MAAMC,mBAA2B,GAAG,CAAC,MAAM;IACvC,IAAI,CAACP,aAAa,EAAE,OAAO,EAAE;IAE7B,MAAMQ,kBAA0B,GAAGR,aAAa,CAACS,MAAM;IACvD,IAAID,kBAAkB,KAAK,CAAC,EAAE,OAAO,EAAE;;IAEvC;IACA,MAAME,mBAA2B,GAAG;AAC5C,uDAAuDF,kBAAkB,UAAU;IAC3E;IACA,MAAMG,iBAAyB,GAAGX,aAAa,CAACY,GAAG,CAAEC,IAAI,IAAK;MAC1D,MAAMC,QAAgB,GAAG,QAAQD,IAAI,CAACE,EAAE,KAAKF,IAAI,CAACG,KAAK,EAAE;MACzD,IAAIH,IAAI,CAACI,OAAO,EAAE,OAAO,GAAGH,QAAQ,KAAKD,IAAI,CAACI,OAAO,EAAE,CAAC,KACnD,OAAOH,QAAQ;IACxB,CAAC,CAAC,CAACI,IAAI,CAAC,MAAM,CAAC;IAEf,OAAOR,mBAAmB,GAAGC,iBAAiB;EAClD,CAAC,EAAE,CAAC;;EAEJ;EACA,MAAMQ,iBAAyB,GAAG,CAAC,MAAM;IACrC,IAAI,CAAClB,WAAW,EAAE,OAAO,EAAE;IAE3B,MAAMmB,gBAAwB,GAAGnB,WAAW,CAACQ,MAAM;IACnD,IAAIW,gBAAgB,KAAK,CAAC,EAAE,OAAO,EAAE;;IAErC;IACA,MAAMC,iBAAyB,GAAG;AAC1C,sDAAsDD,gBAAgB,cAAc;IAC5E;IACA,MAAME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GAAG,CAAC,CAACb,IAAI,CAAC,MAAM,CAAC,CACxB,CAACe,MAAM,CACJpC,QAAQ,CAACgC,MAAM,CAAEhB,IAAI,IAAKA,IAAI,CAACiB,IAAI,KAAK,cAAc,IAAI,CAAC1B,EAAE,CAAC,CAACQ,GAAG,CAAEC,IAAI,IAAK;IACzE,OAAO;MACHiB,IAAI,EAAE,WAAW;MACjBI,SAAS,EAAE,IAAIrB,IAAI,CAACkB,IAAI;IAC5B,CAAC;EACL,CAAC,CACL,CAAC;EAED,OAAO,IAAII,2BAAkB,CAAC;IAC1BC,cAAc,EAAE,CACZC,mCAA0B,CAACC,YAAY,CAAC,CAACX,YAAY,GAAG,oBAAoB,CAAC,CAACM,MAAM,CAACL,WAAW,CAAC,CAAC,CACrG;IACDW,cAAc,EAAE1C,QAAQ,CACnBgC,MAAM,CAAEhB,IAAI,IAAKA,IAAI,CAACiB,IAAI,KAAK,QAAQ,IAAKjB,IAAI,CAACiB,IAAI,KAAK,cAAc,IAAI,CAAC1B,EAAG,CAAC,CACjFQ,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACkB,IAAI,CAAC;IAC7BS,gBAAgB,EAAE;MACdnC,YAAY;MACZ,GAAGF;IACP;EACJ,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = createGetLLM;
|
|
7
|
+
var _openai = require("@langchain/openai");
|
|
8
|
+
var _anthropic = require("@langchain/anthropic");
|
|
9
|
+
var _googleGenai = require("@langchain/google-genai");
|
|
10
|
+
// import { HarmBlockThreshold, HarmCategory } from "@google/generative-ai";
|
|
11
|
+
|
|
12
|
+
function createGetLLM(tasksModelsMap, defaultModel) {
|
|
13
|
+
function getModelAndTemperature(taskName) {
|
|
14
|
+
const model = taskName in tasksModelsMap ? tasksModelsMap[taskName] : defaultModel;
|
|
15
|
+
if (!model) {
|
|
16
|
+
throw new Error(`Model not found for task ${taskName}`);
|
|
17
|
+
}
|
|
18
|
+
return [model.model, model.vendor];
|
|
19
|
+
}
|
|
20
|
+
const getLLM = (taskName, usedTemplate, options, loggingInfo) => {
|
|
21
|
+
const [modelName, vendor] = getModelAndTemperature(taskName);
|
|
22
|
+
const argsImageURLs = [];
|
|
23
|
+
let imageNum = 0;
|
|
24
|
+
if (usedTemplate instanceof Array) {
|
|
25
|
+
usedTemplate = usedTemplate.map(message => {
|
|
26
|
+
if (typeof message.content === "string") return message.content;
|
|
27
|
+
if (message.content instanceof Array) return message.content /*.filter((content) => content.type === "text")*/.map(content => {
|
|
28
|
+
if (content.type === "text") {
|
|
29
|
+
return content.text;
|
|
30
|
+
} else {
|
|
31
|
+
argsImageURLs.push(content.image_url);
|
|
32
|
+
return `\n[AttachedImage(${content.type}):${imageNum++}]`;
|
|
33
|
+
}
|
|
34
|
+
}).join("\n\n");
|
|
35
|
+
}).join("\n\n");
|
|
36
|
+
}
|
|
37
|
+
const thinkingModel = modelName === "o1-mini" || modelName === "o1-preview" || modelName === "o1" || modelName === "o3-mini";
|
|
38
|
+
let inputPrompts = [];
|
|
39
|
+
const llmConfig = {
|
|
40
|
+
timeout: options !== null && options !== void 0 && options.timeout || thinkingModel ? 60 * 3 * 1000 : undefined,
|
|
41
|
+
modelName,
|
|
42
|
+
temperature: (options === null || options === void 0 ? void 0 : options.temperature) || 0.5,
|
|
43
|
+
reasoningEffort: thinkingModel ? (options === null || options === void 0 ? void 0 : options.reasoningEffort) || "low" : undefined,
|
|
44
|
+
callbacks: [{
|
|
45
|
+
handleLLMStart: async (llm, prompts) => {
|
|
46
|
+
inputPrompts = prompts;
|
|
47
|
+
},
|
|
48
|
+
handleLLMEnd: async output => {
|
|
49
|
+
var _output$llmOutput, _output$llmOutput2, _output$llmOutput3, _output$llmOutput4, _output$llmOutput5, _output$llmOutput6;
|
|
50
|
+
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;
|
|
51
|
+
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;
|
|
52
|
+
inputPrompts = [];
|
|
53
|
+
},
|
|
54
|
+
handleLLMError: error => {}
|
|
55
|
+
}]
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Anthropic models
|
|
59
|
+
if (vendor.type === "anthropic") {
|
|
60
|
+
return new _anthropic.ChatAnthropic({
|
|
61
|
+
...llmConfig,
|
|
62
|
+
maxTokens: vendor.maxTokens || 7000
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Google Generative AI models
|
|
67
|
+
if (vendor.type === "google") {
|
|
68
|
+
return new _googleGenai.ChatGoogleGenerativeAI({
|
|
69
|
+
model: modelName,
|
|
70
|
+
maxOutputTokens: vendor.maxTokens || 7000,
|
|
71
|
+
callbacks: llmConfig.callbacks
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Azure OpenAI models
|
|
76
|
+
if (vendor.type === "azure") {
|
|
77
|
+
return new _openai.AzureChatOpenAI({
|
|
78
|
+
timeout: llmConfig.timeout,
|
|
79
|
+
deploymentName: (vendor === null || vendor === void 0 ? void 0 : vendor.deploymentName) || modelName,
|
|
80
|
+
azureOpenAIApiDeploymentName: (vendor === null || vendor === void 0 ? void 0 : vendor.deploymentName) || modelName,
|
|
81
|
+
openAIBasePath: vendor.endpoint,
|
|
82
|
+
openAIApiKey: vendor.apiKey,
|
|
83
|
+
openAIApiVersion: vendor.apiVersion,
|
|
84
|
+
temperature: llmConfig.temperature,
|
|
85
|
+
modelName: modelName,
|
|
86
|
+
callbacks: llmConfig.callbacks,
|
|
87
|
+
reasoningEffort: llmConfig.reasoningEffort,
|
|
88
|
+
azureOpenAIApiInstanceName: vendor.instanceName
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// OpenAI models (default)
|
|
93
|
+
return new _openai.ChatOpenAI(llmConfig);
|
|
94
|
+
};
|
|
95
|
+
return getLLM;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=createGetLLM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_openai","require","_anthropic","_googleGenai","createGetLLM","tasksModelsMap","defaultModel","getModelAndTemperature","taskName","model","Error","vendor","getLLM","usedTemplate","options","loggingInfo","modelName","argsImageURLs","imageNum","Array","map","message","content","type","text","push","image_url","join","thinkingModel","inputPrompts","llmConfig","timeout","undefined","temperature","reasoningEffort","callbacks","handleLLMStart","llm","prompts","handleLLMEnd","output","_output$llmOutput","_output$llmOutput2","_output$llmOutput3","_output$llmOutput4","_output$llmOutput5","_output$llmOutput6","promptTokens","llmOutput","usage_metadata","prompt_token_count","usage","input_tokens","tokenUsage","completionTokens","candidates_token_count","output_tokens","handleLLMError","error","ChatAnthropic","maxTokens","ChatGoogleGenerativeAI","maxOutputTokens","AzureChatOpenAI","deploymentName","azureOpenAIApiDeploymentName","openAIBasePath","endpoint","openAIApiKey","apiKey","openAIApiVersion","apiVersion","azureOpenAIApiInstanceName","instanceName","ChatOpenAI"],"sourceRoot":"../../../src","sources":["utils/createGetLLM.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA;;AAOe,SAASG,YAAYA,CAChCC,cAA2E,EAC3EC,YAAsD,EACrC;EAEjB,SAASC,sBAAsBA,CAACC,QAA4B,EAA6B;IACrF,MAAMC,KAAK,GAAGD,QAAQ,IAAIH,cAAc,GAAGA,cAAc,CAACG,QAAQ,CAAc,GAAGF,YAAY;IAC/F,IAAI,CAACG,KAAK,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,4BAA4BF,QAAQ,EAAE,CAAC;IAC3D;IACA,OAAO,CAAEC,KAAK,CAACA,KAAK,EAAEA,KAAK,CAACE,MAAM,CAAE;EACxC;EAEA,MAAMC,MAAyB,GAAGA,CAC9BJ,QAA4B,EAC5BK,YAAoC,EACpCC,OAIC,EACDC,WAAiB,KACuD;IACxE,MAAM,CAAEC,SAAS,EAAEL,MAAM,CAAE,GAAGJ,sBAAsB,CAACC,QAAQ,CAAC;IAE9D,MAAMS,aAAuB,GAAG,EAAE;IAClC,IAAIC,QAAQ,GAAG,CAAC;IAChB,IAAIL,YAAY,YAAYM,KAAK,EAAE;MAC/BN,YAAY,GAAIA,YAAY,CAAmBO,GAAG,CAAEC,OAAO,IAAK;QA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M;AACjB","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { LLMChain } from "langchain/chains";
|
|
2
|
+
import { OutputFixingParser, StructuredOutputParser } from "langchain/output_parsers";
|
|
3
|
+
import createShouldMustTemplate from "../templates/ShouldMustTemplate";
|
|
4
|
+
export default async function genJSON(context, taskName, template, args) {
|
|
5
|
+
if (!(context !== null && context !== void 0 && context.getLLM)) {
|
|
6
|
+
throw new Error("getLLM is not set");
|
|
7
|
+
}
|
|
8
|
+
const outputParser = StructuredOutputParser.fromZodSchema(template.outputSchema);
|
|
9
|
+
const promptTemplate = await createShouldMustTemplate(Object.keys(template.inputDef).map(key => ({
|
|
10
|
+
name: key,
|
|
11
|
+
type: template.inputDef[key].type,
|
|
12
|
+
description: template.inputDef[key].description
|
|
13
|
+
})), outputParser, template.summary, template.shouldSection, template.mustSection, template.example, template.partialVars);
|
|
14
|
+
const parser = outputParser;
|
|
15
|
+
if (!parser) {
|
|
16
|
+
throw new Error("outputParser is not set");
|
|
17
|
+
}
|
|
18
|
+
const llm = context.getLLM(taskName, await promptTemplate.format(args));
|
|
19
|
+
const chain = new LLMChain({
|
|
20
|
+
llm,
|
|
21
|
+
prompt: promptTemplate
|
|
22
|
+
});
|
|
23
|
+
const response = await chain.call(args);
|
|
24
|
+
try {
|
|
25
|
+
return await parser.parse(response.text);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
let count = 0;
|
|
28
|
+
async function doFix() {
|
|
29
|
+
count++;
|
|
30
|
+
try {
|
|
31
|
+
const llmFixingParser = context.getLLM(taskName, await promptTemplate.format(args), args);
|
|
32
|
+
const fixParser = OutputFixingParser.fromLLM(llmFixingParser, parser);
|
|
33
|
+
const fixed = await fixParser.parse(response.text);
|
|
34
|
+
return fixed;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
if (count > 5) throw e;
|
|
37
|
+
return await doFix();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return await doFix();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=genJSON.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LLMChain","OutputFixingParser","StructuredOutputParser","createShouldMustTemplate","genJSON","context","taskName","template","args","getLLM","Error","outputParser","fromZodSchema","outputSchema","promptTemplate","Object","keys","inputDef","map","key","name","type","description","summary","shouldSection","mustSection","example","partialVars","parser","llm","format","chain","prompt","response","call","parse","text","e","count","doFix","llmFixingParser","fixParser","fromLLM","fixed"],"sourceRoot":"../../../src","sources":["controllers/genJSON.ts"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,kBAAkB,EAAEC,sBAAsB,QAAQ,0BAA0B;AAGrF,OAAOC,wBAAwB,MAAM,iCAAiC;AAGtE,eAAe,eAAeC,OAAOA,CACjCC,OAA4B,EAC5BC,QAAgB,EAChBC,QASC,EACDC,IAAkD,EACnC;EAEf,IAAI,EAACH,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEI,MAAM,GAAE;IAClB,MAAM,IAAIC,KAAK,CAAC,mBAAmB,CAAC;EACxC;EAEA,MAAMC,YAAY,GAAGT,sBAAsB,CAACU,aAAa,CAACL,QAAQ,CAACM,YAAY,CAAC;EAEhF,MAAMC,cAAc,GAAG,MAAMX,wBAAwB,CACjDY,MAAM,CAACC,IAAI,CAACT,QAAQ,CAACU,QAAQ,CAAC,CAACC,GAAG,CAACC,GAAG,KAAK;IACvCC,IAAI,EAAED,GAAG;IACTE,IAAI,EAAEd,QAAQ,CAACU,QAAQ,CAACE,GAAG,CAAc,CAACE,IAAI;IAC9CC,WAAW,EAAEf,QAAQ,CAACU,QAAQ,CAACE,GAAG,CAAc,CAACG;EACrD,CAAC,CAAC,CAAC,EACHX,YAAY,EACZJ,QAAQ,CAACgB,OAAO,EAChBhB,QAAQ,CAACiB,aAAa,EACtBjB,QAAQ,CAACkB,WAAW,EACpBlB,QAAQ,CAACmB,OAAO,EAChBnB,QAAQ,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"../../src","sources":["index.ts"],"mappings":"AAUA,OAAOA,wBAAwB,MAAM,gCAAgC;AACrE,OAAOC,YAAY,MAAM,sBAAsB;AAC/C,OAAOC,OAAO,MAAM,uBAAuB;AAE3C,SACIA,OAAO,EACPF,wBAAwB,EACxBC,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ChatPromptTemplate, HumanMessagePromptTemplate } from "@langchain/core/prompts";
|
|
2
|
+
export default async function createShouldMustTemplate(inputDef, outputParser, summary, shouldSection, mustSection, example, partialVars, o1) {
|
|
3
|
+
const outputFormat = outputParser.getFormatInstructions();
|
|
4
|
+
|
|
5
|
+
// create should section prompt
|
|
6
|
+
const shouldSectionPrompt = (() => {
|
|
7
|
+
if (!shouldSection) return "";
|
|
8
|
+
const shouldSectionCount = shouldSection.length;
|
|
9
|
+
if (shouldSectionCount === 0) return "";
|
|
10
|
+
|
|
11
|
+
// create should section header
|
|
12
|
+
const shouldSectionHeader = `# You Should\n
|
|
13
|
+
The tasks assigned to you are you are from (a1) to (a${shouldSectionCount}) below.`;
|
|
14
|
+
// create should section
|
|
15
|
+
const shouldSectionBody = shouldSection.map(elem => {
|
|
16
|
+
const baseBody = `## (a${elem.no}) ${elem.title}`;
|
|
17
|
+
if (elem.content) return `${baseBody}\n${elem.content}`;else return baseBody;
|
|
18
|
+
}).join("\n\n");
|
|
19
|
+
return shouldSectionHeader + shouldSectionBody;
|
|
20
|
+
})();
|
|
21
|
+
|
|
22
|
+
// create must section prompt
|
|
23
|
+
const mustSectionPrompt = (() => {
|
|
24
|
+
if (!mustSection) return "";
|
|
25
|
+
const mustSectionCount = mustSection.length;
|
|
26
|
+
if (mustSectionCount === 0) return "";
|
|
27
|
+
|
|
28
|
+
// create must section header
|
|
29
|
+
const mustSectionHeader = `# You Must\n
|
|
30
|
+
You must satisfy the following tasks from (b1) to (b${mustSectionCount}) below.\n\n`;
|
|
31
|
+
// create must section
|
|
32
|
+
const mustSectionBody = mustSection.map(elem => {
|
|
33
|
+
const baseBody = `## (b${elem.no}) ${elem.title}`;
|
|
34
|
+
if (elem.content) return `${baseBody}\n${elem.content}`;else return baseBody;
|
|
35
|
+
}).join("\n\n");
|
|
36
|
+
return mustSectionHeader + mustSectionBody;
|
|
37
|
+
})();
|
|
38
|
+
|
|
39
|
+
// create example section prompt
|
|
40
|
+
const exampleSectionPrompt = (() => {
|
|
41
|
+
if (!example) return "";
|
|
42
|
+
const exampleSectionCount = example.length;
|
|
43
|
+
if (exampleSectionCount === 0) return "";
|
|
44
|
+
|
|
45
|
+
// create example section header
|
|
46
|
+
const exampleSectionHeader = `# Example\n\n`;
|
|
47
|
+
|
|
48
|
+
// create example section
|
|
49
|
+
const exampleSectionBody = example.map(elem => `## (c${elem.no}) ${elem.title}\n${elem.content}`).join("\n\n");
|
|
50
|
+
return exampleSectionHeader + exampleSectionBody;
|
|
51
|
+
})();
|
|
52
|
+
const systemPrompt = `${summary}\n\n${shouldSectionPrompt}\n\n${mustSectionPrompt}\n\n${exampleSectionPrompt}`;
|
|
53
|
+
const humanPrompt = [inputDef.filter(elem => elem.type === "string").map(elem => `# ${elem.name}${elem.description ? "\n" + elem.description : ""}
|
|
54
|
+
{${elem.name}}`).join("\n\n")].concat(inputDef.filter(elem => elem.type === "imageDataURL" && !o1).map(elem => {
|
|
55
|
+
return {
|
|
56
|
+
type: "image_url",
|
|
57
|
+
image_url: `{${elem.name}}`
|
|
58
|
+
};
|
|
59
|
+
}));
|
|
60
|
+
return new ChatPromptTemplate({
|
|
61
|
+
promptMessages: [HumanMessagePromptTemplate.fromTemplate([systemPrompt + "\n\n{outputFormat}"].concat(humanPrompt))],
|
|
62
|
+
inputVariables: inputDef.filter(elem => elem.type === "string" || elem.type === "imageDataURL" && !o1).map(elem => elem.name),
|
|
63
|
+
partialVariables: {
|
|
64
|
+
outputFormat,
|
|
65
|
+
...partialVars
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=ShouldMustTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ChatPromptTemplate","HumanMessagePromptTemplate","createShouldMustTemplate","inputDef","outputParser","summary","shouldSection","mustSection","example","partialVars","o1","outputFormat","getFormatInstructions","shouldSectionPrompt","shouldSectionCount","length","shouldSectionHeader","shouldSectionBody","map","elem","baseBody","no","title","content","join","mustSectionPrompt","mustSectionCount","mustSectionHeader","mustSectionBody","exampleSectionPrompt","exampleSectionCount","exampleSectionHeader","exampleSectionBody","systemPrompt","humanPrompt","filter","type","name","description","concat","image_url","promptMessages","fromTemplate","inputVariables","partialVariables"],"sourceRoot":"../../../src","sources":["templates/ShouldMustTemplate.ts"],"mappings":"AACA,SAASA,kBAAkB,EAAEC,0BAA0B,QAAqC,yBAAyB;AAKrH,eAAe,eAAeC,wBAAwBA,CAClDC,QAAoB,EACpBC,YAA8B,EAC9BC,OAAe,EACfC,aAA+B,EAC/BC,WAA6B,EAC7BC,OAAyB,EACzBC,WAA+E,EAC/EC,EAAY,EACyB;EACrC,MAAMC,YAAoB,GAAGP,YAAY,CAACQ,qBAAqB,CAAC,CAAC;;EAEjE;EACA,MAAMC,mBAA2B,GAAG,CAAC,MAAM;IACvC,IAAI,CAACP,aAAa,EAAE,OAAO,EAAE;IAE7B,MAAMQ,kBAA0B,GAAGR,aAAa,CAACS,MAAM;IACvD,IAAID,kBAAkB,KAAK,CAAC,EAAE,OAAO,EAAE;;IAEvC;IACA,MAAME,mBAA2B,GAAG;AAC5C,uDAAuDF,kBAAkB,UAAU;IAC3E;IACA,MAAMG,iBAAyB,GAAGX,aAAa,CAACY,GAAG,CAAEC,IAAI,IAAK;MAC1D,MAAMC,QAAgB,GAAG,QAAQD,IAAI,CAACE,EAAE,KAAKF,IAAI,CAACG,KAAK,EAAE;MACzD,IAAIH,IAAI,CAACI,OAAO,EAAE,OAAO,GAAGH,QAAQ,KAAKD,IAAI,CAACI,OAAO,EAAE,CAAC,KACnD,OAAOH,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names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ChatOpenAI, AzureChatOpenAI } from "@langchain/openai";
|
|
2
|
+
import { ChatAnthropic } from "@langchain/anthropic";
|
|
3
|
+
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
|
|
4
|
+
// import { HarmBlockThreshold, HarmCategory } from "@google/generative-ai";
|
|
5
|
+
|
|
6
|
+
export default function createGetLLM(tasksModelsMap, defaultModel) {
|
|
7
|
+
function getModelAndTemperature(taskName) {
|
|
8
|
+
const model = taskName in tasksModelsMap ? tasksModelsMap[taskName] : defaultModel;
|
|
9
|
+
if (!model) {
|
|
10
|
+
throw new Error(`Model not found for task ${taskName}`);
|
|
11
|
+
}
|
|
12
|
+
return [model.model, model.vendor];
|
|
13
|
+
}
|
|
14
|
+
const getLLM = (taskName, usedTemplate, options, loggingInfo) => {
|
|
15
|
+
const [modelName, vendor] = getModelAndTemperature(taskName);
|
|
16
|
+
const argsImageURLs = [];
|
|
17
|
+
let imageNum = 0;
|
|
18
|
+
if (usedTemplate instanceof Array) {
|
|
19
|
+
usedTemplate = usedTemplate.map(message => {
|
|
20
|
+
if (typeof message.content === "string") return message.content;
|
|
21
|
+
if (message.content instanceof Array) return message.content /*.filter((content) => content.type === "text")*/.map(content => {
|
|
22
|
+
if (content.type === "text") {
|
|
23
|
+
return content.text;
|
|
24
|
+
} else {
|
|
25
|
+
argsImageURLs.push(content.image_url);
|
|
26
|
+
return `\n[AttachedImage(${content.type}):${imageNum++}]`;
|
|
27
|
+
}
|
|
28
|
+
}).join("\n\n");
|
|
29
|
+
}).join("\n\n");
|
|
30
|
+
}
|
|
31
|
+
const thinkingModel = modelName === "o1-mini" || modelName === "o1-preview" || modelName === "o1" || modelName === "o3-mini";
|
|
32
|
+
let inputPrompts = [];
|
|
33
|
+
const llmConfig = {
|
|
34
|
+
timeout: options !== null && options !== void 0 && options.timeout || thinkingModel ? 60 * 3 * 1000 : undefined,
|
|
35
|
+
modelName,
|
|
36
|
+
temperature: (options === null || options === void 0 ? void 0 : options.temperature) || 0.5,
|
|
37
|
+
reasoningEffort: thinkingModel ? (options === null || options === void 0 ? void 0 : options.reasoningEffort) || "low" : undefined,
|
|
38
|
+
callbacks: [{
|
|
39
|
+
handleLLMStart: async (llm, prompts) => {
|
|
40
|
+
inputPrompts = prompts;
|
|
41
|
+
},
|
|
42
|
+
handleLLMEnd: async output => {
|
|
43
|
+
var _output$llmOutput, _output$llmOutput2, _output$llmOutput3, _output$llmOutput4, _output$llmOutput5, _output$llmOutput6;
|
|
44
|
+
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;
|
|
45
|
+
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;
|
|
46
|
+
inputPrompts = [];
|
|
47
|
+
},
|
|
48
|
+
handleLLMError: error => {}
|
|
49
|
+
}]
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Anthropic models
|
|
53
|
+
if (vendor.type === "anthropic") {
|
|
54
|
+
return new ChatAnthropic({
|
|
55
|
+
...llmConfig,
|
|
56
|
+
maxTokens: vendor.maxTokens || 7000
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Google Generative AI models
|
|
61
|
+
if (vendor.type === "google") {
|
|
62
|
+
return new ChatGoogleGenerativeAI({
|
|
63
|
+
model: modelName,
|
|
64
|
+
maxOutputTokens: vendor.maxTokens || 7000,
|
|
65
|
+
callbacks: llmConfig.callbacks
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Azure OpenAI models
|
|
70
|
+
if (vendor.type === "azure") {
|
|
71
|
+
return new AzureChatOpenAI({
|
|
72
|
+
timeout: llmConfig.timeout,
|
|
73
|
+
deploymentName: (vendor === null || vendor === void 0 ? void 0 : vendor.deploymentName) || modelName,
|
|
74
|
+
azureOpenAIApiDeploymentName: (vendor === null || vendor === void 0 ? void 0 : vendor.deploymentName) || modelName,
|
|
75
|
+
openAIBasePath: vendor.endpoint,
|
|
76
|
+
openAIApiKey: vendor.apiKey,
|
|
77
|
+
openAIApiVersion: vendor.apiVersion,
|
|
78
|
+
temperature: llmConfig.temperature,
|
|
79
|
+
modelName: modelName,
|
|
80
|
+
callbacks: llmConfig.callbacks,
|
|
81
|
+
reasoningEffort: llmConfig.reasoningEffort,
|
|
82
|
+
azureOpenAIApiInstanceName: vendor.instanceName
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// OpenAI models (default)
|
|
87
|
+
return new ChatOpenAI(llmConfig);
|
|
88
|
+
};
|
|
89
|
+
return getLLM;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=createGetLLM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ChatOpenAI","AzureChatOpenAI","ChatAnthropic","ChatGoogleGenerativeAI","createGetLLM","tasksModelsMap","defaultModel","getModelAndTemperature","taskName","model","Error","vendor","getLLM","usedTemplate","options","loggingInfo","modelName","argsImageURLs","imageNum","Array","map","message","content","type","text","push","image_url","join","thinkingModel","inputPrompts","llmConfig","timeout","undefined","temperature","reasoningEffort","callbacks","handleLLMStart","llm","prompts","handleLLMEnd","output","_output$llmOutput","_output$llmOutput2","_output$llmOutput3","_output$llmOutput4","_output$llmOutput5","_output$llmOutput6","promptTokens","llmOutput","usage_metadata","prompt_token_count","usage","input_tokens","tokenUsage","completionTokens","candidates_token_count","output_tokens","handleLLMError","error","maxTokens","maxOutputTokens","deploymentName","azureOpenAIApiDeploymentName","openAIBasePath","endpoint","openAIApiKey","apiKey","openAIApiVersion","apiVersion","azureOpenAIApiInstanceName","instanceName"],"sourceRoot":"../../../src","sources":["utils/createGetLLM.ts"],"mappings":"AAAA,SAASA,UAAU,EAAEC,eAAe,QAAQ,mBAAmB;AAC/D,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,sBAAsB,QAAQ,yBAAyB;AAChE;;AAOA,eAAe,SAASC,YAAYA,CAChCC,cAA2E,EAC3EC,YAAsD,EACrC;EAEjB,SAASC,sBAAsBA,CAACC,QAA4B,EAA6B;IACrF,MAAMC,KAAK,GAAGD,QAAQ,IAAIH,cAAc,GAAGA,cAAc,CAACG,QAAQ,CAAc,GAAGF,YAAY;IAC/F,IAAI,CAACG,KAAK,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,4BAA4BF,QAAQ,EAAE,CAAC;IAC3D;IACA,OAAO,CAAEC,KAAK,CAACA,KAAK,EAAEA,KAAK,CAACE,MAAM,CAAE;EACxC;EAEA,MAAMC,MAAyB,GAAGA,CAC9BJ,QAA4B,EAC5BK,YA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EAAEH,SAAS,CAACG,WAAW;QAClCjB,SAAS,EAAEA,SAAS;QACpBmB,SAAS,EAAEL,SAAS,CAACK,SAAS;QAC9BD,eAAe,EAAEJ,SAAS,CAACI,eAAe;QAC1CmC,0BAA0B,EAAE1D,MAAM,CAAC2D;MACvC,CAAC,CAAC;IACN;;IAEA;IACA,OAAO,IAAItE,UAAU,CAAC8B,SAAS,CAAC;EACpC,CAAC;EAED,OAAOlB,MAAM;AACjB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BackendContext } from "@jeliq/app-sdk-core";
|
|
2
|
+
import { InputDefObj, PromptElement } from "../types";
|
|
3
|
+
import { ZodSchema } from "zod";
|
|
4
|
+
export default function genJSON<InputKeys extends string | number | symbol, Output>(context: BackendContext<any>, taskName: string, template: {
|
|
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
|
+
}, args: Record<InputKeys, string | undefined | null>): Promise<Output>;
|
|
14
|
+
//# sourceMappingURL=genJSON.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genJSON.d.ts","sourceRoot":"","sources":["../../../../src/controllers/genJSON.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAEnC,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,GACnD,OAAO,CAAC,MAAM,CAAC,CAmEjB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { GetLLM, LLM_VENDOR, SystemPrompt, SystemPromptWithTemplateInfo, InputDefObj as InputDef, PromptElement, AttachedFileData, } from "./types";
|
|
2
|
+
import createShouldMustTemplate from "./templates/ShouldMustTemplate";
|
|
3
|
+
import createGetLLM from "./utils/createGetLLM";
|
|
4
|
+
import genJSON from "./controllers/genJSON";
|
|
5
|
+
export { genJSON, createShouldMustTemplate, createGetLLM, };
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AAE5C,OAAO,EACH,OAAO,EACP,wBAAwB,EACxB,YAAY,GACf,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseOutputParser } from "@langchain/core/output_parsers";
|
|
2
|
+
import { ChatPromptTemplate } from "@langchain/core/prompts";
|
|
3
|
+
import { PromptElement } from "../types";
|
|
4
|
+
import { InputDef } from "../types";
|
|
5
|
+
export default function createShouldMustTemplate(inputDef: InputDef[], outputParser: BaseOutputParser, summary: string, shouldSection?: PromptElement[], mustSection?: PromptElement[], example?: PromptElement[], partialVars?: Record<string, string | (() => Promise<string> | (() => string))>, o1?: boolean): Promise<ChatPromptTemplate<any, any>>;
|
|
6
|
+
//# sourceMappingURL=ShouldMustTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShouldMustTemplate.d.ts","sourceRoot":"","sources":["../../../../src/templates/ShouldMustTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAA2D,MAAM,yBAAyB,CAAC;AACtH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,wBAA8B,wBAAwB,CAClD,QAAQ,EAAE,QAAQ,EAAE,EACpB,YAAY,EAAE,gBAAgB,EAC9B,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,EAC/E,EAAE,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAqFvC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ChatOpenAI, AzureChatOpenAI } from "@langchain/openai";
|
|
2
|
+
import { ChatAnthropic } from "@langchain/anthropic";
|
|
3
|
+
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
|
|
4
|
+
import { BaseMessage } from "@langchain/core/messages";
|
|
5
|
+
export declare type AttachedFileData = {
|
|
6
|
+
url: string;
|
|
7
|
+
data: string;
|
|
8
|
+
};
|
|
9
|
+
export declare type PromptElement = {
|
|
10
|
+
no: number;
|
|
11
|
+
title: string;
|
|
12
|
+
content: string;
|
|
13
|
+
};
|
|
14
|
+
export declare type InputDef = {
|
|
15
|
+
name: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
type: "string" | "imageDataURL";
|
|
18
|
+
};
|
|
19
|
+
export type SystemPrompt = {
|
|
20
|
+
type: "ShouldMust";
|
|
21
|
+
revisionNo: string;
|
|
22
|
+
reasonForChange: string | null;
|
|
23
|
+
patternNo: number | null;
|
|
24
|
+
inputDef: InputDef[];
|
|
25
|
+
summary: string;
|
|
26
|
+
contents: {
|
|
27
|
+
shouldSection?: PromptElement[];
|
|
28
|
+
mustSection?: PromptElement[];
|
|
29
|
+
example?: PromptElement[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export type SystemPromptWithTemplateInfo = SystemPrompt & {
|
|
33
|
+
taskName: string;
|
|
34
|
+
framework: string;
|
|
35
|
+
frameworkBranchName: string | null;
|
|
36
|
+
abTest?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export type LLM_VENDOR = {
|
|
39
|
+
type: "openai" | "anthropic" | "google" | "azure";
|
|
40
|
+
maxTokens?: number;
|
|
41
|
+
endpoint?: string;
|
|
42
|
+
apiKey?: string;
|
|
43
|
+
apiVersion?: string;
|
|
44
|
+
deploymentName?: string;
|
|
45
|
+
instanceName?: string;
|
|
46
|
+
};
|
|
47
|
+
export type GetLLM<TASK_NAME extends string> = (taskName: TASK_NAME, usedTemplate: string | BaseMessage[], options?: {
|
|
48
|
+
temperature?: number;
|
|
49
|
+
reasoningEffort?: "low" | "medium" | "high";
|
|
50
|
+
timeout?: number;
|
|
51
|
+
}, loggingInfo?: any) => ChatOpenAI | ChatAnthropic | ChatGoogleGenerativeAI | AzureChatOpenAI;
|
|
52
|
+
export type InputDefObj<InputKeys extends string | number | symbol> = {
|
|
53
|
+
[name in InputKeys]: {
|
|
54
|
+
type: InputDef["type"];
|
|
55
|
+
description: InputDef["description"];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,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,MA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AG,MAAM,CAAC;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,WAAW,CAAC,EAAE,GAAG,KAChB,UAAU,GAAG,aAAa,GAAG,sBAAsB,GAAG,eAAe,CAAC;AAE3E,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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LLM_VENDOR, GetLLM } from "../types";
|
|
2
|
+
export default function createGetLLM<TASK_NAME extends string, LLM_MODEL extends string>(tasksModelsMap: Record<TASK_NAME, {
|
|
3
|
+
vendor: LLM_VENDOR;
|
|
4
|
+
model: LLM_MODEL;
|
|
5
|
+
}>, defaultModel: {
|
|
6
|
+
vendor: LLM_VENDOR;
|
|
7
|
+
model: LLM_MODEL;
|
|
8
|
+
}): GetLLM<TASK_NAME>;
|
|
9
|
+
//# sourceMappingURL=createGetLLM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGetLLM.d.ts","sourceRoot":"","sources":["../../../../src/utils/createGetLLM.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM,EACnF,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC,EAC3E,YAAY,EAAE;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACvD,MAAM,CAAC,SAAS,CAAC,CAmHnB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jeliq/app-sdk-llm",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"homepage": "https://jeliq.ai/",
|
|
5
|
+
"author": "Jeliq.ai",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"package.json"
|
|
10
|
+
],
|
|
11
|
+
"main": "lib/commonjs/index.js",
|
|
12
|
+
"module": "lib/module/index.js",
|
|
13
|
+
"types": "lib/typescript/index.d.ts",
|
|
14
|
+
"husky": {
|
|
15
|
+
"hooks": {
|
|
16
|
+
"pre-commit": "lint-staged"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@jeliq/app-sdk-core": "^2.0.0",
|
|
21
|
+
"@langchain/anthropic": "^0.3.12",
|
|
22
|
+
"@langchain/azure-openai": "^0.0.11",
|
|
23
|
+
"@langchain/core": "^0.3.37",
|
|
24
|
+
"@langchain/google-genai": "^0.1.8",
|
|
25
|
+
"@langchain/google-vertexai": "^0.1.8",
|
|
26
|
+
"@langchain/openai": "^0.4.2",
|
|
27
|
+
"@langchain/textsplitters": "^0.0.3",
|
|
28
|
+
"langchain": "^0.3.15",
|
|
29
|
+
"lodash": "^4.17.21",
|
|
30
|
+
"ts-node": "^10.9.2",
|
|
31
|
+
"zod": "^3.24.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/lodash": "^4.17.0",
|
|
35
|
+
"@types/react": "^18.3.3",
|
|
36
|
+
"husky": "^8.0.2",
|
|
37
|
+
"react-native-builder-bob": "^0.20.3",
|
|
38
|
+
"typescript": "^4.9.5"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@echopf/sdk": "^2.1.5",
|
|
42
|
+
"react": "^18.0.0"
|
|
43
|
+
},
|
|
44
|
+
"resolutions": {
|
|
45
|
+
"@types/react": "^18.0.0"
|
|
46
|
+
},
|
|
47
|
+
"react-native-builder-bob": {
|
|
48
|
+
"source": "src",
|
|
49
|
+
"output": "lib",
|
|
50
|
+
"targets": [
|
|
51
|
+
"commonjs",
|
|
52
|
+
"module",
|
|
53
|
+
[
|
|
54
|
+
"typescript",
|
|
55
|
+
{
|
|
56
|
+
"project": "tsconfig.json"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"typescript": "tsc --noEmit"
|
|
63
|
+
}
|
|
64
|
+
}
|