typia 12.0.0-dev.20260310 → 12.0.0-dev.20260312
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/llm.d.ts +51 -1
- package/lib/llm.js +5 -0
- package/lib/llm.js.map +1 -1
- package/lib/llm.mjs +5 -1
- package/lib/llm.mjs.map +1 -1
- package/lib/re-exports.d.ts +1 -1
- package/lib/re-exports.js.map +1 -1
- package/package.json +5 -5
- package/src/llm.ts +480 -408
- package/src/re-exports.ts +34 -33
package/lib/llm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IJsonParseResult, ILlmApplication, ILlmController, ILlmSchema } from "@typia/interface";
|
|
1
|
+
import { IJsonParseResult, ILlmApplication, ILlmController, ILlmSchema, ILlmStructuredOutput } from "@typia/interface";
|
|
2
2
|
/**
|
|
3
3
|
* Creates LLM function calling controller.
|
|
4
4
|
*
|
|
@@ -91,6 +91,56 @@ export declare function application<Class extends Record<string, any>, Config ex
|
|
|
91
91
|
*/
|
|
92
92
|
equals: boolean;
|
|
93
93
|
}> = {}>(config?: Partial<Pick<ILlmApplication.IConfig<Class>, "validate">>): ILlmApplication<Class>;
|
|
94
|
+
/**
|
|
95
|
+
* Creates LLM structured output interface.
|
|
96
|
+
*
|
|
97
|
+
* @danger You must configure the generic argument `T`
|
|
98
|
+
*/
|
|
99
|
+
export declare function structuredOutput(): never;
|
|
100
|
+
/**
|
|
101
|
+
* Creates LLM structured output interface from TypeScript object type.
|
|
102
|
+
*
|
|
103
|
+
* Generates {@link ILlmStructuredOutput} containing everything needed for
|
|
104
|
+
* handling LLM structured outputs: the JSON schema for prompting, and functions
|
|
105
|
+
* for parsing, coercing, and validating responses.
|
|
106
|
+
*
|
|
107
|
+
* Structured outputs allow LLMs to generate data conforming to a predefined
|
|
108
|
+
* schema instead of free-form text. This is useful for:
|
|
109
|
+
*
|
|
110
|
+
* - Extracting structured data from conversations
|
|
111
|
+
* - Generating typed responses for downstream processing
|
|
112
|
+
* - Ensuring consistent output formats across LLM calls
|
|
113
|
+
*
|
|
114
|
+
* Workflow:
|
|
115
|
+
*
|
|
116
|
+
* 1. Pass {@link ILlmStructuredOutput.parameters} schema to LLM provider
|
|
117
|
+
* 2. Receive LLM response (JSON string or pre-parsed object)
|
|
118
|
+
* 3. Use {@link ILlmStructuredOutput.parse} for raw strings or
|
|
119
|
+
* {@link ILlmStructuredOutput.coerce} for pre-parsed objects
|
|
120
|
+
* 4. Use {@link ILlmStructuredOutput.validate} to check the result
|
|
121
|
+
*
|
|
122
|
+
* Related functions:
|
|
123
|
+
*
|
|
124
|
+
* - {@link parameters} — Schema only, without parse/coerce/validate
|
|
125
|
+
* - {@link application} — Multiple function schemas from class/interface
|
|
126
|
+
* - {@link controller} — Application with executor
|
|
127
|
+
*
|
|
128
|
+
* @template T Target output type (object with static properties)
|
|
129
|
+
* @template Config LLM schema configuration
|
|
130
|
+
* @returns LLM structured output interface
|
|
131
|
+
*/
|
|
132
|
+
export declare function structuredOutput<T extends Record<string, any>, Config extends Partial<ILlmSchema.IConfig & {
|
|
133
|
+
/**
|
|
134
|
+
* Whether to disallow superfluous properties or not.
|
|
135
|
+
*
|
|
136
|
+
* If configure as `true`, {@link validateEquals} function would be used
|
|
137
|
+
* for validation feedback, which is more strict than {@link validate}
|
|
138
|
+
* function.
|
|
139
|
+
*
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
equals: boolean;
|
|
143
|
+
}> = {}>(): ILlmStructuredOutput<T>;
|
|
94
144
|
/**
|
|
95
145
|
* Creates LLM parameters schema.
|
|
96
146
|
*
|
package/lib/llm.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.controller = controller;
|
|
4
4
|
exports.application = application;
|
|
5
|
+
exports.structuredOutput = structuredOutput;
|
|
5
6
|
exports.parameters = parameters;
|
|
6
7
|
exports.schema = schema;
|
|
7
8
|
exports.parse = parse;
|
|
@@ -18,6 +19,10 @@ function application() {
|
|
|
18
19
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("llm.application");
|
|
19
20
|
}
|
|
20
21
|
/** @internal */
|
|
22
|
+
function structuredOutput() {
|
|
23
|
+
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("llm.structuredOutput");
|
|
24
|
+
}
|
|
25
|
+
/** @internal */
|
|
21
26
|
function parameters() {
|
|
22
27
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("llm.parameters");
|
|
23
28
|
}
|
package/lib/llm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../src/llm.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../src/llm.ts"],"names":[],"mappings":";;AA4EA,gCAEC;AA2DD,kCAEC;AA4DD,4CAEC;AAwCD,gCAEC;AAuCD,wBAEC;AAqDD,sBAEC;AAwCD,wBAEC;AAkDD,kCAEC;AA4CD,oCAEC;AAvdD,gGAA6F;AAmE7F,gBAAgB;AAChB,SAAgB,UAAU,CAAC,GAAG,KAAY;IACxC,IAAA,6DAA6B,EAAC,gBAAgB,CAAC,CAAC;AAClD,CAAC;AA0DD,gBAAgB;AAChB,SAAgB,WAAW;IACzB,IAAA,6DAA6B,EAAC,iBAAiB,CAAC,CAAC;AACnD,CAAC;AA2DD,gBAAgB;AAChB,SAAgB,gBAAgB;IAC9B,IAAA,6DAA6B,EAAC,sBAAsB,CAAC,CAAC;AACxD,CAAC;AAuCD,gBAAgB;AAChB,SAAgB,UAAU;IACxB,IAAA,6DAA6B,EAAC,gBAAgB,CAAC,CAAC;AAClD,CAAC;AAsCD,gBAAgB;AAChB,SAAgB,MAAM;IACpB,IAAA,6DAA6B,EAAC,YAAY,CAAC,CAAC;AAC9C,CAAC;AAoDD,gBAAgB;AAChB,SAAgB,KAAK;IACnB,IAAA,6DAA6B,EAAC,WAAW,CAAC,CAAC;AAC7C,CAAC;AAuCD,gBAAgB;AAChB,SAAgB,MAAM;IACpB,IAAA,6DAA6B,EAAC,YAAY,CAAC,CAAC;AAC9C,CAAC;AAiDD,gBAAgB;AAChB,SAAgB,WAAW;IACzB,IAAA,6DAA6B,EAAC,iBAAiB,CAAC,CAAC;AACnD,CAAC;AA2CD,gBAAgB;AAChB,SAAgB,YAAY;IAC1B,IAAA,6DAA6B,EAAC,kBAAkB,CAAC,CAAC;AACpD,CAAC"}
|
package/lib/llm.mjs
CHANGED
|
@@ -9,6 +9,10 @@ function application() {
|
|
|
9
9
|
NoTransformConfigurationError("llm.application");
|
|
10
10
|
}
|
|
11
11
|
/** @internal */
|
|
12
|
+
function structuredOutput() {
|
|
13
|
+
NoTransformConfigurationError("llm.structuredOutput");
|
|
14
|
+
}
|
|
15
|
+
/** @internal */
|
|
12
16
|
function parameters() {
|
|
13
17
|
NoTransformConfigurationError("llm.parameters");
|
|
14
18
|
}
|
|
@@ -33,5 +37,5 @@ function createCoerce() {
|
|
|
33
37
|
NoTransformConfigurationError("llm.createCoerce");
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
export { application, coerce, controller, createCoerce, createParse, parameters, parse, schema };
|
|
40
|
+
export { application, coerce, controller, createCoerce, createParse, parameters, parse, schema, structuredOutput };
|
|
37
41
|
//# sourceMappingURL=llm.mjs.map
|
package/lib/llm.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.mjs","sources":["../src/llm.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"llm.mjs","sources":["../src/llm.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA2EA;AACM,SAAU,UAAU,CAAC,GAAG,KAAY,EAAA;IACxC,6BAA6B,CAAC,gBAAgB,CAAC;AACjD;AA0DA;SACgB,WAAW,GAAA;IACzB,6BAA6B,CAAC,iBAAiB,CAAC;AAClD;AA2DA;SACgB,gBAAgB,GAAA;IAC9B,6BAA6B,CAAC,sBAAsB,CAAC;AACvD;AAuCA;SACgB,UAAU,GAAA;IACxB,6BAA6B,CAAC,gBAAgB,CAAC;AACjD;AAsCA;SACgB,MAAM,GAAA;IACpB,6BAA6B,CAAC,YAAY,CAAC;AAC7C;AAoDA;SACgB,KAAK,GAAA;IACnB,6BAA6B,CAAC,WAAW,CAAC;AAC5C;AAuCA;SACgB,MAAM,GAAA;IACpB,6BAA6B,CAAC,YAAY,CAAC;AAC7C;AAiDA;SACgB,WAAW,GAAA;IACzB,6BAA6B,CAAC,iBAAiB,CAAC;AAClD;AA2CA;SACgB,YAAY,GAAA;IAC1B,6BAA6B,CAAC,kBAAkB,CAAC;AACnD;;;;"}
|
package/lib/re-exports.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AssertionGuard, IJsonParseResult, IValidation, IRandomGenerator, OpenApi, IJsonSchemaCollection, IJsonSchemaUnit, ILlmController, ILlmApplication, ILlmFunction, ILlmSchema, IMetadataSchema, IMetadataSchemaCollection, IMetadataSchemaUnit, IMetadataComponents, IMetadataTypeTag, IJsDocTagInfo, Primitive, Resolved, CamelCase, PascalCase, SnakeCase, IReadableURLSearchParams, tags, } from "@typia/interface";
|
|
1
|
+
export { AssertionGuard, IJsonParseResult, IValidation, IRandomGenerator, OpenApi, IJsonSchemaCollection, IJsonSchemaUnit, ILlmController, ILlmApplication, ILlmFunction, ILlmStructuredOutput, ILlmSchema, IMetadataSchema, IMetadataSchemaCollection, IMetadataSchemaUnit, IMetadataComponents, IMetadataTypeTag, IJsDocTagInfo, Primitive, Resolved, CamelCase, PascalCase, SnakeCase, IReadableURLSearchParams, tags, } from "@typia/interface";
|
package/lib/re-exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"re-exports.js","sourceRoot":"","sources":["../src/re-exports.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"re-exports.js","sourceRoot":"","sources":["../src/re-exports.ts"],"names":[],"mappings":";;;AAAA,8CAiC0B;AAFxB,aAAa;AACb,iGAAA,IAAI,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typia",
|
|
3
|
-
"version": "12.0.0-dev.
|
|
3
|
+
"version": "12.0.0-dev.20260312",
|
|
4
4
|
"description": "Superfast runtime validators with only one line",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"inquirer": "^8.2.5",
|
|
51
51
|
"package-manager-detector": "^0.2.0",
|
|
52
52
|
"randexp": "^0.5.3",
|
|
53
|
-
"@typia/
|
|
54
|
-
"@typia/utils": "^12.0.0-dev.
|
|
55
|
-
"@typia/
|
|
56
|
-
"@typia/
|
|
53
|
+
"@typia/transform": "^12.0.0-dev.20260312",
|
|
54
|
+
"@typia/utils": "^12.0.0-dev.20260312",
|
|
55
|
+
"@typia/interface": "^12.0.0-dev.20260312",
|
|
56
|
+
"@typia/core": "^12.0.0-dev.20260312"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"typescript": ">=4.8.0 <5.10.0"
|
package/src/llm.ts
CHANGED
|
@@ -1,408 +1,480 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IJsonParseResult,
|
|
3
|
-
ILlmApplication,
|
|
4
|
-
ILlmController,
|
|
5
|
-
ILlmSchema,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* function
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @
|
|
44
|
-
* @
|
|
45
|
-
* @
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
48
|
-
* @
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* function
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* @
|
|
109
|
-
* @
|
|
110
|
-
* @
|
|
111
|
-
*
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* @
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* -
|
|
160
|
-
* -
|
|
161
|
-
* -
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* @
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* -
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
* @
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
* -
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
* -
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
* Create reusable
|
|
366
|
-
*
|
|
367
|
-
* @
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
*
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
1
|
+
import {
|
|
2
|
+
IJsonParseResult,
|
|
3
|
+
ILlmApplication,
|
|
4
|
+
ILlmController,
|
|
5
|
+
ILlmSchema,
|
|
6
|
+
ILlmStructuredOutput,
|
|
7
|
+
} from "@typia/interface";
|
|
8
|
+
|
|
9
|
+
import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
|
|
10
|
+
|
|
11
|
+
/* -----------------------------------------------------------
|
|
12
|
+
FUNCTION CALLING
|
|
13
|
+
----------------------------------------------------------- */
|
|
14
|
+
/**
|
|
15
|
+
* Creates LLM function calling controller.
|
|
16
|
+
*
|
|
17
|
+
* @danger You must configure the generic argument `Class`
|
|
18
|
+
*/
|
|
19
|
+
export function controller(
|
|
20
|
+
name: string,
|
|
21
|
+
execute: object,
|
|
22
|
+
config?: Partial<Pick<ILlmApplication.IConfig<any>, "validate">>,
|
|
23
|
+
): never;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates LLM function calling controller from class/interface.
|
|
27
|
+
*
|
|
28
|
+
* Generates {@link ILlmController} from a TypeScript class or interface,
|
|
29
|
+
* containing both function calling schemas ({@link ILlmFunction}) and an
|
|
30
|
+
* executor ({@link ILlmController.execute}).
|
|
31
|
+
*
|
|
32
|
+
* Each {@link ILlmFunction} includes a built-in {@link ILlmFunction.validate}
|
|
33
|
+
* function that validates LLM-generated arguments before execution. When
|
|
34
|
+
* validation fails, use `LlmJson.stringify()` from `@typia/utils` to format
|
|
35
|
+
* errors for LLM feedback, enabling auto-correction.
|
|
36
|
+
*
|
|
37
|
+
* When passed to LLM providers (ChatGPT, Claude, Gemini, etc.), the LLM
|
|
38
|
+
* automatically selects functions and fills arguments from conversation.
|
|
39
|
+
* Execute the selected function via {@link ILlmController.execute}.
|
|
40
|
+
*
|
|
41
|
+
* Related functions:
|
|
42
|
+
*
|
|
43
|
+
* - {@link application} — Schemas only, without executor
|
|
44
|
+
* - {@link parameters} — Single parameters schema for structured output
|
|
45
|
+
* - {@link schema} — Single type schema
|
|
46
|
+
*
|
|
47
|
+
* @template Class Target class or interface type
|
|
48
|
+
* @template Config LLM schema configuration
|
|
49
|
+
* @param name Controller identifier name
|
|
50
|
+
* @param execute Executor instance
|
|
51
|
+
* @param config LLM application options
|
|
52
|
+
* @returns LLM function calling controller
|
|
53
|
+
*/
|
|
54
|
+
export function controller<
|
|
55
|
+
Class extends Record<string, any>,
|
|
56
|
+
Config extends Partial<
|
|
57
|
+
ILlmSchema.IConfig & {
|
|
58
|
+
/**
|
|
59
|
+
* Whether to disallow superfluous properties or not.
|
|
60
|
+
*
|
|
61
|
+
* If configure as `true`, {@link validateEquals} function would be used
|
|
62
|
+
* for validation feedback, which is more strict than {@link validate}
|
|
63
|
+
* function.
|
|
64
|
+
*
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
equals: boolean;
|
|
68
|
+
}
|
|
69
|
+
> = {},
|
|
70
|
+
>(
|
|
71
|
+
name: string,
|
|
72
|
+
execute: Class,
|
|
73
|
+
config?: Partial<Pick<ILlmApplication.IConfig<Class>, "validate">>,
|
|
74
|
+
): ILlmController<Class>;
|
|
75
|
+
|
|
76
|
+
/** @internal */
|
|
77
|
+
export function controller(..._args: any[]): never {
|
|
78
|
+
NoTransformConfigurationError("llm.controller");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Creates LLM function calling application.
|
|
83
|
+
*
|
|
84
|
+
* @danger You must configure the generic argument `Class`
|
|
85
|
+
*/
|
|
86
|
+
export function application(
|
|
87
|
+
config?: Partial<Pick<ILlmApplication.IConfig<any>, "validate">>,
|
|
88
|
+
): never;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Creates LLM function calling application from class/interface.
|
|
92
|
+
*
|
|
93
|
+
* Generates {@link ILlmApplication} from a TypeScript class or interface,
|
|
94
|
+
* containing function calling schemas ({@link ILlmFunction}). Does not include
|
|
95
|
+
* an executor—use {@link controller} if you need execution capability.
|
|
96
|
+
*
|
|
97
|
+
* Each {@link ILlmFunction} includes a built-in {@link ILlmFunction.validate}
|
|
98
|
+
* function that validates LLM-generated arguments before execution. When
|
|
99
|
+
* validation fails, use `LlmJson.stringify()` from `@typia/utils` to format
|
|
100
|
+
* errors for LLM feedback, enabling auto-correction.
|
|
101
|
+
*
|
|
102
|
+
* When passed to LLM providers (ChatGPT, Claude, Gemini, etc.), the LLM
|
|
103
|
+
* automatically selects functions and fills arguments from conversation. You
|
|
104
|
+
* execute the function manually with the LLM-prepared arguments.
|
|
105
|
+
*
|
|
106
|
+
* Related functions:
|
|
107
|
+
*
|
|
108
|
+
* - {@link controller} — Includes executor alongside schemas
|
|
109
|
+
* - {@link parameters} — Single parameters schema for structured output
|
|
110
|
+
* - {@link schema} — Single type schema
|
|
111
|
+
*
|
|
112
|
+
* @template Class Target class or interface type
|
|
113
|
+
* @template Config LLM schema configuration
|
|
114
|
+
* @param config LLM application options
|
|
115
|
+
* @returns LLM function calling application
|
|
116
|
+
*/
|
|
117
|
+
export function application<
|
|
118
|
+
Class extends Record<string, any>,
|
|
119
|
+
Config extends Partial<
|
|
120
|
+
ILlmSchema.IConfig & {
|
|
121
|
+
/**
|
|
122
|
+
* Whether to disallow superfluous properties or not.
|
|
123
|
+
*
|
|
124
|
+
* If configure as `true`, {@link validateEquals} function would be used
|
|
125
|
+
* for validation feedback, which is more strict than {@link validate}
|
|
126
|
+
* function.
|
|
127
|
+
*
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
equals: boolean;
|
|
131
|
+
}
|
|
132
|
+
> = {},
|
|
133
|
+
>(
|
|
134
|
+
config?: Partial<Pick<ILlmApplication.IConfig<Class>, "validate">>,
|
|
135
|
+
): ILlmApplication<Class>;
|
|
136
|
+
|
|
137
|
+
/** @internal */
|
|
138
|
+
export function application(): never {
|
|
139
|
+
NoTransformConfigurationError("llm.application");
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Creates LLM structured output interface.
|
|
144
|
+
*
|
|
145
|
+
* @danger You must configure the generic argument `T`
|
|
146
|
+
*/
|
|
147
|
+
export function structuredOutput(): never;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Creates LLM structured output interface from TypeScript object type.
|
|
151
|
+
*
|
|
152
|
+
* Generates {@link ILlmStructuredOutput} containing everything needed for
|
|
153
|
+
* handling LLM structured outputs: the JSON schema for prompting, and functions
|
|
154
|
+
* for parsing, coercing, and validating responses.
|
|
155
|
+
*
|
|
156
|
+
* Structured outputs allow LLMs to generate data conforming to a predefined
|
|
157
|
+
* schema instead of free-form text. This is useful for:
|
|
158
|
+
*
|
|
159
|
+
* - Extracting structured data from conversations
|
|
160
|
+
* - Generating typed responses for downstream processing
|
|
161
|
+
* - Ensuring consistent output formats across LLM calls
|
|
162
|
+
*
|
|
163
|
+
* Workflow:
|
|
164
|
+
*
|
|
165
|
+
* 1. Pass {@link ILlmStructuredOutput.parameters} schema to LLM provider
|
|
166
|
+
* 2. Receive LLM response (JSON string or pre-parsed object)
|
|
167
|
+
* 3. Use {@link ILlmStructuredOutput.parse} for raw strings or
|
|
168
|
+
* {@link ILlmStructuredOutput.coerce} for pre-parsed objects
|
|
169
|
+
* 4. Use {@link ILlmStructuredOutput.validate} to check the result
|
|
170
|
+
*
|
|
171
|
+
* Related functions:
|
|
172
|
+
*
|
|
173
|
+
* - {@link parameters} — Schema only, without parse/coerce/validate
|
|
174
|
+
* - {@link application} — Multiple function schemas from class/interface
|
|
175
|
+
* - {@link controller} — Application with executor
|
|
176
|
+
*
|
|
177
|
+
* @template T Target output type (object with static properties)
|
|
178
|
+
* @template Config LLM schema configuration
|
|
179
|
+
* @returns LLM structured output interface
|
|
180
|
+
*/
|
|
181
|
+
export function structuredOutput<
|
|
182
|
+
T extends Record<string, any>,
|
|
183
|
+
Config extends Partial<
|
|
184
|
+
ILlmSchema.IConfig & {
|
|
185
|
+
/**
|
|
186
|
+
* Whether to disallow superfluous properties or not.
|
|
187
|
+
*
|
|
188
|
+
* If configure as `true`, {@link validateEquals} function would be used
|
|
189
|
+
* for validation feedback, which is more strict than {@link validate}
|
|
190
|
+
* function.
|
|
191
|
+
*
|
|
192
|
+
* @default false
|
|
193
|
+
*/
|
|
194
|
+
equals: boolean;
|
|
195
|
+
}
|
|
196
|
+
> = {},
|
|
197
|
+
>(): ILlmStructuredOutput<T>;
|
|
198
|
+
|
|
199
|
+
/** @internal */
|
|
200
|
+
export function structuredOutput(): never {
|
|
201
|
+
NoTransformConfigurationError("llm.structuredOutput");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* -----------------------------------------------------------
|
|
205
|
+
RAW SCHEMAS
|
|
206
|
+
----------------------------------------------------------- */
|
|
207
|
+
/**
|
|
208
|
+
* Creates LLM parameters schema.
|
|
209
|
+
*
|
|
210
|
+
* @danger You must configure the generic argument `Parameters`
|
|
211
|
+
*/
|
|
212
|
+
export function parameters(): never;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Creates LLM parameters schema from TypeScript object type.
|
|
216
|
+
*
|
|
217
|
+
* Generates {@link ILlmSchema.IParameters} for LLM function calling or
|
|
218
|
+
* structured outputs. LLMs use keyworded arguments only, so the type must be an
|
|
219
|
+
* object with static properties (no dynamic properties allowed).
|
|
220
|
+
*
|
|
221
|
+
* Use cases:
|
|
222
|
+
*
|
|
223
|
+
* - Function calling: LLM fills parameters from conversation
|
|
224
|
+
* - Structured outputs: LLM generates structured data, not plain text
|
|
225
|
+
*
|
|
226
|
+
* Related functions:
|
|
227
|
+
*
|
|
228
|
+
* - {@link application} — Multiple function schemas from class/interface
|
|
229
|
+
* - {@link controller} — Application with executor
|
|
230
|
+
* - {@link schema} — Single type schema (not parameters-specific)
|
|
231
|
+
*
|
|
232
|
+
* @template Parameters Target parameters type (object with static properties)
|
|
233
|
+
* @template Config LLM schema configuration
|
|
234
|
+
* @returns LLM parameters schema
|
|
235
|
+
*/
|
|
236
|
+
export function parameters<
|
|
237
|
+
Parameters extends Record<string, any>,
|
|
238
|
+
Config extends Partial<ILlmSchema.IConfig> = {},
|
|
239
|
+
>(): ILlmSchema.IParameters;
|
|
240
|
+
|
|
241
|
+
/** @internal */
|
|
242
|
+
export function parameters(): never {
|
|
243
|
+
NoTransformConfigurationError("llm.parameters");
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Creates LLM type schema.
|
|
248
|
+
*
|
|
249
|
+
* @danger You must configure the generic argument `T`
|
|
250
|
+
*/
|
|
251
|
+
export function schema(): never;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Creates LLM type schema from TypeScript type.
|
|
255
|
+
*
|
|
256
|
+
* Generates {@link ILlmSchema} for use in LLM function calling. For actual
|
|
257
|
+
* function calling with TypeScript functions, use {@link application}. For
|
|
258
|
+
* structured output generation, use {@link parameters}.
|
|
259
|
+
*
|
|
260
|
+
* LLM function calling flow:
|
|
261
|
+
*
|
|
262
|
+
* 1. LLM selects function and fills arguments from conversation
|
|
263
|
+
* 2. You execute the function with LLM-prepared arguments
|
|
264
|
+
* 3. Return value is passed back to LLM via system prompt
|
|
265
|
+
* 4. LLM continues conversation based on return value
|
|
266
|
+
*
|
|
267
|
+
* Related functions:
|
|
268
|
+
*
|
|
269
|
+
* - {@link application} — Multiple function schemas from class/interface
|
|
270
|
+
* - {@link controller} — Application with executor
|
|
271
|
+
* - {@link parameters} — Parameters schema for structured output
|
|
272
|
+
*
|
|
273
|
+
* @template T Target type
|
|
274
|
+
* @template Config LLM schema configuration
|
|
275
|
+
* @param $defs Shared schema definitions for `$ref` referencing
|
|
276
|
+
* @returns LLM type schema
|
|
277
|
+
*/
|
|
278
|
+
export function schema<T, Config extends Partial<ILlmSchema.IConfig> = {}>(
|
|
279
|
+
$defs: Record<string, ILlmSchema>,
|
|
280
|
+
): ILlmSchema;
|
|
281
|
+
|
|
282
|
+
/** @internal */
|
|
283
|
+
export function schema(): never {
|
|
284
|
+
NoTransformConfigurationError("llm.schema");
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* -----------------------------------------------------------
|
|
288
|
+
UTILITY FUNCTIONS
|
|
289
|
+
----------------------------------------------------------- */
|
|
290
|
+
/**
|
|
291
|
+
* Parse LLM response JSON with type coercion.
|
|
292
|
+
*
|
|
293
|
+
* @danger You must configure the generic argument `Parameters`
|
|
294
|
+
*/
|
|
295
|
+
export function parse(input: string): never;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Parse lenient JSON with schema-based type coercion.
|
|
299
|
+
*
|
|
300
|
+
* Handles incomplete or malformed JSON commonly produced by LLMs:
|
|
301
|
+
*
|
|
302
|
+
* - Unclosed brackets, strings, trailing commas
|
|
303
|
+
* - JavaScript-style comments (`//` and multi-line)
|
|
304
|
+
* - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
|
|
305
|
+
* - Markdown code block extraction, junk prefix skipping
|
|
306
|
+
*
|
|
307
|
+
* Also coerces double-stringified values based on the `Parameters` schema:
|
|
308
|
+
*
|
|
309
|
+
* - `"42"` → `42` (when schema expects number)
|
|
310
|
+
* - `"true"` → `true` (when schema expects boolean)
|
|
311
|
+
* - `"null"` → `null` (when schema expects null)
|
|
312
|
+
* - `"{...}"` → `{...}` (when schema expects object)
|
|
313
|
+
* - `"[...]"` → `[...]` (when schema expects array)
|
|
314
|
+
*
|
|
315
|
+
* Type validation is NOT performed—use {@link ILlmFunction.validate} or
|
|
316
|
+
* `typia.validate()` for that.
|
|
317
|
+
*
|
|
318
|
+
* For repeated parsing, use {@link createParse} to avoid regenerating the schema
|
|
319
|
+
* each time.
|
|
320
|
+
*
|
|
321
|
+
* Related functions:
|
|
322
|
+
*
|
|
323
|
+
* - {@link createParse} — Create reusable parser function
|
|
324
|
+
* - {@link coerce} — Type coercion for already-parsed objects
|
|
325
|
+
* - {@link parameters} — Generate parameters schema from type
|
|
326
|
+
*
|
|
327
|
+
* @template Parameters Target parameters type (object with static properties)
|
|
328
|
+
* @template Config LLM schema configuration
|
|
329
|
+
* @param input Raw JSON string (potentially incomplete or malformed)
|
|
330
|
+
* @returns Parse result with typed data on success, or partial data with errors
|
|
331
|
+
*/
|
|
332
|
+
export function parse<
|
|
333
|
+
Parameters extends Record<string, any>,
|
|
334
|
+
Config extends Partial<ILlmSchema.IConfig> = {},
|
|
335
|
+
>(input: string): IJsonParseResult<Parameters>;
|
|
336
|
+
|
|
337
|
+
/** @internal */
|
|
338
|
+
export function parse(): never {
|
|
339
|
+
NoTransformConfigurationError("llm.parse");
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Coerce LLM arguments to match expected schema types.
|
|
344
|
+
*
|
|
345
|
+
* LLMs often return values with incorrect types (e.g., numbers as strings).
|
|
346
|
+
* This function recursively coerces values based on the `Parameters` schema:
|
|
347
|
+
*
|
|
348
|
+
* - `"42"` → `42` (when schema expects number)
|
|
349
|
+
* - `"true"` → `true` (when schema expects boolean)
|
|
350
|
+
* - `"null"` → `null` (when schema expects null)
|
|
351
|
+
* - `"{...}"` → `{...}` (when schema expects object)
|
|
352
|
+
* - `"[...]"` → `[...]` (when schema expects array)
|
|
353
|
+
*
|
|
354
|
+
* Use this when your SDK provides already-parsed objects but values may have
|
|
355
|
+
* wrong types. For raw JSON strings, use {@link parse} instead.
|
|
356
|
+
*
|
|
357
|
+
* For repeated coercion, use {@link createCoerce} to avoid regenerating the
|
|
358
|
+
* schema each time.
|
|
359
|
+
*
|
|
360
|
+
* Type validation is NOT performed—use {@link ILlmFunction.validate} or
|
|
361
|
+
* `typia.validate()` for that.
|
|
362
|
+
*
|
|
363
|
+
* Related functions:
|
|
364
|
+
*
|
|
365
|
+
* - {@link createCoerce} — Create reusable coercer function
|
|
366
|
+
* - {@link parse} — Parse and coerce raw JSON strings
|
|
367
|
+
* - {@link parameters} — Generate parameters schema from type
|
|
368
|
+
*
|
|
369
|
+
* @template Parameters Target parameters type (object with static properties)
|
|
370
|
+
* @template Config LLM schema configuration
|
|
371
|
+
* @param input Parsed arguments object from LLM (with potentially wrong types)
|
|
372
|
+
* @returns Coerced arguments with corrected types
|
|
373
|
+
*/
|
|
374
|
+
export function coerce<
|
|
375
|
+
Parameters extends Record<string, any>,
|
|
376
|
+
Config extends Partial<ILlmSchema.IConfig> = {},
|
|
377
|
+
>(input: Parameters): Parameters;
|
|
378
|
+
|
|
379
|
+
/** @internal */
|
|
380
|
+
export function coerce(): never {
|
|
381
|
+
NoTransformConfigurationError("llm.coerce");
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Create reusable LLM JSON parser with type coercion.
|
|
386
|
+
*
|
|
387
|
+
* @danger You must configure the generic argument `Parameters`
|
|
388
|
+
*/
|
|
389
|
+
export function createParse(): never;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Create reusable lenient JSON parser with schema-based type coercion.
|
|
393
|
+
*
|
|
394
|
+
* Returns a parser function that handles incomplete or malformed JSON commonly
|
|
395
|
+
* produced by LLMs:
|
|
396
|
+
*
|
|
397
|
+
* - Unclosed brackets, strings, trailing commas
|
|
398
|
+
* - JavaScript-style comments (`//` and multi-line)
|
|
399
|
+
* - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
|
|
400
|
+
* - Markdown code block extraction, junk prefix skipping
|
|
401
|
+
*
|
|
402
|
+
* Also coerces double-stringified values based on the `Parameters` schema:
|
|
403
|
+
*
|
|
404
|
+
* - `"42"` → `42` (when schema expects number)
|
|
405
|
+
* - `"true"` → `true` (when schema expects boolean)
|
|
406
|
+
* - `"null"` → `null` (when schema expects null)
|
|
407
|
+
* - `"{...}"` → `{...}` (when schema expects object)
|
|
408
|
+
* - `"[...]"` → `[...]` (when schema expects array)
|
|
409
|
+
*
|
|
410
|
+
* Use this instead of {@link parse} when parsing multiple inputs to avoid
|
|
411
|
+
* regenerating the schema each time.
|
|
412
|
+
*
|
|
413
|
+
* Type validation is NOT performed—use {@link ILlmFunction.validate} or
|
|
414
|
+
* `typia.validate()` for that.
|
|
415
|
+
*
|
|
416
|
+
* Related functions:
|
|
417
|
+
*
|
|
418
|
+
* - {@link parse} — One-shot parsing (regenerates schema each call)
|
|
419
|
+
* - {@link createCoerce} — Create reusable coercer function
|
|
420
|
+
* - {@link parameters} — Generate parameters schema from type
|
|
421
|
+
*
|
|
422
|
+
* @template Parameters Target parameters type (object with static properties)
|
|
423
|
+
* @template Config LLM schema configuration
|
|
424
|
+
* @returns Reusable parser function
|
|
425
|
+
*/
|
|
426
|
+
export function createParse<
|
|
427
|
+
Parameters extends Record<string, any>,
|
|
428
|
+
Config extends Partial<ILlmSchema.IConfig> = {},
|
|
429
|
+
>(): (input: string) => IJsonParseResult<Parameters>;
|
|
430
|
+
|
|
431
|
+
/** @internal */
|
|
432
|
+
export function createParse(): never {
|
|
433
|
+
NoTransformConfigurationError("llm.createParse");
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Create reusable LLM arguments coercer.
|
|
438
|
+
*
|
|
439
|
+
* @danger You must configure the generic argument `Parameters`
|
|
440
|
+
*/
|
|
441
|
+
export function createCoerce(): never;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Create reusable coercer for LLM arguments.
|
|
445
|
+
*
|
|
446
|
+
* Returns a coercer function that fixes incorrect types commonly returned by
|
|
447
|
+
* LLMs (e.g., numbers as strings). Coerces values based on the `Parameters`
|
|
448
|
+
* schema:
|
|
449
|
+
*
|
|
450
|
+
* - `"42"` → `42` (when schema expects number)
|
|
451
|
+
* - `"true"` → `true` (when schema expects boolean)
|
|
452
|
+
* - `"null"` → `null` (when schema expects null)
|
|
453
|
+
* - `"{...}"` → `{...}` (when schema expects object)
|
|
454
|
+
* - `"[...]"` → `[...]` (when schema expects array)
|
|
455
|
+
*
|
|
456
|
+
* Use this instead of {@link coerce} when coercing multiple inputs to avoid
|
|
457
|
+
* regenerating the schema each time.
|
|
458
|
+
*
|
|
459
|
+
* Type validation is NOT performed—use {@link ILlmFunction.validate} or
|
|
460
|
+
* `typia.validate()` for that.
|
|
461
|
+
*
|
|
462
|
+
* Related functions:
|
|
463
|
+
*
|
|
464
|
+
* - {@link coerce} — One-shot coercion (regenerates schema each call)
|
|
465
|
+
* - {@link createParse} — Create reusable parser function
|
|
466
|
+
* - {@link parameters} — Generate parameters schema from type
|
|
467
|
+
*
|
|
468
|
+
* @template Parameters Target parameters type (object with static properties)
|
|
469
|
+
* @template Config LLM schema configuration
|
|
470
|
+
* @returns Reusable coercer function
|
|
471
|
+
*/
|
|
472
|
+
export function createCoerce<
|
|
473
|
+
Parameters extends Record<string, any>,
|
|
474
|
+
Config extends Partial<ILlmSchema.IConfig> = {},
|
|
475
|
+
>(): (input: Parameters) => Parameters;
|
|
476
|
+
|
|
477
|
+
/** @internal */
|
|
478
|
+
export function createCoerce(): never {
|
|
479
|
+
NoTransformConfigurationError("llm.createCoerce");
|
|
480
|
+
}
|
package/src/re-exports.ts
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
export {
|
|
2
|
-
// validate
|
|
3
|
-
AssertionGuard,
|
|
4
|
-
IJsonParseResult,
|
|
5
|
-
IValidation,
|
|
6
|
-
IRandomGenerator,
|
|
7
|
-
// json
|
|
8
|
-
OpenApi,
|
|
9
|
-
IJsonSchemaCollection,
|
|
10
|
-
IJsonSchemaUnit,
|
|
11
|
-
// llm
|
|
12
|
-
ILlmController,
|
|
13
|
-
ILlmApplication,
|
|
14
|
-
ILlmFunction,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
export {
|
|
2
|
+
// validate
|
|
3
|
+
AssertionGuard,
|
|
4
|
+
IJsonParseResult,
|
|
5
|
+
IValidation,
|
|
6
|
+
IRandomGenerator,
|
|
7
|
+
// json
|
|
8
|
+
OpenApi,
|
|
9
|
+
IJsonSchemaCollection,
|
|
10
|
+
IJsonSchemaUnit,
|
|
11
|
+
// llm
|
|
12
|
+
ILlmController,
|
|
13
|
+
ILlmApplication,
|
|
14
|
+
ILlmFunction,
|
|
15
|
+
ILlmStructuredOutput,
|
|
16
|
+
ILlmSchema,
|
|
17
|
+
// reflect
|
|
18
|
+
IMetadataSchema,
|
|
19
|
+
IMetadataSchemaCollection,
|
|
20
|
+
IMetadataSchemaUnit,
|
|
21
|
+
IMetadataComponents,
|
|
22
|
+
IMetadataTypeTag,
|
|
23
|
+
IJsDocTagInfo,
|
|
24
|
+
// typings
|
|
25
|
+
Primitive,
|
|
26
|
+
Resolved,
|
|
27
|
+
CamelCase,
|
|
28
|
+
PascalCase,
|
|
29
|
+
SnakeCase,
|
|
30
|
+
// http
|
|
31
|
+
IReadableURLSearchParams,
|
|
32
|
+
// namespaces
|
|
33
|
+
tags,
|
|
34
|
+
} from "@typia/interface";
|