typia 7.0.0-dev.20241023 → 7.0.0-dev.20241111
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/factories/MetadataCollection.js +8 -8
- package/lib/factories/MetadataCollection.js.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/internal/_llmApplicationFinalize.d.ts +1 -1
- package/lib/internal/_llmApplicationFinalize.js +5 -3
- package/lib/internal/_llmApplicationFinalize.js.map +1 -1
- package/lib/llm.d.ts +8 -4
- package/lib/llm.js.map +1 -1
- package/lib/programmers/internal/json_schema_array.js +9 -6
- package/lib/programmers/internal/json_schema_array.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.d.ts +5 -2
- package/lib/programmers/llm/LlmApplicationProgrammer.js +12 -6
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.d.ts +6 -3
- package/lib/programmers/llm/LlmSchemaProgrammer.js +72 -38
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/transformers/features/llm/LlmApplicationTransformer.js +42 -2
- package/lib/transformers/features/llm/LlmApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmSchemaTransformer.js +42 -2
- package/lib/transformers/features/llm/LlmSchemaTransformer.js.map +1 -1
- package/package.json +2 -2
- package/src/factories/MetadataCollection.ts +8 -8
- package/src/internal/_llmApplicationFinalize.ts +8 -7
- package/src/llm.ts +18 -6
- package/src/programmers/internal/json_schema_array.ts +9 -5
- package/src/programmers/llm/LlmApplicationProgrammer.ts +33 -18
- package/src/programmers/llm/LlmSchemaProgrammer.ts +61 -40
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +53 -2
- package/src/transformers/features/llm/LlmSchemaTransformer.ts +54 -3
|
@@ -50,6 +50,19 @@ var LlmApplicationTransformer;
|
|
|
50
50
|
var top = props.expression.typeArguments[0];
|
|
51
51
|
if (typescript_1.default.isTypeNode(top) === false)
|
|
52
52
|
return props.expression;
|
|
53
|
+
// GET MODEL
|
|
54
|
+
var model = get_parameter({
|
|
55
|
+
checker: props.context.checker,
|
|
56
|
+
name: "Model",
|
|
57
|
+
is: function (value) {
|
|
58
|
+
return value === "3.1" ||
|
|
59
|
+
value === "3.0" ||
|
|
60
|
+
value === "chatgpt" ||
|
|
61
|
+
value === "gemini";
|
|
62
|
+
},
|
|
63
|
+
cast: function (value) { return value; },
|
|
64
|
+
default: function () { return "3.1"; },
|
|
65
|
+
})(props.expression.typeArguments[1]);
|
|
53
66
|
// GET TYPE
|
|
54
67
|
var type = props.context.checker.getTypeFromTypeNode(top);
|
|
55
68
|
var collection = new MetadataCollection_1.MetadataCollection({
|
|
@@ -63,7 +76,7 @@ var LlmApplicationTransformer;
|
|
|
63
76
|
constant: true,
|
|
64
77
|
absorb: false,
|
|
65
78
|
functional: true,
|
|
66
|
-
validate: LlmApplicationProgrammer_1.LlmApplicationProgrammer.validate(),
|
|
79
|
+
validate: LlmApplicationProgrammer_1.LlmApplicationProgrammer.validate(model),
|
|
67
80
|
},
|
|
68
81
|
collection: collection,
|
|
69
82
|
type: type,
|
|
@@ -74,7 +87,10 @@ var LlmApplicationTransformer;
|
|
|
74
87
|
errors: result.errors,
|
|
75
88
|
});
|
|
76
89
|
// GENERATE LLM APPLICATION
|
|
77
|
-
var schema = LlmApplicationProgrammer_1.LlmApplicationProgrammer.write(
|
|
90
|
+
var schema = LlmApplicationProgrammer_1.LlmApplicationProgrammer.write({
|
|
91
|
+
model: model,
|
|
92
|
+
metadata: result.data,
|
|
93
|
+
});
|
|
78
94
|
var literal = LiteralFactory_1.LiteralFactory.write(schema);
|
|
79
95
|
if (!((_b = props.expression.arguments) === null || _b === void 0 ? void 0 : _b[0]))
|
|
80
96
|
return literal;
|
|
@@ -91,5 +107,29 @@ var LlmApplicationTransformer;
|
|
|
91
107
|
typescript_1.default.factory.createReturnStatement(typescript_1.default.factory.createIdentifier("app")),
|
|
92
108
|
], true));
|
|
93
109
|
};
|
|
110
|
+
var get_parameter = function (props) {
|
|
111
|
+
return function (node) {
|
|
112
|
+
if (!node)
|
|
113
|
+
return props.default();
|
|
114
|
+
// CHECK LITERAL TYPE
|
|
115
|
+
var type = props.checker.getTypeFromTypeNode(node);
|
|
116
|
+
if (!type.isLiteral() &&
|
|
117
|
+
(type.getFlags() & typescript_1.default.TypeFlags.BooleanLiteral) === 0)
|
|
118
|
+
throw new TransformerError_1.TransformerError({
|
|
119
|
+
code: "typia.llm.application",
|
|
120
|
+
message: "generic argument \"".concat(props.name, "\" must be constant."),
|
|
121
|
+
});
|
|
122
|
+
// GET VALUE AND VALIDATE IT
|
|
123
|
+
var value = type.isLiteral()
|
|
124
|
+
? type.value
|
|
125
|
+
: props.checker.typeToString(type);
|
|
126
|
+
if (typeof value !== "string" || props.is(value) === false)
|
|
127
|
+
throw new TransformerError_1.TransformerError({
|
|
128
|
+
code: "typia.llm.application",
|
|
129
|
+
message: "invalid value on generic argument \"".concat(props.name, "\"."),
|
|
130
|
+
});
|
|
131
|
+
return props.cast(value);
|
|
132
|
+
};
|
|
133
|
+
};
|
|
94
134
|
})(LlmApplicationTransformer || (exports.LlmApplicationTransformer = LlmApplicationTransformer = {}));
|
|
95
135
|
//# sourceMappingURL=LlmApplicationTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmApplicationTransformer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0DAA4B;AAE5B,0EAAyE;AACzE,oEAAmE;AACnE,4EAA2E;AAC3E,sEAAqE;AACrE,wEAAuE;AAIvE,8FAA6F;AAK7F,2DAA0D;AAE1D,IAAiB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"LlmApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmApplicationTransformer.ts"],"names":[],"mappings":";;;;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,MAAM,IAAI,mCAAgB,CAAC;oBACzB,IAAI,EAAE,uBAAuB;oBAC7B,OAAO,EAAE,8CAAsC,KAAK,CAAC,IAAI,QAAI;iBAC9D,CAAC,CAAC;YACL,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IAxBD,CAwBC,CAAC;AACN,CAAC,EAtHgB,yBAAyB,yCAAzB,yBAAyB,QAsHzC"}
|
|
@@ -23,6 +23,19 @@ var LlmSchemaTransformer;
|
|
|
23
23
|
var top = props.expression.typeArguments[0];
|
|
24
24
|
if (typescript_1.default.isTypeNode(top) === false)
|
|
25
25
|
return props.expression;
|
|
26
|
+
// GET MODEL
|
|
27
|
+
var model = get_parameter({
|
|
28
|
+
checker: props.context.checker,
|
|
29
|
+
name: "Model",
|
|
30
|
+
is: function (value) {
|
|
31
|
+
return value === "3.1" ||
|
|
32
|
+
value === "3.0" ||
|
|
33
|
+
value === "chatgpt" ||
|
|
34
|
+
value === "gemini";
|
|
35
|
+
},
|
|
36
|
+
cast: function (value) { return value; },
|
|
37
|
+
default: function () { return "3.1"; },
|
|
38
|
+
})(props.expression.typeArguments[1]);
|
|
26
39
|
// GET TYPE
|
|
27
40
|
var type = props.context.checker.getTypeFromTypeNode(top);
|
|
28
41
|
var collection = new MetadataCollection_1.MetadataCollection({
|
|
@@ -35,7 +48,7 @@ var LlmSchemaTransformer;
|
|
|
35
48
|
escape: true,
|
|
36
49
|
constant: true,
|
|
37
50
|
absorb: false,
|
|
38
|
-
validate: LlmSchemaProgrammer_1.LlmSchemaProgrammer.validate,
|
|
51
|
+
validate: LlmSchemaProgrammer_1.LlmSchemaProgrammer.validate(model),
|
|
39
52
|
},
|
|
40
53
|
collection: collection,
|
|
41
54
|
type: type,
|
|
@@ -46,8 +59,35 @@ var LlmSchemaTransformer;
|
|
|
46
59
|
errors: result.errors,
|
|
47
60
|
});
|
|
48
61
|
// GENERATE LLM SCHEMA
|
|
49
|
-
var schema = LlmSchemaProgrammer_1.LlmSchemaProgrammer.write(
|
|
62
|
+
var schema = LlmSchemaProgrammer_1.LlmSchemaProgrammer.write({
|
|
63
|
+
model: model,
|
|
64
|
+
metadata: result.data,
|
|
65
|
+
});
|
|
50
66
|
return LiteralFactory_1.LiteralFactory.write(schema);
|
|
51
67
|
};
|
|
68
|
+
var get_parameter = function (props) {
|
|
69
|
+
return function (node) {
|
|
70
|
+
if (!node)
|
|
71
|
+
return props.default();
|
|
72
|
+
// CHECK LITERAL TYPE
|
|
73
|
+
var type = props.checker.getTypeFromTypeNode(node);
|
|
74
|
+
if (!type.isLiteral() &&
|
|
75
|
+
(type.getFlags() & typescript_1.default.TypeFlags.BooleanLiteral) === 0)
|
|
76
|
+
throw new TransformerError_1.TransformerError({
|
|
77
|
+
code: "typia.llm.schema",
|
|
78
|
+
message: "generic argument \"".concat(props.name, "\" must be constant."),
|
|
79
|
+
});
|
|
80
|
+
// GET VALUE AND VALIDATE IT
|
|
81
|
+
var value = type.isLiteral()
|
|
82
|
+
? type.value
|
|
83
|
+
: props.checker.typeToString(type);
|
|
84
|
+
if (typeof value !== "string" || props.is(value) === false)
|
|
85
|
+
throw new TransformerError_1.TransformerError({
|
|
86
|
+
code: "typia.llm.schema",
|
|
87
|
+
message: "invalid value on generic argument \"".concat(props.name, "\"."),
|
|
88
|
+
});
|
|
89
|
+
return props.cast(value);
|
|
90
|
+
};
|
|
91
|
+
};
|
|
52
92
|
})(LlmSchemaTransformer || (exports.LlmSchemaTransformer = LlmSchemaTransformer = {}));
|
|
53
93
|
//# sourceMappingURL=LlmSchemaTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmSchemaTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmSchemaTransformer.ts"],"names":[],"mappings":";;;;;;AACA,0DAA4B;AAE5B,oEAAmE;AACnE,4EAA2E;AAC3E,sEAAqE;AAIrE,oFAAmF;AAKnF,2DAA0D;AAE1D,IAAiB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"LlmSchemaTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmSchemaTransformer.ts"],"names":[],"mappings":";;;;;;AACA,0DAA4B;AAE5B,oEAAmE;AACnE,4EAA2E;AAC3E,sEAAqE;AAIrE,oFAAmF;AAKnF,2DAA0D;AAE1D,IAAiB,oBAAoB,CA6FpC;AA7FD,WAAiB,oBAAoB;IACtB,8BAAS,GAAG,UACvB,KAAsC;;QAEtC,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,IAAM,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,IAAM,KAAK,GAA0B,aAAa,CAAwB;YACxE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO;YAC9B,IAAI,EAAE,OAAO;YACb,EAAE,EAAE,UAAC,KAAK;gBACR,OAAA,KAAK,KAAK,KAAK;oBACf,KAAK,KAAK,KAAK;oBACf,KAAK,KAAK,SAAS;oBACnB,KAAK,KAAK,QAAQ;YAHlB,CAGkB;YACpB,IAAI,EAAE,UAAC,KAAK,IAAK,OAAA,KAA8B,EAA9B,CAA8B;YAC/C,OAAO,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK;SACrB,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtC,WAAW;QACX,IAAM,IAAI,GAAY,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC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oBACzB,IAAI,EAAE,kBAAkB;oBACxB,OAAO,EAAE,6BAAqB,KAAK,CAAC,IAAI,yBAAqB;iBAC9D,CAAC,CAAC;YAEL,4BAA4B;YAC5B,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE;gBAC5B,CAAC,CAAC,IAAI,CAAC,KAAK;gBACZ,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK;gBACxD,MAAM,IAAI,mCAAgB,CAAC;oBACzB,IAAI,EAAE,kBAAkB;oBACxB,OAAO,EAAE,8CAAsC,KAAK,CAAC,IAAI,QAAI;iBAC9D,CAAC,CAAC;YACL,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IAxBD,CAwBC,CAAC;AACN,CAAC,EA7FgB,oBAAoB,oCAApB,oBAAoB,QA6FpC"}
|
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.20241111",
|
|
4
4
|
"description": "Superfast runtime validators with only one line",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"homepage": "https://typia.io",
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@samchon/openapi": "
|
|
71
|
+
"@samchon/openapi": "2.0.0-dev.20241111",
|
|
72
72
|
"commander": "^10.0.0",
|
|
73
73
|
"comment-json": "^4.2.3",
|
|
74
74
|
"inquirer": "^8.2.5",
|
|
@@ -123,9 +123,9 @@ export class MetadataCollection {
|
|
|
123
123
|
const oldbie = this.objects_.get(type);
|
|
124
124
|
if (oldbie !== undefined) return [oldbie, false];
|
|
125
125
|
|
|
126
|
-
const
|
|
126
|
+
const id: string = this.getName(checker, type);
|
|
127
127
|
const obj: MetadataObjectType = MetadataObjectType.create({
|
|
128
|
-
name:
|
|
128
|
+
name: id,
|
|
129
129
|
properties: [],
|
|
130
130
|
description:
|
|
131
131
|
(type.aliasSymbol && CommentFactory.description(type.aliasSymbol)) ??
|
|
@@ -150,9 +150,9 @@ export class MetadataCollection {
|
|
|
150
150
|
const oldbie = this.aliases_.get(type);
|
|
151
151
|
if (oldbie !== undefined) return [oldbie, false, () => {}];
|
|
152
152
|
|
|
153
|
-
const
|
|
153
|
+
const id: string = this.getName(checker, type);
|
|
154
154
|
const alias: MetadataAliasType = MetadataAliasType.create({
|
|
155
|
-
name:
|
|
155
|
+
name: id,
|
|
156
156
|
value: null!,
|
|
157
157
|
description: CommentFactory.description(symbol) ?? null,
|
|
158
158
|
recursive: null!,
|
|
@@ -170,9 +170,9 @@ export class MetadataCollection {
|
|
|
170
170
|
const oldbie = this.arrays_.get(type);
|
|
171
171
|
if (oldbie !== undefined) return [oldbie, false, () => {}];
|
|
172
172
|
|
|
173
|
-
const
|
|
173
|
+
const id = this.getName(checker, type);
|
|
174
174
|
const array: MetadataArrayType = MetadataArrayType.create({
|
|
175
|
-
name:
|
|
175
|
+
name: id,
|
|
176
176
|
value: null!,
|
|
177
177
|
index: null,
|
|
178
178
|
recursive: null!,
|
|
@@ -189,9 +189,9 @@ export class MetadataCollection {
|
|
|
189
189
|
const oldbie = this.tuples_.get(type);
|
|
190
190
|
if (oldbie !== undefined) return [oldbie, false, () => {}];
|
|
191
191
|
|
|
192
|
-
const
|
|
192
|
+
const id = this.getName(checker, type);
|
|
193
193
|
const tuple: MetadataTupleType = MetadataTupleType.create({
|
|
194
|
-
name:
|
|
194
|
+
name: id,
|
|
195
195
|
elements: null!,
|
|
196
196
|
index: null,
|
|
197
197
|
recursive: null!,
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { ILlmApplication } from "@samchon/openapi";
|
|
2
|
+
import { HttpLlmConverter } from "@samchon/openapi/lib/converters/HttpLlmConverter";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
app: ILlmApplication,
|
|
7
|
-
options?: ILlmApplication.IOptions,
|
|
4
|
+
export const _llmApplicationFinalize = <Model extends ILlmApplication.Model>(
|
|
5
|
+
app: ILlmApplication<Model>,
|
|
6
|
+
options?: ILlmApplication.IOptions<Model>,
|
|
8
7
|
): void => {
|
|
9
8
|
app.options = {
|
|
10
9
|
separate: options?.separate ?? null,
|
|
10
|
+
recursive: app.model === "chatgpt" ? undefined : (3 as any),
|
|
11
11
|
};
|
|
12
12
|
if (app.options.separate === null) return;
|
|
13
13
|
for (const func of app.functions)
|
|
14
|
-
func.separated =
|
|
14
|
+
func.separated = HttpLlmConverter.separateParameters({
|
|
15
|
+
model: app.model,
|
|
15
16
|
parameters: func.parameters,
|
|
16
|
-
|
|
17
|
+
predicate: app.options.separate,
|
|
17
18
|
});
|
|
18
19
|
};
|
package/src/llm.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILlmApplication
|
|
1
|
+
import { ILlmApplication } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* > You must configure the generic argument `App`.
|
|
@@ -33,12 +33,15 @@ import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
|
33
33
|
* before the actual LLM function call execution.
|
|
34
34
|
*
|
|
35
35
|
* @template App Target class or interface type collecting the functions to call
|
|
36
|
+
* @template Model LLM schema model
|
|
36
37
|
* @param options Options for the LLM application construction
|
|
37
38
|
* @returns Application of LLM function calling schemas
|
|
38
39
|
* @reference https://platform.openai.com/docs/guides/function-calling
|
|
39
40
|
* @author Jeongho Nam - https://github.com/samchon
|
|
40
41
|
*/
|
|
41
|
-
export function application(
|
|
42
|
+
export function application(
|
|
43
|
+
options?: Partial<Omit<ILlmApplication.IOptions<any>, "recursive">>,
|
|
44
|
+
): never;
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
47
|
* TypeScript functions to LLM function calling application.
|
|
@@ -71,14 +74,18 @@ export function application(options?: ILlmApplication.IOptions): never;
|
|
|
71
74
|
* before the actual LLM function call execution.
|
|
72
75
|
*
|
|
73
76
|
* @template App Target class or interface type collecting the functions to call
|
|
77
|
+
* @template Model LLM schema model
|
|
74
78
|
* @param options Options for the LLM application construction
|
|
75
79
|
* @returns Application of LLM function calling schemas
|
|
76
80
|
* @reference https://platform.openai.com/docs/guides/function-calling
|
|
77
81
|
* @author Jeongho Nam - https://github.com/samchon
|
|
78
82
|
*/
|
|
79
|
-
export function application<
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
export function application<
|
|
84
|
+
App extends object,
|
|
85
|
+
Model extends ILlmApplication.Model = "3.1",
|
|
86
|
+
>(
|
|
87
|
+
options?: Partial<Omit<ILlmApplication.IOptions<Model>, "recursive">>,
|
|
88
|
+
): ILlmApplication<Model>;
|
|
82
89
|
|
|
83
90
|
/**
|
|
84
91
|
* @internal
|
|
@@ -119,6 +126,7 @@ export function application(): never {
|
|
|
119
126
|
* > LLM will continue the next conversation based on the return value.
|
|
120
127
|
*
|
|
121
128
|
* @template T Target type
|
|
129
|
+
* @template Model LLM schema model
|
|
122
130
|
* @returns LLM schema
|
|
123
131
|
* @reference https://platform.openai.com/docs/guides/function-calling
|
|
124
132
|
* @author Jeongho Nam - https://github.com/samchon
|
|
@@ -155,11 +163,15 @@ export function schema(): never;
|
|
|
155
163
|
* > LLM will continue the next conversation based on the return value.
|
|
156
164
|
*
|
|
157
165
|
* @template T Target type
|
|
166
|
+
* @template Model LLM schema model
|
|
158
167
|
* @returns LLM schema
|
|
159
168
|
* @reference https://platform.openai.com/docs/guides/function-calling
|
|
160
169
|
* @author Jeongho Nam - https://github.com/samchon
|
|
161
170
|
*/
|
|
162
|
-
export function schema<
|
|
171
|
+
export function schema<
|
|
172
|
+
T,
|
|
173
|
+
Model extends ILlmApplication.Model = "3.1",
|
|
174
|
+
>(): ILlmApplication.ModelSchema[Model];
|
|
163
175
|
|
|
164
176
|
/**
|
|
165
177
|
* @internal
|
|
@@ -23,16 +23,20 @@ export const json_schema_array = (props: {
|
|
|
23
23
|
tags: props.array.tags,
|
|
24
24
|
});
|
|
25
25
|
if (props.array.type.recursive === true) {
|
|
26
|
-
const out = () => [
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const out = () => [
|
|
27
|
+
{
|
|
28
|
+
$ref: `#/components/schemas/${props.array.type.name}`,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
if (props.components.schemas?.[props.array.type.name] !== undefined)
|
|
32
|
+
return out();
|
|
29
33
|
|
|
30
34
|
props.components.schemas ??= {};
|
|
31
|
-
props.components.schemas[
|
|
35
|
+
props.components.schemas[props.array.type.name] ??= {};
|
|
32
36
|
|
|
33
37
|
const oneOf: OpenApi.IJsonSchema.IArray[] = factory();
|
|
34
38
|
Object.assign(
|
|
35
|
-
props.components.schemas[
|
|
39
|
+
props.components.schemas[props.array.type.name]!,
|
|
36
40
|
oneOf.length === 1 ? oneOf[0] : { oneOf },
|
|
37
41
|
);
|
|
38
42
|
return out();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILlmApplication
|
|
1
|
+
import { ILlmApplication } from "@samchon/openapi";
|
|
2
2
|
import { ILlmFunction } from "@samchon/openapi/lib/structures/ILlmFunction";
|
|
3
3
|
|
|
4
4
|
import { MetadataFactory } from "../../factories/MetadataFactory";
|
|
@@ -11,7 +11,7 @@ import { MetadataObjectType } from "../../schemas/metadata/MetadataObjectType";
|
|
|
11
11
|
import { LlmSchemaProgrammer } from "./LlmSchemaProgrammer";
|
|
12
12
|
|
|
13
13
|
export namespace LlmApplicationProgrammer {
|
|
14
|
-
export const validate = () => {
|
|
14
|
+
export const validate = (model: ILlmApplication.Model) => {
|
|
15
15
|
let top: Metadata | undefined;
|
|
16
16
|
return (
|
|
17
17
|
metadata: Metadata,
|
|
@@ -28,7 +28,7 @@ export namespace LlmApplicationProgrammer {
|
|
|
28
28
|
metadata.functions.length === 1
|
|
29
29
|
)
|
|
30
30
|
return validateFunction(metadata.functions[0]!);
|
|
31
|
-
else return LlmSchemaProgrammer.validate(metadata);
|
|
31
|
+
else return LlmSchemaProgrammer.validate(model)(metadata);
|
|
32
32
|
|
|
33
33
|
const output: string[] = [];
|
|
34
34
|
const valid: boolean =
|
|
@@ -84,8 +84,11 @@ export namespace LlmApplicationProgrammer {
|
|
|
84
84
|
return output;
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
export const write =
|
|
88
|
-
|
|
87
|
+
export const write = <Model extends ILlmApplication.Model>(props: {
|
|
88
|
+
model: Model;
|
|
89
|
+
metadata: Metadata;
|
|
90
|
+
}): ILlmApplication<Model> => {
|
|
91
|
+
const errors: string[] = validate(props.model)(props.metadata, {
|
|
89
92
|
top: true,
|
|
90
93
|
object: null,
|
|
91
94
|
property: null,
|
|
@@ -98,8 +101,9 @@ export namespace LlmApplicationProgrammer {
|
|
|
98
101
|
if (errors.length)
|
|
99
102
|
throw new Error("Failed to write LLM application: " + errors.join("\n"));
|
|
100
103
|
|
|
101
|
-
const object: MetadataObjectType = metadata.objects[0]!.type;
|
|
104
|
+
const object: MetadataObjectType = props.metadata.objects[0]!.type;
|
|
102
105
|
return {
|
|
106
|
+
model: props.model,
|
|
103
107
|
functions: object.properties
|
|
104
108
|
.filter(
|
|
105
109
|
(p) =>
|
|
@@ -112,6 +116,7 @@ export namespace LlmApplicationProgrammer {
|
|
|
112
116
|
)
|
|
113
117
|
.map((p) =>
|
|
114
118
|
writeFunction({
|
|
119
|
+
model: props.model,
|
|
115
120
|
name: p.key.getSoleLiteral()!,
|
|
116
121
|
function: p.value.functions[0]!,
|
|
117
122
|
description: p.description,
|
|
@@ -120,16 +125,18 @@ export namespace LlmApplicationProgrammer {
|
|
|
120
125
|
),
|
|
121
126
|
options: {
|
|
122
127
|
separate: null,
|
|
128
|
+
recursive: props.model === "chatgpt" ? undefined : (3 as any),
|
|
123
129
|
},
|
|
124
130
|
};
|
|
125
131
|
};
|
|
126
132
|
|
|
127
|
-
const writeFunction = (props: {
|
|
133
|
+
const writeFunction = <Model extends ILlmApplication.Model>(props: {
|
|
134
|
+
model: Model;
|
|
128
135
|
name: string;
|
|
129
136
|
function: MetadataFunction;
|
|
130
137
|
description: string | null;
|
|
131
138
|
jsDocTags: IJsDocTagInfo[];
|
|
132
|
-
}): ILlmFunction => {
|
|
139
|
+
}): ILlmFunction<ILlmApplication.ModelSchema[Model]> => {
|
|
133
140
|
const deprecated: boolean = props.jsDocTags.some(
|
|
134
141
|
(tag) => tag.name === "deprecated",
|
|
135
142
|
);
|
|
@@ -154,6 +161,7 @@ export namespace LlmApplicationProgrammer {
|
|
|
154
161
|
},
|
|
155
162
|
);
|
|
156
163
|
return writeSchema({
|
|
164
|
+
model: props.model,
|
|
157
165
|
metadata: p.type,
|
|
158
166
|
description: jsDocTagDescription ?? p.description,
|
|
159
167
|
jsDocTags: jsDocTagDescription ? [] : p.jsDocTags,
|
|
@@ -162,6 +170,7 @@ export namespace LlmApplicationProgrammer {
|
|
|
162
170
|
output:
|
|
163
171
|
props.function.output.size() || props.function.output.nullable
|
|
164
172
|
? writeSchema({
|
|
173
|
+
model: props.model,
|
|
165
174
|
metadata: props.function.output,
|
|
166
175
|
description:
|
|
167
176
|
writeDescriptionFromJsDocTag({
|
|
@@ -181,17 +190,22 @@ export namespace LlmApplicationProgrammer {
|
|
|
181
190
|
};
|
|
182
191
|
};
|
|
183
192
|
|
|
184
|
-
const writeSchema = (props: {
|
|
193
|
+
const writeSchema = <Model extends ILlmApplication.Model>(props: {
|
|
194
|
+
model: Model;
|
|
185
195
|
metadata: Metadata;
|
|
186
196
|
description: string | null;
|
|
187
197
|
jsDocTags: IJsDocTagInfo[];
|
|
188
|
-
}):
|
|
189
|
-
const schema:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
198
|
+
}): ILlmApplication.ModelSchema[Model] => {
|
|
199
|
+
const schema: ILlmApplication.ModelSchema[Model] =
|
|
200
|
+
LlmSchemaProgrammer.write(props);
|
|
201
|
+
const explicit: Pick<
|
|
202
|
+
ILlmApplication.ModelSchema[Model],
|
|
203
|
+
"title" | "description"
|
|
204
|
+
> = writeDescription({
|
|
205
|
+
model: props.model,
|
|
206
|
+
description: props.description,
|
|
207
|
+
jsDocTags: props.jsDocTags,
|
|
208
|
+
});
|
|
195
209
|
return {
|
|
196
210
|
...schema,
|
|
197
211
|
...(!!explicit.title?.length || !!explicit.description?.length
|
|
@@ -200,10 +214,11 @@ export namespace LlmApplicationProgrammer {
|
|
|
200
214
|
};
|
|
201
215
|
};
|
|
202
216
|
|
|
203
|
-
const writeDescription = (props: {
|
|
217
|
+
const writeDescription = <Model extends ILlmApplication.Model>(props: {
|
|
218
|
+
model: Model;
|
|
204
219
|
description: string | null;
|
|
205
220
|
jsDocTags: IJsDocTagInfo[];
|
|
206
|
-
}): Pick<
|
|
221
|
+
}): Pick<ILlmApplication.ModelSchema[Model], "title" | "description"> => {
|
|
207
222
|
const title: string | undefined = (() => {
|
|
208
223
|
const [explicit] = getJsDocTexts({
|
|
209
224
|
jsDocTags: props.jsDocTags,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ILlmApplication } from "@samchon/openapi";
|
|
2
2
|
import { HttpLlmConverter } from "@samchon/openapi/lib/converters/HttpLlmConverter";
|
|
3
|
+
import { OpenApiV3Converter } from "@samchon/openapi/lib/converters/OpenApiV3Converter";
|
|
3
4
|
|
|
4
5
|
import { IJsonSchemaCollection } from "../../schemas/json/IJsonSchemaCollection";
|
|
5
6
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
@@ -8,52 +9,72 @@ import { AtomicPredicator } from "../helpers/AtomicPredicator";
|
|
|
8
9
|
import { JsonSchemasProgrammer } from "../json/JsonSchemasProgrammer";
|
|
9
10
|
|
|
10
11
|
export namespace LlmSchemaProgrammer {
|
|
11
|
-
export const validate =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
metadata.constants.some((c) => c.type === "bigint")
|
|
16
|
-
)
|
|
17
|
-
output.push("LLM schema does not support bigint type.");
|
|
18
|
-
if (
|
|
19
|
-
metadata.tuples.some((t) =>
|
|
20
|
-
t.type.elements.some((e) => e.isRequired() === false),
|
|
21
|
-
) ||
|
|
22
|
-
metadata.arrays.some((a) => a.type.value.isRequired() === false)
|
|
23
|
-
)
|
|
24
|
-
output.push("LLM schema does not support undefined type in array.");
|
|
25
|
-
if (metadata.maps.length)
|
|
26
|
-
output.push("LLM schema does not support Map type.");
|
|
27
|
-
if (metadata.sets.length)
|
|
28
|
-
output.push("LLM schema does not support Set type.");
|
|
29
|
-
for (const native of metadata.natives)
|
|
12
|
+
export const validate =
|
|
13
|
+
(model: ILlmApplication.Model) =>
|
|
14
|
+
(metadata: Metadata): string[] => {
|
|
15
|
+
const output: string[] = [];
|
|
30
16
|
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
native.name !== "Blob" &&
|
|
34
|
-
native.name !== "File"
|
|
17
|
+
metadata.atomics.some((a) => a.type === "bigint") ||
|
|
18
|
+
metadata.constants.some((c) => c.type === "bigint")
|
|
35
19
|
)
|
|
36
|
-
output.push(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
20
|
+
output.push("LLM schema does not support bigint type.");
|
|
21
|
+
if (
|
|
22
|
+
metadata.tuples.some((t) =>
|
|
23
|
+
t.type.elements.some((e) => e.isRequired() === false),
|
|
24
|
+
) ||
|
|
25
|
+
metadata.arrays.some((a) => a.type.value.isRequired() === false)
|
|
26
|
+
)
|
|
27
|
+
output.push("LLM schema does not support undefined type in array.");
|
|
28
|
+
if (metadata.maps.length)
|
|
29
|
+
output.push("LLM schema does not support Map type.");
|
|
30
|
+
if (metadata.sets.length)
|
|
31
|
+
output.push("LLM schema does not support Set type.");
|
|
32
|
+
for (const native of metadata.natives)
|
|
33
|
+
if (
|
|
34
|
+
AtomicPredicator.native(native.name) === false &&
|
|
35
|
+
native.name !== "Date" &&
|
|
36
|
+
native.name !== "Blob" &&
|
|
37
|
+
native.name !== "File"
|
|
38
|
+
)
|
|
39
|
+
output.push(`LLM schema does not support ${native.name} type.`);
|
|
40
|
+
if (model === "gemini") {
|
|
41
|
+
try {
|
|
42
|
+
const {
|
|
43
|
+
schemas: [schema],
|
|
44
|
+
} = JsonSchemasProgrammer.write({
|
|
45
|
+
version: "3.0",
|
|
46
|
+
metadatas: [metadata],
|
|
47
|
+
});
|
|
48
|
+
if (OpenApiV3Converter.TypeChecker.isOneOf(schema!))
|
|
49
|
+
output.push("Gemini model does not support the union type.");
|
|
50
|
+
} catch {}
|
|
51
|
+
}
|
|
52
|
+
// if (
|
|
53
|
+
// metadata.aliases.some((a) => a.type.recursive) ||
|
|
54
|
+
// metadata.arrays.some((a) => a.type.recursive) ||
|
|
55
|
+
// metadata.objects.some((o) => o.type.recursive) ||
|
|
56
|
+
// metadata.tuples.some((t) => t.type.recursive)
|
|
57
|
+
// )
|
|
58
|
+
// output.push("LLM schema does not support recursive type.");
|
|
59
|
+
return output;
|
|
60
|
+
};
|
|
46
61
|
|
|
47
|
-
export const write = (
|
|
62
|
+
export const write = <Model extends ILlmApplication.Model>(props: {
|
|
63
|
+
model: Model;
|
|
64
|
+
metadata: Metadata;
|
|
65
|
+
}): ILlmApplication.ModelSchema[Model] => {
|
|
48
66
|
const collection: IJsonSchemaCollection<"3.1"> =
|
|
49
67
|
JsonSchemasProgrammer.write({
|
|
50
68
|
version: "3.1",
|
|
51
|
-
metadatas: [metadata],
|
|
69
|
+
metadatas: [props.metadata],
|
|
70
|
+
});
|
|
71
|
+
const schema: ILlmApplication.ModelSchema[Model] | null =
|
|
72
|
+
HttpLlmConverter.schema({
|
|
73
|
+
model: props.model,
|
|
74
|
+
components: collection.components,
|
|
75
|
+
schema: collection.schemas[0]!,
|
|
76
|
+
recursive: 3,
|
|
52
77
|
});
|
|
53
|
-
const schema: ILlmSchema | null = HttpLlmConverter.schema({
|
|
54
|
-
components: collection.components,
|
|
55
|
-
schema: collection.schemas[0]!,
|
|
56
|
-
});
|
|
57
78
|
if (schema === null)
|
|
58
79
|
throw new Error("Failed to convert JSON schema to LLM schema.");
|
|
59
80
|
return schema;
|