typia 7.0.0-dev.20241126 → 7.0.0-dev.20241127
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 +1 -0
- package/lib/executable/TypiaSetupWizard.js +7 -3
- package/lib/executable/TypiaSetupWizard.js.map +1 -1
- package/lib/executable/typia.js +7 -17
- package/lib/executable/typia.js.map +1 -1
- package/lib/index.js +7 -17
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +3 -3
- package/lib/index.mjs.map +1 -1
- package/lib/internal/_llmApplicationFinalize.d.ts +2 -2
- package/lib/json.d.ts +31 -43
- package/lib/json.js +4 -4
- package/lib/json.js.map +1 -1
- package/lib/llm.d.ts +5 -5
- package/lib/llm.js.map +1 -1
- package/lib/module.js +7 -17
- package/lib/module.js.map +1 -1
- package/lib/programmers/ImportProgrammer.js +3 -1
- package/lib/programmers/ImportProgrammer.js.map +1 -1
- package/lib/programmers/json/JsonApplicationProgrammer.d.ts +2 -2
- package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.d.ts +3 -3
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmParametersProgrammer.d.ts +4 -4
- package/lib/programmers/llm/LlmParametersProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.d.ts +6 -6
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/schemas/json/IJsonApplication.d.ts +12 -35
- package/lib/schemas/json/IJsonApplication.js +55 -0
- package/lib/schemas/json/IJsonApplication.js.map +1 -1
- package/lib/schemas/json/IJsonSchemaCollection.d.ts +7 -0
- package/lib/schemas/json/__IJsonApplication.d.ts +35 -0
- package/lib/schemas/json/__IJsonApplication.js +3 -0
- package/lib/schemas/json/__IJsonApplication.js.map +1 -0
- package/lib/transformers/CallExpressionTransformer.js +3 -2
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/features/json/JsonApplicationTransformer.d.ts +0 -5
- package/lib/transformers/features/json/JsonApplicationTransformer.js +92 -85
- package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/json/JsonSchemasTransformer.js +8 -1
- package/lib/transformers/features/json/JsonSchemasTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmApplicationTransformer.js +9 -2
- package/lib/transformers/features/llm/LlmApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmParametersTransformer.js +8 -1
- package/lib/transformers/features/llm/LlmParametersTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmSchemaTransformer.js +17 -4
- package/lib/transformers/features/llm/LlmSchemaTransformer.js.map +1 -1
- package/package.json +3 -3
- package/src/executable/TypiaSetupWizard.ts +7 -2
- package/src/internal/_llmApplicationFinalize.ts +2 -2
- package/src/json.ts +82 -27
- package/src/llm.ts +8 -11
- package/src/programmers/ImportProgrammer.ts +3 -1
- package/src/programmers/json/JsonApplicationProgrammer.ts +13 -13
- package/src/programmers/llm/LlmApplicationProgrammer.ts +21 -21
- package/src/programmers/llm/LlmParametersProgrammer.ts +6 -6
- package/src/programmers/llm/LlmSchemaProgrammer.ts +9 -9
- package/src/schemas/json/IJsonApplication.ts +68 -56
- package/src/schemas/json/IJsonSchemaCollection.ts +7 -0
- package/src/schemas/json/__IJsonApplication.ts +63 -0
- package/src/transformers/CallExpressionTransformer.ts +3 -2
- package/src/transformers/features/json/JsonApplicationTransformer.ts +92 -92
- package/src/transformers/features/json/JsonSchemasTransformer.ts +16 -1
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +28 -14
- package/src/transformers/features/llm/LlmParametersTransformer.ts +26 -12
- package/src/transformers/features/llm/LlmSchemaTransformer.ts +38 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmApplicationTransformer.ts"],"names":[],"mappings":";;;;;;AACA,2FAAwF;AACxF,4DAA4B;AAE5B,4EAAyE;AACzE,sEAAmE;AACnE,8EAA2E;AAC3E,wEAAqE;AACrE,0EAAuE;AAIvE,gGAA6F;AAK7F,6DAA0D;AAE1D,IAAiB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"LlmApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmApplicationTransformer.ts"],"names":[],"mappings":";;;;;;AACA,2FAAwF;AACxF,4DAA4B;AAE5B,4EAAyE;AACzE,sEAAmE;AACnE,8EAA2E;AAC3E,wEAAqE;AACrE,0EAAuE;AAIvE,gGAA6F;AAK7F,6DAA0D;AAE1D,IAAiB,yBAAyB,CAmIzC;AAnID,WAAiB,yBAAyB;IAC3B,mCAAS,GAAG,CAAC,KAAsB,EAAiB,EAAE;;QACjE,uBAAuB;QACvB,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,UAAU,CAAC,aAAa,0CAAE,MAAM,CAAA;YACzC,MAAM,IAAI,mCAAgB,CAAC;gBACzB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,sBAAsB;aAChC,CAAC,CAAC;QAEL,MAAM,GAAG,GAAY,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAE,CAAC;QACxD,IAAI,oBAAE,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC,UAAU,CAAC;QAE1D,YAAY;QACZ,MAAM,KAAK,GAAqB,mBAAmB,CAAmB;YACpE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO;YAC9B,IAAI,EAAE,OAAO;YACb,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CACZ,uCAAkB,CAAC,aAAa,CAAC,KAAyB,CAAC;gBAC3D,SAAS;YACX,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAyB;YAC1C,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK;SACrB,CAAC,CAAC,KA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AmB,CAAC,IAAI,CAAC,CAAC;QAC9D,IACE,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,oBAAE,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC;YAErD,MAAM,IAAI,mCAAgB,CAAC;gBACzB,IAAI,EAAE,uBAAuB;gBAC7B,OAAO,EAAE,qBAAqB,KAAK,CAAC,IAAI,qBAAqB;aAC9D,CAAC,CAAC;QAEL,4BAA4B;QAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE;YAC5B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK;YACxD,MAAM,IAAI,mCAAgB,CAAC;gBACzB,IAAI,EAAE,uBAAuB;gBAC7B,OAAO,EAAE,sCAAsC,KAAK,CAAC,IAAI,IAAI;aAC9D,CAAC,CAAC;QACL,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC;AACN,CAAC,EAnIgB,yBAAyB,yCAAzB,yBAAyB,QAmIzC"}
|
|
@@ -61,7 +61,14 @@ var LlmParametersTransformer;
|
|
|
61
61
|
model,
|
|
62
62
|
metadata: result.data,
|
|
63
63
|
});
|
|
64
|
-
return LiteralFactory_1.LiteralFactory.write(out)
|
|
64
|
+
return typescript_1.default.factory.createAsExpression(LiteralFactory_1.LiteralFactory.write(out), typescript_1.default.factory.createTypeReferenceNode(props.context.importer.instance({
|
|
65
|
+
name: "ILlmSchema",
|
|
66
|
+
file: "@samchon/openapi",
|
|
67
|
+
type: true,
|
|
68
|
+
alias: "__ILlmSchema",
|
|
69
|
+
}).text + ".IParameters", [
|
|
70
|
+
typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral(model)),
|
|
71
|
+
]));
|
|
65
72
|
};
|
|
66
73
|
const getTemplateArgument = (props) => (node) => {
|
|
67
74
|
if (!node)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmParametersTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmParametersTransformer.ts"],"names":[],"mappings":";;;;;;AACA,2FAAwF;AAExF,4DAA4B;AAE5B,sEAAmE;AACnE,8EAA2E;AAC3E,wEAAqE;AAIrE,8FAA2F;AAC3F,sFAAmF;AAKnF,6DAA0D;AAE1D,IAAiB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"LlmParametersTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmParametersTransformer.ts"],"names":[],"mappings":";;;;;;AACA,2FAAwF;AAExF,4DAA4B;AAE5B,sEAAmE;AACnE,8EAA2E;AAC3E,wEAAqE;AAIrE,8FAA2F;AAC3F,sFAAmF;AAKnF,6DAA0D;AAE1D,IAAiB,wBAAwB,CAyGxC;AAzGD,WAAiB,wBAAwB;IAC1B,kCAAS,GAAG,CACvB,KAAsC,EACvB,EAAE;;QACjB,uBAAuB;QACvB,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,UAAU,CAAC,aAAa,0CAAE,MAAM,CAAA;YACzC,MAAM,IAAI,mCAAgB,CAAC;gBACzB,IAAI,EAAE,sBAAsB;gBAC5B,OAAO,EAAE,sBAAsB;aAChC,CAAC,CAAC;QAEL,MAAM,GAAG,GAAY,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAE,CAAC;QACxD,IAAI,oBAAE,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC,UAAU,CAAC;QAE1D,YAAY;QACZ,MAAM,KAAK,GAAqB,mBAAmB,CAAmB;YACpE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO;YAC9B,IAAI,EAAE,OAAO;YACb,EAAE,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,IAAI;aAC9D,CAAC,CAAC;QACL,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC;AACN,CAAC,EAzGgB,wBAAwB,wCAAxB,wBAAwB,QAyGxC"}
|
|
@@ -61,16 +61,29 @@ var LlmSchemaTransformer;
|
|
|
61
61
|
model,
|
|
62
62
|
metadata: result.data,
|
|
63
63
|
});
|
|
64
|
+
const schemaTypeNode = typescript_1.default.factory.createTypeReferenceNode(props.context.importer.instance({
|
|
65
|
+
name: "ILlmSchema",
|
|
66
|
+
file: "@samchon/openapi",
|
|
67
|
+
type: true,
|
|
68
|
+
alias: "__ILlmSchema",
|
|
69
|
+
}).text, [typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral(model))]);
|
|
70
|
+
const literal = typescript_1.default.factory.createAsExpression(LiteralFactory_1.LiteralFactory.write(out.schema), schemaTypeNode);
|
|
64
71
|
if (Object.keys(out.$defs).length === 0)
|
|
65
|
-
return
|
|
72
|
+
return literal;
|
|
66
73
|
return typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createArrowFunction(undefined, undefined, [
|
|
67
|
-
IdentifierFactory_1.IdentifierFactory.parameter("$defs", typescript_1.default.factory.createTypeReferenceNode("Record
|
|
74
|
+
IdentifierFactory_1.IdentifierFactory.parameter("$defs", typescript_1.default.factory.createTypeReferenceNode("Record", [
|
|
75
|
+
typescript_1.default.factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.StringKeyword),
|
|
76
|
+
schemaTypeNode,
|
|
77
|
+
]), undefined),
|
|
68
78
|
], undefined, undefined, typescript_1.default.factory.createBlock([
|
|
69
79
|
typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("Object.assign"), undefined, [
|
|
70
80
|
typescript_1.default.factory.createIdentifier("$defs"),
|
|
71
|
-
LiteralFactory_1.LiteralFactory.write(out.$defs),
|
|
81
|
+
typescript_1.default.factory.createAsExpression(LiteralFactory_1.LiteralFactory.write(out.$defs), typescript_1.default.factory.createTypeReferenceNode("Record", [
|
|
82
|
+
typescript_1.default.factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.StringKeyword),
|
|
83
|
+
schemaTypeNode,
|
|
84
|
+
])),
|
|
72
85
|
])),
|
|
73
|
-
typescript_1.default.factory.createReturnStatement(
|
|
86
|
+
typescript_1.default.factory.createReturnStatement(literal),
|
|
74
87
|
], true)), undefined, [props.expression.arguments[0]]);
|
|
75
88
|
};
|
|
76
89
|
const getTemplateArgument = (props) => (node) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmSchemaTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmSchemaTransformer.ts"],"names":[],"mappings":";;;;;;AACA,2FAAwF;AACxF,4DAA4B;AAE5B,4EAAyE;AACzE,sEAAmE;AACnE,8EAA2E;AAC3E,wEAAqE;AAIrE,sFAAmF;AAKnF,6DAA0D;AAE1D,IAAiB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"LlmSchemaTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmSchemaTransformer.ts"],"names":[],"mappings":";;;;;;AACA,2FAAwF;AACxF,4DAA4B;AAE5B,4EAAyE;AACzE,sEAAmE;AACnE,8EAA2E;AAC3E,wEAAqE;AAIrE,sFAAmF;AAKnF,6DAA0D;AAE1D,IAAiB,oBAAoB,CAmJpC;AAnJD,WAAiB,oBAAoB;IACtB,8BAAS,GAAG,CACvB,KAAsC,EACvB,EAAE;;QACjB,uBAAuB;QACvB,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,UAAU,CAAC,aAAa,0CAAE,MAAM,CAAA;YACzC,MAAM,IAAI,mCAAgB,CAAC;gBACzB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,sBAAsB;aAChC,CAAC,CAAC;QAEL,MAAM,GAAG,GAAY,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAE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AAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK;YACxD,MAAM,IAAI,mCAAgB,CAAC;gBACzB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,sCAAsC,KAAK,CAAC,IAAI,IAAI;aAC9D,CAAC,CAAC;QACL,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC;AACN,CAAC,EAnJgB,oBAAoB,oCAApB,oBAAoB,QAmJpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typia",
|
|
3
|
-
"version": "7.0.0-dev.
|
|
3
|
+
"version": "7.0.0-dev.20241127",
|
|
4
4
|
"description": "Superfast runtime validators with only one line",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://typia.io",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@samchon/openapi": "^2.0.0-dev.
|
|
44
|
+
"@samchon/openapi": "^2.0.0-dev.20241127",
|
|
45
45
|
"commander": "^10.0.0",
|
|
46
46
|
"comment-json": "^4.2.3",
|
|
47
47
|
"inquirer": "^8.2.5",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"rollup": "^4.18.0",
|
|
68
68
|
"suppress-warnings": "^1.0.2",
|
|
69
69
|
"ts-node": "^10.9.2",
|
|
70
|
-
"typescript": "
|
|
70
|
+
"typescript": "~5.6.3"
|
|
71
71
|
},
|
|
72
72
|
"stackblitz": {
|
|
73
73
|
"startCommand": "npm install && npm run test"
|
|
@@ -158,8 +158,13 @@ export namespace TypiaSetupWizard {
|
|
|
158
158
|
"npm" | "pnpm" | "yarn" | "bun" | null
|
|
159
159
|
> => {
|
|
160
160
|
const result: DetectResult | null = await detect({ cwd: process.cwd() });
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
switch (result?.name) {
|
|
162
|
+
case "npm":
|
|
163
|
+
case "deno":
|
|
164
|
+
return null; // NPM case is still selectable & Deno is not supported
|
|
165
|
+
default:
|
|
166
|
+
return result?.name ?? null;
|
|
167
|
+
}
|
|
163
168
|
};
|
|
164
169
|
|
|
165
170
|
const getTypeScriptVersion = async (): Promise<string> => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ILlmApplication } from "@samchon/openapi";
|
|
1
|
+
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import { HttpLlmConverter } from "@samchon/openapi/lib/converters/HttpLlmConverter";
|
|
3
3
|
import { LlmSchemaConverter } from "@samchon/openapi/lib/converters/LlmSchemaConverter";
|
|
4
4
|
|
|
5
|
-
export const _llmApplicationFinalize = <Model extends
|
|
5
|
+
export const _llmApplicationFinalize = <Model extends ILlmSchema.Model>(
|
|
6
6
|
app: ILlmApplication<Model>,
|
|
7
7
|
options?: Partial<Pick<ILlmApplication.IOptions<Model>, "separate">>,
|
|
8
8
|
): void => {
|
package/src/json.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IJsonApplication } from "./schemas/json/IJsonApplication";
|
|
2
1
|
import { IJsonSchemaCollection } from "./schemas/json/IJsonSchemaCollection";
|
|
3
2
|
|
|
4
3
|
import { IValidation } from "./IValidation";
|
|
@@ -15,55 +14,59 @@ import { TypeGuardError } from "./TypeGuardError";
|
|
|
15
14
|
METADATA
|
|
16
15
|
----------------------------------------------------------- */
|
|
17
16
|
/**
|
|
18
|
-
* > You must configure the generic argument `
|
|
17
|
+
* > You must configure the generic argument `Types`.
|
|
19
18
|
*
|
|
20
|
-
*
|
|
19
|
+
* JSON Schemas generator.
|
|
21
20
|
*
|
|
22
|
-
* Creates
|
|
23
|
-
*
|
|
21
|
+
* Creates a JSON schema list which contains both main JSON schemas
|
|
22
|
+
* and components. Note that, all of the named types are stored in the
|
|
23
|
+
* {@link IJsonSchemaCollection.components} property for the `$ref` referencing.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* Also, you can specify the OpenAPI version by configuring the second generic
|
|
26
|
+
* argument `Version`. For reference, the default version is `"3.1"`, and key
|
|
27
|
+
* different of `"3.0"` and `"3.1"` is whether supporting the tuple type or not.
|
|
27
28
|
*
|
|
28
|
-
* @template
|
|
29
|
+
* @template Types Tuple of target types
|
|
29
30
|
* @template Version Version of OpenAPI specification. Default is 3.1
|
|
30
|
-
* @
|
|
31
|
+
* @return JSON schema list
|
|
31
32
|
*
|
|
32
33
|
* @author Jeongho Nam - https://github.com/samchon
|
|
33
34
|
*/
|
|
34
|
-
export function
|
|
35
|
+
export function schemas(): never;
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
|
-
*
|
|
38
|
+
* JSON Schemas generator.
|
|
38
39
|
*
|
|
39
|
-
* Creates
|
|
40
|
-
*
|
|
40
|
+
* Creates a JSON schema list which contains both main JSON schemas
|
|
41
|
+
* and components. Note that, all of the named types are stored in the
|
|
42
|
+
* {@link IJsonSchemaCollection.components} property for the `$ref` referencing.
|
|
41
43
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
+
* Also, you can specify the OpenAPI version by configuring the second generic
|
|
45
|
+
* argument `Version`. For reference, the default version is `"3.1"`, and key
|
|
46
|
+
* different of `"3.0"` and `"3.1"` is whether supporting the tuple type or not.
|
|
44
47
|
*
|
|
45
|
-
* @template
|
|
48
|
+
* @template Types Tuple of target types
|
|
46
49
|
* @template Version Version of OpenAPI specification. Default is 3.1
|
|
47
|
-
* @
|
|
50
|
+
* @return JSON schema list
|
|
48
51
|
*
|
|
49
52
|
* @author Jeongho Nam - https://github.com/samchon
|
|
50
53
|
*/
|
|
51
|
-
export function
|
|
52
|
-
|
|
54
|
+
export function schemas<
|
|
55
|
+
Types extends unknown[],
|
|
53
56
|
Version extends "3.0" | "3.1" = "3.1",
|
|
54
|
-
>():
|
|
57
|
+
>(): IJsonSchemaCollection<Version, Types>;
|
|
55
58
|
|
|
56
59
|
/**
|
|
57
60
|
* @internal
|
|
58
61
|
*/
|
|
59
|
-
export function
|
|
60
|
-
halt("
|
|
62
|
+
export function schemas(): never {
|
|
63
|
+
halt("schemas");
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
/**
|
|
64
67
|
* > You must configure the generic argument `Types`.
|
|
65
68
|
*
|
|
66
|
-
* JSON
|
|
69
|
+
* JSON Schemas generator.
|
|
67
70
|
*
|
|
68
71
|
* Creates a JSON schema list which contains both main JSON schemas
|
|
69
72
|
* and components. Note that, all of the named types are stored in the
|
|
@@ -77,12 +80,15 @@ export function application(): never {
|
|
|
77
80
|
* @template Version Version of OpenAPI specification. Default is 3.1
|
|
78
81
|
* @return JSON schema list
|
|
79
82
|
*
|
|
83
|
+
* @deprcated Use {@link schemas} function instead please.
|
|
84
|
+
* This function would be changed to return {@linkk ILlmApplication} like
|
|
85
|
+
* structure in the future version (maybe next v8 major update).
|
|
80
86
|
* @author Jeongho Nam - https://github.com/samchon
|
|
81
87
|
*/
|
|
82
|
-
export function
|
|
88
|
+
export function application(): never;
|
|
83
89
|
|
|
84
90
|
/**
|
|
85
|
-
* JSON
|
|
91
|
+
* JSON Schemas generator.
|
|
86
92
|
*
|
|
87
93
|
* Creates a JSON schema list which contains both main JSON schemas
|
|
88
94
|
* and components. Note that, all of the named types are stored in the
|
|
@@ -96,9 +102,12 @@ export function schemas(): never;
|
|
|
96
102
|
* @template Version Version of OpenAPI specification. Default is 3.1
|
|
97
103
|
* @return JSON schema list
|
|
98
104
|
*
|
|
105
|
+
* @deprcated Use {@link schemas} function instead please.
|
|
106
|
+
* This function would be changed to return {@linkk ILlmApplication} like
|
|
107
|
+
* structure in the future version (maybe next v8 major update).
|
|
99
108
|
* @author Jeongho Nam - https://github.com/samchon
|
|
100
109
|
*/
|
|
101
|
-
export function
|
|
110
|
+
export function application<
|
|
102
111
|
Types extends unknown[],
|
|
103
112
|
Version extends "3.0" | "3.1" = "3.1",
|
|
104
113
|
>(): IJsonSchemaCollection<Version, Types>;
|
|
@@ -106,10 +115,56 @@ export function schemas<
|
|
|
106
115
|
/**
|
|
107
116
|
* @internal
|
|
108
117
|
*/
|
|
109
|
-
export function
|
|
118
|
+
export function application(): never {
|
|
110
119
|
halt("application");
|
|
111
120
|
}
|
|
112
121
|
|
|
122
|
+
// /**
|
|
123
|
+
// * > You must configure the generic argument `App`.
|
|
124
|
+
// *
|
|
125
|
+
// * TypeScript functions to JSON schema based application schema.
|
|
126
|
+
// *
|
|
127
|
+
// * Creates an application schema collecting the functions' schema based on the
|
|
128
|
+
// * JSON schema specification.
|
|
129
|
+
// *
|
|
130
|
+
// * The default version of the OpenAPI specification is `"3.1"`, but you can
|
|
131
|
+
// * specify the version by configuring the second generic argument `Version`.
|
|
132
|
+
// *
|
|
133
|
+
// * @template App Target class or interface type collecting the functions
|
|
134
|
+
// * @template Version Version of OpenAPI specification. Default is 3.1
|
|
135
|
+
// * @returns Application schema of JSON schema based
|
|
136
|
+
// *
|
|
137
|
+
// * @author Jeongho Nam - https://github.com/samchon
|
|
138
|
+
// */
|
|
139
|
+
// export function application(): never;
|
|
140
|
+
|
|
141
|
+
// /**
|
|
142
|
+
// * TypeScript functions to JSON schema based application schema.
|
|
143
|
+
// *
|
|
144
|
+
// * Creates an application schema collecting the functions' schema based on the
|
|
145
|
+
// * JSON schema specification.
|
|
146
|
+
// *
|
|
147
|
+
// * The default version of the OpenAPI specification is `"3.1"`, but you can
|
|
148
|
+
// * specify the version by configuring the second generic argument `Version`.
|
|
149
|
+
// *
|
|
150
|
+
// * @template App Target class or interface type collecting the functions
|
|
151
|
+
// * @template Version Version of OpenAPI specification. Default is 3.1
|
|
152
|
+
// * @returns Application schema of JSON schema based
|
|
153
|
+
// *
|
|
154
|
+
// * @author Jeongho Nam - https://github.com/samchon
|
|
155
|
+
// */
|
|
156
|
+
// export function application<
|
|
157
|
+
// App extends object,
|
|
158
|
+
// Version extends "3.0" | "3.1" = "3.1",
|
|
159
|
+
// >(): IJsonApplication<Version, App>;
|
|
160
|
+
|
|
161
|
+
// /**
|
|
162
|
+
// * @internal
|
|
163
|
+
// */
|
|
164
|
+
// export function application(): never {
|
|
165
|
+
// halt("application");
|
|
166
|
+
// }
|
|
167
|
+
|
|
113
168
|
/* -----------------------------------------------------------
|
|
114
169
|
PARSE
|
|
115
170
|
----------------------------------------------------------- */
|
package/src/llm.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILlmApplication } from "@samchon/openapi";
|
|
1
|
+
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* > You must configure the generic argument `App`.
|
|
@@ -80,10 +80,7 @@ export function application(
|
|
|
80
80
|
* @reference https://platform.openai.com/docs/guides/function-calling
|
|
81
81
|
* @author Jeongho Nam - https://github.com/samchon
|
|
82
82
|
*/
|
|
83
|
-
export function application<
|
|
84
|
-
App extends object,
|
|
85
|
-
Model extends ILlmApplication.Model,
|
|
86
|
-
>(
|
|
83
|
+
export function application<App extends object, Model extends ILlmSchema.Model>(
|
|
87
84
|
options?: Partial<Pick<ILlmApplication.IOptions<Model>, "separate">>,
|
|
88
85
|
): ILlmApplication<Model>;
|
|
89
86
|
|
|
@@ -148,8 +145,8 @@ export function parameters(): never;
|
|
|
148
145
|
*/
|
|
149
146
|
export function parameters<
|
|
150
147
|
Parameters extends object,
|
|
151
|
-
Model extends
|
|
152
|
-
>():
|
|
148
|
+
Model extends ILlmSchema.Model,
|
|
149
|
+
>(): ILlmSchema.ModelParameters[Model];
|
|
153
150
|
|
|
154
151
|
/**
|
|
155
152
|
* @internal
|
|
@@ -234,14 +231,14 @@ export function schema(): never;
|
|
|
234
231
|
* @reference https://platform.openai.com/docs/guides/function-calling
|
|
235
232
|
* @author Jeongho Nam - https://github.com/samchon
|
|
236
233
|
*/
|
|
237
|
-
export function schema<T, Model extends
|
|
234
|
+
export function schema<T, Model extends ILlmSchema.Model>(
|
|
238
235
|
...$defs: Extract<
|
|
239
|
-
|
|
236
|
+
ILlmSchema.ModelSchema[Model],
|
|
240
237
|
{ $ref: string }
|
|
241
238
|
> extends never
|
|
242
239
|
? []
|
|
243
|
-
: [Record<string,
|
|
244
|
-
):
|
|
240
|
+
: [Record<string, ILlmSchema.ModelSchema[Model]>]
|
|
241
|
+
): ILlmSchema.ModelSchema[Model];
|
|
245
242
|
|
|
246
243
|
/**
|
|
247
244
|
* @internal
|
|
@@ -145,7 +145,9 @@ export class ImportProgrammer {
|
|
|
145
145
|
[...asset.instances.values()].map((ins) =>
|
|
146
146
|
ts.factory.createImportSpecifier(
|
|
147
147
|
ins.type,
|
|
148
|
-
|
|
148
|
+
ins.alias || ins.alias === ins.name
|
|
149
|
+
? ts.factory.createIdentifier(ins.name)
|
|
150
|
+
: undefined,
|
|
149
151
|
ts.factory.createIdentifier(ins.alias ?? ins.name),
|
|
150
152
|
),
|
|
151
153
|
),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MetadataFactory } from "../../factories/MetadataFactory";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { __IJsonApplication } from "../../schemas/json/__IJsonApplication";
|
|
4
4
|
import { IJsDocTagInfo } from "../../schemas/metadata/IJsDocTagInfo";
|
|
5
5
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
6
6
|
import { MetadataFunction } from "../../schemas/metadata/MetadataFunction";
|
|
@@ -60,7 +60,7 @@ export namespace JsonApplicationProgrammer {
|
|
|
60
60
|
export const write = <Version extends "3.0" | "3.1">(props: {
|
|
61
61
|
version: Version;
|
|
62
62
|
metadata: Metadata;
|
|
63
|
-
}):
|
|
63
|
+
}): __IJsonApplication<Version> => {
|
|
64
64
|
const errors: string[] = validate(props.metadata, {
|
|
65
65
|
top: true,
|
|
66
66
|
object: null,
|
|
@@ -76,18 +76,18 @@ export namespace JsonApplicationProgrammer {
|
|
|
76
76
|
|
|
77
77
|
const object: MetadataObjectType = props.metadata.objects[0]!.type;
|
|
78
78
|
const definitions: Metadata[] = [];
|
|
79
|
-
const setters: Array<(schema:
|
|
79
|
+
const setters: Array<(schema: __IJsonApplication.Schema<Version>) => void> =
|
|
80
80
|
[];
|
|
81
81
|
const collect = (
|
|
82
82
|
metadata: Metadata,
|
|
83
|
-
setter: (schema:
|
|
83
|
+
setter: (schema: __IJsonApplication.Schema<Version>) => void,
|
|
84
84
|
): void => {
|
|
85
85
|
definitions.push(metadata);
|
|
86
86
|
setters.push(setter);
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
const functions:
|
|
90
|
-
|
|
89
|
+
const functions: __IJsonApplication.IFunction<
|
|
90
|
+
__IJsonApplication.Schema<Version>
|
|
91
91
|
>[] = object.properties
|
|
92
92
|
.filter(
|
|
93
93
|
(p) =>
|
|
@@ -112,7 +112,7 @@ export namespace JsonApplicationProgrammer {
|
|
|
112
112
|
metadatas: definitions,
|
|
113
113
|
});
|
|
114
114
|
schemas.forEach((s, i) =>
|
|
115
|
-
setters[i]?.(s as
|
|
115
|
+
setters[i]?.(s as __IJsonApplication.Schema<Version>),
|
|
116
116
|
);
|
|
117
117
|
return {
|
|
118
118
|
version: props.version,
|
|
@@ -129,9 +129,9 @@ export namespace JsonApplicationProgrammer {
|
|
|
129
129
|
jsDocTags: IJsDocTagInfo[];
|
|
130
130
|
collect: (
|
|
131
131
|
metadata: Metadata,
|
|
132
|
-
setter: (schema:
|
|
132
|
+
setter: (schema: __IJsonApplication.Schema<Version>) => void,
|
|
133
133
|
) => void;
|
|
134
|
-
}):
|
|
134
|
+
}): __IJsonApplication.IFunction<__IJsonApplication.Schema<Version>> => {
|
|
135
135
|
const deprecated: boolean = props.jsDocTags.some(
|
|
136
136
|
(tag) => tag.name === "deprecated",
|
|
137
137
|
);
|
|
@@ -149,8 +149,8 @@ export namespace JsonApplicationProgrammer {
|
|
|
149
149
|
name: props.name,
|
|
150
150
|
async: props.function.async,
|
|
151
151
|
parameters: props.function.parameters.map((param) => {
|
|
152
|
-
const appParam:
|
|
153
|
-
|
|
152
|
+
const appParam: __IJsonApplication.IParameter<
|
|
153
|
+
__IJsonApplication.Schema<Version>
|
|
154
154
|
> = {
|
|
155
155
|
name: param.name,
|
|
156
156
|
...writeDescription({
|
|
@@ -178,8 +178,8 @@ export namespace JsonApplicationProgrammer {
|
|
|
178
178
|
}),
|
|
179
179
|
output: props.function.output.size()
|
|
180
180
|
? (() => {
|
|
181
|
-
const appOutput:
|
|
182
|
-
|
|
181
|
+
const appOutput: __IJsonApplication.IOutput<
|
|
182
|
+
__IJsonApplication.Schema<Version>
|
|
183
183
|
> = {
|
|
184
184
|
schema: null!,
|
|
185
185
|
required: props.function.output.isRequired(),
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ILlmApplication, OpenApi } from "@samchon/openapi";
|
|
1
|
+
import { ILlmApplication, ILlmSchema, OpenApi } from "@samchon/openapi";
|
|
2
2
|
import { LlmSchemaConverter } from "@samchon/openapi/lib/converters/LlmSchemaConverter";
|
|
3
3
|
import { ILlmFunction } from "@samchon/openapi/lib/structures/ILlmFunction";
|
|
4
4
|
|
|
5
5
|
import { MetadataFactory } from "../../factories/MetadataFactory";
|
|
6
6
|
|
|
7
|
+
import { __IJsonApplication } from "../../schemas/json/__IJsonApplication";
|
|
7
8
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
8
9
|
import { MetadataFunction } from "../../schemas/metadata/MetadataFunction";
|
|
9
10
|
import { MetadataObjectType } from "../../schemas/metadata/MetadataObjectType";
|
|
10
11
|
|
|
11
|
-
import { IJsonApplication } from "../../module";
|
|
12
12
|
import { JsonApplicationProgrammer } from "../json/JsonApplicationProgrammer";
|
|
13
13
|
import { LlmSchemaProgrammer } from "./LlmSchemaProgrammer";
|
|
14
14
|
|
|
15
15
|
export namespace LlmApplicationProgrammer {
|
|
16
|
-
export const validate = (model:
|
|
16
|
+
export const validate = (model: ILlmSchema.Model) => {
|
|
17
17
|
let top: Metadata | undefined;
|
|
18
18
|
return (
|
|
19
19
|
metadata: Metadata,
|
|
@@ -86,7 +86,7 @@ export namespace LlmApplicationProgrammer {
|
|
|
86
86
|
return output;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
export const write = <Model extends
|
|
89
|
+
export const write = <Model extends ILlmSchema.Model>(props: {
|
|
90
90
|
model: Model;
|
|
91
91
|
metadata: Metadata;
|
|
92
92
|
}): ILlmApplication<Model> => {
|
|
@@ -103,7 +103,7 @@ export namespace LlmApplicationProgrammer {
|
|
|
103
103
|
if (errors.length)
|
|
104
104
|
throw new Error("Failed to write LLM application: " + errors.join("\n"));
|
|
105
105
|
|
|
106
|
-
const application:
|
|
106
|
+
const application: __IJsonApplication<"3.1"> =
|
|
107
107
|
JsonApplicationProgrammer.write({
|
|
108
108
|
version: "3.1",
|
|
109
109
|
metadata: props.metadata,
|
|
@@ -124,14 +124,14 @@ export namespace LlmApplicationProgrammer {
|
|
|
124
124
|
};
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
const writeFunction = <Model extends
|
|
127
|
+
const writeFunction = <Model extends ILlmSchema.Model>(props: {
|
|
128
128
|
model: Model;
|
|
129
129
|
components: OpenApi.IComponents;
|
|
130
|
-
function:
|
|
131
|
-
}): ILlmFunction<
|
|
132
|
-
const parameters:
|
|
130
|
+
function: __IJsonApplication.IFunction<OpenApi.IJsonSchema>;
|
|
131
|
+
}): ILlmFunction<Model> => {
|
|
132
|
+
const parameters: ILlmSchema.ModelParameters[Model] =
|
|
133
133
|
writeParameters(props);
|
|
134
|
-
const output:
|
|
134
|
+
const output: ILlmSchema.ModelSchema[Model] | null = writeOutput({
|
|
135
135
|
model: props.model,
|
|
136
136
|
parameters,
|
|
137
137
|
components: props.components,
|
|
@@ -147,7 +147,7 @@ export namespace LlmApplicationProgrammer {
|
|
|
147
147
|
name: props.function.name,
|
|
148
148
|
parameters,
|
|
149
149
|
output: (output ?? undefined) as
|
|
150
|
-
|
|
|
150
|
+
| ILlmSchema.ModelSchema[Model]
|
|
151
151
|
| undefined,
|
|
152
152
|
description: (() => {
|
|
153
153
|
if (
|
|
@@ -168,11 +168,11 @@ export namespace LlmApplicationProgrammer {
|
|
|
168
168
|
};
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
const writeParameters = <Model extends
|
|
171
|
+
const writeParameters = <Model extends ILlmSchema.Model>(props: {
|
|
172
172
|
model: Model;
|
|
173
173
|
components: OpenApi.IComponents;
|
|
174
|
-
function:
|
|
175
|
-
}):
|
|
174
|
+
function: __IJsonApplication.IFunction<OpenApi.IJsonSchema>;
|
|
175
|
+
}): ILlmSchema.ModelParameters[Model] => {
|
|
176
176
|
const schema: OpenApi.IJsonSchema.IObject = {
|
|
177
177
|
type: "object",
|
|
178
178
|
properties: Object.fromEntries(
|
|
@@ -190,31 +190,31 @@ export namespace LlmApplicationProgrammer {
|
|
|
190
190
|
.map((p) => p.name),
|
|
191
191
|
additionalProperties: false,
|
|
192
192
|
};
|
|
193
|
-
const parameters:
|
|
193
|
+
const parameters: ILlmSchema.ModelParameters[Model] | null =
|
|
194
194
|
LlmSchemaConverter.parameters(props.model)({
|
|
195
195
|
config: LlmSchemaConverter.defaultConfig(props.model) as any,
|
|
196
196
|
components: props.components,
|
|
197
197
|
schema,
|
|
198
|
-
}) as
|
|
198
|
+
}) as ILlmSchema.ModelParameters[Model] | null;
|
|
199
199
|
if (parameters === null)
|
|
200
200
|
throw new Error("Failed to write LLM application parameters.");
|
|
201
201
|
return parameters;
|
|
202
202
|
};
|
|
203
203
|
|
|
204
|
-
const writeOutput = <Model extends
|
|
204
|
+
const writeOutput = <Model extends ILlmSchema.Model>(props: {
|
|
205
205
|
model: Model;
|
|
206
|
-
parameters:
|
|
206
|
+
parameters: ILlmSchema.ModelParameters[Model];
|
|
207
207
|
components: OpenApi.IComponents;
|
|
208
208
|
schema: OpenApi.IJsonSchema | null;
|
|
209
|
-
}):
|
|
209
|
+
}): ILlmSchema.ModelSchema[Model] | null => {
|
|
210
210
|
if (props.schema === null) return null;
|
|
211
|
-
const output:
|
|
211
|
+
const output: ILlmSchema.ModelSchema[Model] | null =
|
|
212
212
|
LlmSchemaConverter.schema(props.model)({
|
|
213
213
|
config: LlmSchemaConverter.defaultConfig(props.model) as any,
|
|
214
214
|
components: props.components,
|
|
215
215
|
schema: props.schema,
|
|
216
216
|
$defs: (props.parameters as any).$defs,
|
|
217
|
-
}) as
|
|
217
|
+
}) as ILlmSchema.ModelSchema[Model] | null;
|
|
218
218
|
if (output === null)
|
|
219
219
|
throw new Error("Failed to write LLM application output.");
|
|
220
220
|
return output;
|