typia 12.0.0-dev.20260309 → 12.0.0-dev.20260310

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.
Files changed (134) hide show
  1. package/lib/executable/setup/PluginConfigurator.js +3 -3
  2. package/lib/executable/setup/PluginConfigurator.mjs +3 -3
  3. package/lib/executable/setup/PluginConfigurator.mjs.map +1 -1
  4. package/lib/executable/typia.js +15 -15
  5. package/lib/executable/typia.mjs +15 -15
  6. package/package.json +5 -5
  7. package/src/TypeGuardError.ts +145 -145
  8. package/src/executable/TypiaGenerateWizard.ts +82 -82
  9. package/src/executable/TypiaPatchWizard.ts +45 -45
  10. package/src/executable/TypiaSetupWizard.ts +171 -171
  11. package/src/executable/setup/ArgumentParser.ts +42 -42
  12. package/src/executable/setup/CommandExecutor.ts +8 -8
  13. package/src/executable/setup/FileRetriever.ts +19 -19
  14. package/src/executable/setup/PackageManager.ts +87 -87
  15. package/src/executable/setup/PluginConfigurator.ts +74 -74
  16. package/src/executable/typia.ts +55 -55
  17. package/src/functional.ts +600 -600
  18. package/src/http.ts +843 -843
  19. package/src/index.ts +4 -4
  20. package/src/internal/_IProtobufWriter.ts +18 -18
  21. package/src/internal/_ProtobufReader.ts +187 -187
  22. package/src/internal/_ProtobufSizer.ts +137 -137
  23. package/src/internal/_ProtobufWriter.ts +135 -135
  24. package/src/internal/_accessExpressionAsString.ts +46 -46
  25. package/src/internal/_assertGuard.ts +13 -13
  26. package/src/internal/_coerceLlmArguments.ts +7 -7
  27. package/src/internal/_createStandardSchema.ts +133 -133
  28. package/src/internal/_functionalTypeGuardErrorFactory.ts +4 -4
  29. package/src/internal/_httpFormDataReadArray.ts +4 -4
  30. package/src/internal/_httpFormDataReadBigint.ts +18 -18
  31. package/src/internal/_httpFormDataReadBlob.ts +10 -10
  32. package/src/internal/_httpFormDataReadBoolean.ts +16 -16
  33. package/src/internal/_httpFormDataReadFile.ts +10 -10
  34. package/src/internal/_httpFormDataReadNumber.ts +15 -15
  35. package/src/internal/_httpFormDataReadString.ts +10 -10
  36. package/src/internal/_httpHeaderReadBigint.ts +10 -10
  37. package/src/internal/_httpHeaderReadBoolean.ts +8 -8
  38. package/src/internal/_httpHeaderReadNumber.ts +7 -7
  39. package/src/internal/_httpParameterReadBigint.ts +10 -10
  40. package/src/internal/_httpParameterReadBoolean.ts +8 -8
  41. package/src/internal/_httpParameterReadNumber.ts +7 -7
  42. package/src/internal/_httpParameterReadString.ts +2 -2
  43. package/src/internal/_httpQueryParseURLSearchParams.ts +12 -12
  44. package/src/internal/_httpQueryReadArray.ts +4 -4
  45. package/src/internal/_httpQueryReadBigint.ts +12 -12
  46. package/src/internal/_httpQueryReadBoolean.ts +14 -14
  47. package/src/internal/_httpQueryReadNumber.ts +9 -9
  48. package/src/internal/_httpQueryReadString.ts +4 -4
  49. package/src/internal/_isBetween.ts +2 -2
  50. package/src/internal/_isBigintString.ts +8 -8
  51. package/src/internal/_isFormatByte.ts +7 -7
  52. package/src/internal/_isFormatDate.ts +3 -3
  53. package/src/internal/_isFormatDateTime.ts +4 -4
  54. package/src/internal/_isFormatDuration.ts +4 -4
  55. package/src/internal/_isFormatEmail.ts +4 -4
  56. package/src/internal/_isFormatHostname.ts +4 -4
  57. package/src/internal/_isFormatIdnEmail.ts +4 -4
  58. package/src/internal/_isFormatIdnHostname.ts +4 -4
  59. package/src/internal/_isFormatIpv4.ts +4 -4
  60. package/src/internal/_isFormatIpv6.ts +4 -4
  61. package/src/internal/_isFormatIri.ts +3 -3
  62. package/src/internal/_isFormatIriReference.ts +4 -4
  63. package/src/internal/_isFormatJsonPointer.ts +3 -3
  64. package/src/internal/_isFormatPassword.ts +1 -1
  65. package/src/internal/_isFormatRegex.ts +8 -8
  66. package/src/internal/_isFormatRelativeJsonPointer.ts +4 -4
  67. package/src/internal/_isFormatTime.ts +4 -4
  68. package/src/internal/_isFormatUri.ts +6 -6
  69. package/src/internal/_isFormatUriReference.ts +5 -5
  70. package/src/internal/_isFormatUriTemplate.ts +4 -4
  71. package/src/internal/_isFormatUrl.ts +4 -4
  72. package/src/internal/_isFormatUuid.ts +3 -3
  73. package/src/internal/_isTypeFloat.ts +5 -5
  74. package/src/internal/_isTypeInt32.ts +5 -5
  75. package/src/internal/_isTypeInt64.ts +5 -5
  76. package/src/internal/_isTypeUint32.ts +5 -5
  77. package/src/internal/_isTypeUint64.ts +5 -5
  78. package/src/internal/_isUniqueItems.ts +159 -159
  79. package/src/internal/_jsonStringifyNumber.ts +12 -12
  80. package/src/internal/_jsonStringifyRest.ts +3 -3
  81. package/src/internal/_jsonStringifyString.ts +42 -42
  82. package/src/internal/_jsonStringifyTail.ts +2 -2
  83. package/src/internal/_llmApplicationFinalize.ts +24 -24
  84. package/src/internal/_miscCloneAny.ts +46 -46
  85. package/src/internal/_notationAny.ts +37 -37
  86. package/src/internal/_notationCamel.ts +13 -13
  87. package/src/internal/_notationPascal.ts +8 -8
  88. package/src/internal/_notationSnake.ts +43 -43
  89. package/src/internal/_parseLlmArguments.ts +7 -7
  90. package/src/internal/_randomArray.ts +21 -21
  91. package/src/internal/_randomBigint.ts +6 -6
  92. package/src/internal/_randomBoolean.ts +1 -1
  93. package/src/internal/_randomFormatByte.ts +3 -3
  94. package/src/internal/_randomFormatDate.ts +18 -18
  95. package/src/internal/_randomFormatDatetime.ts +16 -16
  96. package/src/internal/_randomFormatDuration.ts +27 -27
  97. package/src/internal/_randomFormatEmail.ts +11 -11
  98. package/src/internal/_randomFormatHostname.ts +6 -6
  99. package/src/internal/_randomFormatIdnEmail.ts +3 -3
  100. package/src/internal/_randomFormatIdnHostname.ts +3 -3
  101. package/src/internal/_randomFormatIpv4.ts +11 -11
  102. package/src/internal/_randomFormatIpv6.ts +11 -11
  103. package/src/internal/_randomFormatIri.ts +3 -3
  104. package/src/internal/_randomFormatIriReference.ts +3 -3
  105. package/src/internal/_randomFormatJsonPointer.ts +7 -7
  106. package/src/internal/_randomFormatPassword.ts +8 -8
  107. package/src/internal/_randomFormatRegex.ts +4 -4
  108. package/src/internal/_randomFormatRelativeJsonPointer.ts +8 -8
  109. package/src/internal/_randomFormatTime.ts +14 -14
  110. package/src/internal/_randomFormatUri.ts +3 -3
  111. package/src/internal/_randomFormatUriReference.ts +3 -3
  112. package/src/internal/_randomFormatUriTemplate.ts +3 -3
  113. package/src/internal/_randomFormatUrl.ts +11 -11
  114. package/src/internal/_randomFormatUuid.ts +6 -6
  115. package/src/internal/_randomInteger.ts +53 -53
  116. package/src/internal/_randomNumber.ts +80 -80
  117. package/src/internal/_randomPattern.ts +10 -10
  118. package/src/internal/_randomPick.ts +9 -9
  119. package/src/internal/_randomString.ts +24 -24
  120. package/src/internal/_throwTypeGuardError.ts +5 -5
  121. package/src/internal/_validateReport.ts +21 -21
  122. package/src/internal/private/__notationCapitalize.ts +2 -2
  123. package/src/internal/private/__notationUnsnake.ts +24 -24
  124. package/src/json.ts +553 -553
  125. package/src/llm.ts +408 -408
  126. package/src/misc.ts +448 -448
  127. package/src/module.ts +811 -811
  128. package/src/notations.ts +624 -624
  129. package/src/programmers/TypiaProgrammer.ts +8 -8
  130. package/src/protobuf.ts +499 -499
  131. package/src/re-exports.ts +33 -33
  132. package/src/reflect.ts +75 -75
  133. package/src/transform.ts +5 -5
  134. package/src/transformers/NoTransformConfigurationError.ts +16 -16
package/src/llm.ts CHANGED
@@ -1,408 +1,408 @@
1
- import {
2
- IJsonParseResult,
3
- ILlmApplication,
4
- ILlmController,
5
- ILlmSchema,
6
- } from "@typia/interface";
7
-
8
- import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
9
-
10
- /**
11
- * Creates LLM function calling controller.
12
- *
13
- * @danger You must configure the generic argument `Class`
14
- */
15
- export function controller(
16
- name: string,
17
- execute: object,
18
- config?: Partial<Pick<ILlmApplication.IConfig<any>, "validate">>,
19
- ): never;
20
-
21
- /**
22
- * Creates LLM function calling controller from class/interface.
23
- *
24
- * Generates {@link ILlmController} from a TypeScript class or interface,
25
- * containing both function calling schemas ({@link ILlmFunction}) and an
26
- * executor ({@link ILlmController.execute}).
27
- *
28
- * Each {@link ILlmFunction} includes a built-in {@link ILlmFunction.validate}
29
- * function that validates LLM-generated arguments before execution. When
30
- * validation fails, use `LlmJson.stringify()` from `@typia/utils` to format
31
- * errors for LLM feedback, enabling auto-correction.
32
- *
33
- * When passed to LLM providers (ChatGPT, Claude, Gemini, etc.), the LLM
34
- * automatically selects functions and fills arguments from conversation.
35
- * Execute the selected function via {@link ILlmController.execute}.
36
- *
37
- * Related functions:
38
- *
39
- * - {@link application} — Schemas only, without executor
40
- * - {@link parameters} — Single parameters schema for structured output
41
- * - {@link schema} — Single type schema
42
- *
43
- * @template Class Target class or interface type
44
- * @template Config LLM schema configuration
45
- * @param name Controller identifier name
46
- * @param execute Executor instance
47
- * @param config LLM application options
48
- * @returns LLM function calling controller
49
- */
50
- export function controller<
51
- Class extends Record<string, any>,
52
- Config extends Partial<
53
- ILlmSchema.IConfig & {
54
- /**
55
- * Whether to disallow superfluous properties or not.
56
- *
57
- * If configure as `true`, {@link validateEquals} function would be used
58
- * for validation feedback, which is more strict than {@link validate}
59
- * function.
60
- *
61
- * @default false
62
- */
63
- equals: boolean;
64
- }
65
- > = {},
66
- >(
67
- name: string,
68
- execute: Class,
69
- config?: Partial<Pick<ILlmApplication.IConfig<Class>, "validate">>,
70
- ): ILlmController<Class>;
71
-
72
- /** @internal */
73
- export function controller(..._args: any[]): never {
74
- NoTransformConfigurationError("llm.controller");
75
- }
76
-
77
- /**
78
- * Creates LLM function calling application.
79
- *
80
- * @danger You must configure the generic argument `Class`
81
- */
82
- export function application(
83
- config?: Partial<Pick<ILlmApplication.IConfig<any>, "validate">>,
84
- ): never;
85
-
86
- /**
87
- * Creates LLM function calling application from class/interface.
88
- *
89
- * Generates {@link ILlmApplication} from a TypeScript class or interface,
90
- * containing function calling schemas ({@link ILlmFunction}). Does not include
91
- * an executor—use {@link controller} if you need execution capability.
92
- *
93
- * Each {@link ILlmFunction} includes a built-in {@link ILlmFunction.validate}
94
- * function that validates LLM-generated arguments before execution. When
95
- * validation fails, use `LlmJson.stringify()` from `@typia/utils` to format
96
- * errors for LLM feedback, enabling auto-correction.
97
- *
98
- * When passed to LLM providers (ChatGPT, Claude, Gemini, etc.), the LLM
99
- * automatically selects functions and fills arguments from conversation. You
100
- * execute the function manually with the LLM-prepared arguments.
101
- *
102
- * Related functions:
103
- *
104
- * - {@link controller} — Includes executor alongside schemas
105
- * - {@link parameters} — Single parameters schema for structured output
106
- * - {@link schema} — Single type schema
107
- *
108
- * @template Class Target class or interface type
109
- * @template Config LLM schema configuration
110
- * @param config LLM application options
111
- * @returns LLM function calling application
112
- */
113
- export function application<
114
- Class extends Record<string, any>,
115
- Config extends Partial<
116
- ILlmSchema.IConfig & {
117
- /**
118
- * Whether to disallow superfluous properties or not.
119
- *
120
- * If configure as `true`, {@link validateEquals} function would be used
121
- * for validation feedback, which is more strict than {@link validate}
122
- * function.
123
- *
124
- * @default false
125
- */
126
- equals: boolean;
127
- }
128
- > = {},
129
- >(
130
- config?: Partial<Pick<ILlmApplication.IConfig<Class>, "validate">>,
131
- ): ILlmApplication<Class>;
132
-
133
- /** @internal */
134
- export function application(): never {
135
- NoTransformConfigurationError("llm.application");
136
- }
137
-
138
- /**
139
- * Creates LLM parameters schema.
140
- *
141
- * @danger You must configure the generic argument `Parameters`
142
- */
143
- export function parameters(): never;
144
-
145
- /**
146
- * Creates LLM parameters schema from TypeScript object type.
147
- *
148
- * Generates {@link ILlmSchema.IParameters} for LLM function calling or
149
- * structured outputs. LLMs use keyworded arguments only, so the type must be an
150
- * object with static properties (no dynamic properties allowed).
151
- *
152
- * Use cases:
153
- *
154
- * - Function calling: LLM fills parameters from conversation
155
- * - Structured outputs: LLM generates structured data, not plain text
156
- *
157
- * Related functions:
158
- *
159
- * - {@link application} — Multiple function schemas from class/interface
160
- * - {@link controller} — Application with executor
161
- * - {@link schema} — Single type schema (not parameters-specific)
162
- *
163
- * @template Parameters Target parameters type (object with static properties)
164
- * @template Config LLM schema configuration
165
- * @returns LLM parameters schema
166
- */
167
- export function parameters<
168
- Parameters extends Record<string, any>,
169
- Config extends Partial<ILlmSchema.IConfig> = {},
170
- >(): ILlmSchema.IParameters;
171
-
172
- /** @internal */
173
- export function parameters(): never {
174
- NoTransformConfigurationError("llm.parameters");
175
- }
176
-
177
- /**
178
- * Creates LLM type schema.
179
- *
180
- * @danger You must configure the generic argument `T`
181
- */
182
- export function schema(): never;
183
-
184
- /**
185
- * Creates LLM type schema from TypeScript type.
186
- *
187
- * Generates {@link ILlmSchema} for use in LLM function calling. For actual
188
- * function calling with TypeScript functions, use {@link application}. For
189
- * structured output generation, use {@link parameters}.
190
- *
191
- * LLM function calling flow:
192
- *
193
- * 1. LLM selects function and fills arguments from conversation
194
- * 2. You execute the function with LLM-prepared arguments
195
- * 3. Return value is passed back to LLM via system prompt
196
- * 4. LLM continues conversation based on return value
197
- *
198
- * Related functions:
199
- *
200
- * - {@link application} — Multiple function schemas from class/interface
201
- * - {@link controller} — Application with executor
202
- * - {@link parameters} — Parameters schema for structured output
203
- *
204
- * @template T Target type
205
- * @template Config LLM schema configuration
206
- * @param $defs Shared schema definitions for `$ref` referencing
207
- * @returns LLM type schema
208
- */
209
- export function schema<T, Config extends Partial<ILlmSchema.IConfig> = {}>(
210
- $defs: Record<string, ILlmSchema>,
211
- ): ILlmSchema;
212
-
213
- /** @internal */
214
- export function schema(): never {
215
- NoTransformConfigurationError("llm.schema");
216
- }
217
-
218
- /**
219
- * Parse LLM response JSON with type coercion.
220
- *
221
- * @danger You must configure the generic argument `Parameters`
222
- */
223
- export function parse(input: string): never;
224
-
225
- /**
226
- * Parse lenient JSON with schema-based type coercion.
227
- *
228
- * Handles incomplete or malformed JSON commonly produced by LLMs:
229
- *
230
- * - Unclosed brackets, strings, trailing commas
231
- * - JavaScript-style comments (`//` and multi-line)
232
- * - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
233
- * - Markdown code block extraction, junk prefix skipping
234
- *
235
- * Also coerces double-stringified values based on the `Parameters` schema:
236
- *
237
- * - `"42"` → `42` (when schema expects number)
238
- * - `"true"` → `true` (when schema expects boolean)
239
- * - `"null"` → `null` (when schema expects null)
240
- * - `"{...}"` → `{...}` (when schema expects object)
241
- * - `"[...]"` → `[...]` (when schema expects array)
242
- *
243
- * Type validation is NOT performed—use {@link ILlmFunction.validate} or
244
- * `typia.validate()` for that.
245
- *
246
- * For repeated parsing, use {@link createParse} to avoid regenerating the schema
247
- * each time.
248
- *
249
- * Related functions:
250
- *
251
- * - {@link createParse} — Create reusable parser function
252
- * - {@link coerce} — Type coercion for already-parsed objects
253
- * - {@link parameters} — Generate parameters schema from type
254
- *
255
- * @template Parameters Target parameters type (object with static properties)
256
- * @template Config LLM schema configuration
257
- * @param input Raw JSON string (potentially incomplete or malformed)
258
- * @returns Parse result with typed data on success, or partial data with errors
259
- */
260
- export function parse<
261
- Parameters extends Record<string, any>,
262
- Config extends Partial<ILlmSchema.IConfig> = {},
263
- >(input: string): IJsonParseResult<Parameters>;
264
-
265
- /** @internal */
266
- export function parse(): never {
267
- NoTransformConfigurationError("llm.parse");
268
- }
269
-
270
- /**
271
- * Coerce LLM arguments to match expected schema types.
272
- *
273
- * LLMs often return values with incorrect types (e.g., numbers as strings).
274
- * This function recursively coerces values based on the `Parameters` schema:
275
- *
276
- * - `"42"` → `42` (when schema expects number)
277
- * - `"true"` → `true` (when schema expects boolean)
278
- * - `"null"` → `null` (when schema expects null)
279
- * - `"{...}"` → `{...}` (when schema expects object)
280
- * - `"[...]"` → `[...]` (when schema expects array)
281
- *
282
- * Use this when your SDK provides already-parsed objects but values may have
283
- * wrong types. For raw JSON strings, use {@link parse} instead.
284
- *
285
- * For repeated coercion, use {@link createCoerce} to avoid regenerating the
286
- * schema each time.
287
- *
288
- * Type validation is NOT performed—use {@link ILlmFunction.validate} or
289
- * `typia.validate()` for that.
290
- *
291
- * Related functions:
292
- *
293
- * - {@link createCoerce} — Create reusable coercer function
294
- * - {@link parse} — Parse and coerce raw JSON strings
295
- * - {@link parameters} — Generate parameters schema from type
296
- *
297
- * @template Parameters Target parameters type (object with static properties)
298
- * @template Config LLM schema configuration
299
- * @param input Parsed arguments object from LLM (with potentially wrong types)
300
- * @returns Coerced arguments with corrected types
301
- */
302
- export function coerce<
303
- Parameters extends Record<string, any>,
304
- Config extends Partial<ILlmSchema.IConfig> = {},
305
- >(input: Parameters): Parameters;
306
-
307
- /** @internal */
308
- export function coerce(): never {
309
- NoTransformConfigurationError("llm.coerce");
310
- }
311
-
312
- /**
313
- * Create reusable LLM JSON parser with type coercion.
314
- *
315
- * @danger You must configure the generic argument `Parameters`
316
- */
317
- export function createParse(): never;
318
-
319
- /**
320
- * Create reusable lenient JSON parser with schema-based type coercion.
321
- *
322
- * Returns a parser function that handles incomplete or malformed JSON commonly
323
- * produced by LLMs:
324
- *
325
- * - Unclosed brackets, strings, trailing commas
326
- * - JavaScript-style comments (`//` and multi-line)
327
- * - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
328
- * - Markdown code block extraction, junk prefix skipping
329
- *
330
- * Also coerces double-stringified values based on the `Parameters` schema:
331
- *
332
- * - `"42"` → `42` (when schema expects number)
333
- * - `"true"` → `true` (when schema expects boolean)
334
- * - `"null"` → `null` (when schema expects null)
335
- * - `"{...}"` → `{...}` (when schema expects object)
336
- * - `"[...]"` → `[...]` (when schema expects array)
337
- *
338
- * Use this instead of {@link parse} when parsing multiple inputs to avoid
339
- * regenerating the schema each time.
340
- *
341
- * Type validation is NOT performed—use {@link ILlmFunction.validate} or
342
- * `typia.validate()` for that.
343
- *
344
- * Related functions:
345
- *
346
- * - {@link parse} — One-shot parsing (regenerates schema each call)
347
- * - {@link createCoerce} — Create reusable coercer function
348
- * - {@link parameters} — Generate parameters schema from type
349
- *
350
- * @template Parameters Target parameters type (object with static properties)
351
- * @template Config LLM schema configuration
352
- * @returns Reusable parser function
353
- */
354
- export function createParse<
355
- Parameters extends Record<string, any>,
356
- Config extends Partial<ILlmSchema.IConfig> = {},
357
- >(): (input: string) => IJsonParseResult<Parameters>;
358
-
359
- /** @internal */
360
- export function createParse(): never {
361
- NoTransformConfigurationError("llm.createParse");
362
- }
363
-
364
- /**
365
- * Create reusable LLM arguments coercer.
366
- *
367
- * @danger You must configure the generic argument `Parameters`
368
- */
369
- export function createCoerce(): never;
370
-
371
- /**
372
- * Create reusable coercer for LLM arguments.
373
- *
374
- * Returns a coercer function that fixes incorrect types commonly returned by
375
- * LLMs (e.g., numbers as strings). Coerces values based on the `Parameters`
376
- * schema:
377
- *
378
- * - `"42"` → `42` (when schema expects number)
379
- * - `"true"` → `true` (when schema expects boolean)
380
- * - `"null"` → `null` (when schema expects null)
381
- * - `"{...}"` → `{...}` (when schema expects object)
382
- * - `"[...]"` → `[...]` (when schema expects array)
383
- *
384
- * Use this instead of {@link coerce} when coercing multiple inputs to avoid
385
- * regenerating the schema each time.
386
- *
387
- * Type validation is NOT performed—use {@link ILlmFunction.validate} or
388
- * `typia.validate()` for that.
389
- *
390
- * Related functions:
391
- *
392
- * - {@link coerce} — One-shot coercion (regenerates schema each call)
393
- * - {@link createParse} — Create reusable parser function
394
- * - {@link parameters} — Generate parameters schema from type
395
- *
396
- * @template Parameters Target parameters type (object with static properties)
397
- * @template Config LLM schema configuration
398
- * @returns Reusable coercer function
399
- */
400
- export function createCoerce<
401
- Parameters extends Record<string, any>,
402
- Config extends Partial<ILlmSchema.IConfig> = {},
403
- >(): (input: Parameters) => Parameters;
404
-
405
- /** @internal */
406
- export function createCoerce(): never {
407
- NoTransformConfigurationError("llm.createCoerce");
408
- }
1
+ import {
2
+ IJsonParseResult,
3
+ ILlmApplication,
4
+ ILlmController,
5
+ ILlmSchema,
6
+ } from "@typia/interface";
7
+
8
+ import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
9
+
10
+ /**
11
+ * Creates LLM function calling controller.
12
+ *
13
+ * @danger You must configure the generic argument `Class`
14
+ */
15
+ export function controller(
16
+ name: string,
17
+ execute: object,
18
+ config?: Partial<Pick<ILlmApplication.IConfig<any>, "validate">>,
19
+ ): never;
20
+
21
+ /**
22
+ * Creates LLM function calling controller from class/interface.
23
+ *
24
+ * Generates {@link ILlmController} from a TypeScript class or interface,
25
+ * containing both function calling schemas ({@link ILlmFunction}) and an
26
+ * executor ({@link ILlmController.execute}).
27
+ *
28
+ * Each {@link ILlmFunction} includes a built-in {@link ILlmFunction.validate}
29
+ * function that validates LLM-generated arguments before execution. When
30
+ * validation fails, use `LlmJson.stringify()` from `@typia/utils` to format
31
+ * errors for LLM feedback, enabling auto-correction.
32
+ *
33
+ * When passed to LLM providers (ChatGPT, Claude, Gemini, etc.), the LLM
34
+ * automatically selects functions and fills arguments from conversation.
35
+ * Execute the selected function via {@link ILlmController.execute}.
36
+ *
37
+ * Related functions:
38
+ *
39
+ * - {@link application} — Schemas only, without executor
40
+ * - {@link parameters} — Single parameters schema for structured output
41
+ * - {@link schema} — Single type schema
42
+ *
43
+ * @template Class Target class or interface type
44
+ * @template Config LLM schema configuration
45
+ * @param name Controller identifier name
46
+ * @param execute Executor instance
47
+ * @param config LLM application options
48
+ * @returns LLM function calling controller
49
+ */
50
+ export function controller<
51
+ Class extends Record<string, any>,
52
+ Config extends Partial<
53
+ ILlmSchema.IConfig & {
54
+ /**
55
+ * Whether to disallow superfluous properties or not.
56
+ *
57
+ * If configure as `true`, {@link validateEquals} function would be used
58
+ * for validation feedback, which is more strict than {@link validate}
59
+ * function.
60
+ *
61
+ * @default false
62
+ */
63
+ equals: boolean;
64
+ }
65
+ > = {},
66
+ >(
67
+ name: string,
68
+ execute: Class,
69
+ config?: Partial<Pick<ILlmApplication.IConfig<Class>, "validate">>,
70
+ ): ILlmController<Class>;
71
+
72
+ /** @internal */
73
+ export function controller(..._args: any[]): never {
74
+ NoTransformConfigurationError("llm.controller");
75
+ }
76
+
77
+ /**
78
+ * Creates LLM function calling application.
79
+ *
80
+ * @danger You must configure the generic argument `Class`
81
+ */
82
+ export function application(
83
+ config?: Partial<Pick<ILlmApplication.IConfig<any>, "validate">>,
84
+ ): never;
85
+
86
+ /**
87
+ * Creates LLM function calling application from class/interface.
88
+ *
89
+ * Generates {@link ILlmApplication} from a TypeScript class or interface,
90
+ * containing function calling schemas ({@link ILlmFunction}). Does not include
91
+ * an executor—use {@link controller} if you need execution capability.
92
+ *
93
+ * Each {@link ILlmFunction} includes a built-in {@link ILlmFunction.validate}
94
+ * function that validates LLM-generated arguments before execution. When
95
+ * validation fails, use `LlmJson.stringify()` from `@typia/utils` to format
96
+ * errors for LLM feedback, enabling auto-correction.
97
+ *
98
+ * When passed to LLM providers (ChatGPT, Claude, Gemini, etc.), the LLM
99
+ * automatically selects functions and fills arguments from conversation. You
100
+ * execute the function manually with the LLM-prepared arguments.
101
+ *
102
+ * Related functions:
103
+ *
104
+ * - {@link controller} — Includes executor alongside schemas
105
+ * - {@link parameters} — Single parameters schema for structured output
106
+ * - {@link schema} — Single type schema
107
+ *
108
+ * @template Class Target class or interface type
109
+ * @template Config LLM schema configuration
110
+ * @param config LLM application options
111
+ * @returns LLM function calling application
112
+ */
113
+ export function application<
114
+ Class extends Record<string, any>,
115
+ Config extends Partial<
116
+ ILlmSchema.IConfig & {
117
+ /**
118
+ * Whether to disallow superfluous properties or not.
119
+ *
120
+ * If configure as `true`, {@link validateEquals} function would be used
121
+ * for validation feedback, which is more strict than {@link validate}
122
+ * function.
123
+ *
124
+ * @default false
125
+ */
126
+ equals: boolean;
127
+ }
128
+ > = {},
129
+ >(
130
+ config?: Partial<Pick<ILlmApplication.IConfig<Class>, "validate">>,
131
+ ): ILlmApplication<Class>;
132
+
133
+ /** @internal */
134
+ export function application(): never {
135
+ NoTransformConfigurationError("llm.application");
136
+ }
137
+
138
+ /**
139
+ * Creates LLM parameters schema.
140
+ *
141
+ * @danger You must configure the generic argument `Parameters`
142
+ */
143
+ export function parameters(): never;
144
+
145
+ /**
146
+ * Creates LLM parameters schema from TypeScript object type.
147
+ *
148
+ * Generates {@link ILlmSchema.IParameters} for LLM function calling or
149
+ * structured outputs. LLMs use keyworded arguments only, so the type must be an
150
+ * object with static properties (no dynamic properties allowed).
151
+ *
152
+ * Use cases:
153
+ *
154
+ * - Function calling: LLM fills parameters from conversation
155
+ * - Structured outputs: LLM generates structured data, not plain text
156
+ *
157
+ * Related functions:
158
+ *
159
+ * - {@link application} — Multiple function schemas from class/interface
160
+ * - {@link controller} — Application with executor
161
+ * - {@link schema} — Single type schema (not parameters-specific)
162
+ *
163
+ * @template Parameters Target parameters type (object with static properties)
164
+ * @template Config LLM schema configuration
165
+ * @returns LLM parameters schema
166
+ */
167
+ export function parameters<
168
+ Parameters extends Record<string, any>,
169
+ Config extends Partial<ILlmSchema.IConfig> = {},
170
+ >(): ILlmSchema.IParameters;
171
+
172
+ /** @internal */
173
+ export function parameters(): never {
174
+ NoTransformConfigurationError("llm.parameters");
175
+ }
176
+
177
+ /**
178
+ * Creates LLM type schema.
179
+ *
180
+ * @danger You must configure the generic argument `T`
181
+ */
182
+ export function schema(): never;
183
+
184
+ /**
185
+ * Creates LLM type schema from TypeScript type.
186
+ *
187
+ * Generates {@link ILlmSchema} for use in LLM function calling. For actual
188
+ * function calling with TypeScript functions, use {@link application}. For
189
+ * structured output generation, use {@link parameters}.
190
+ *
191
+ * LLM function calling flow:
192
+ *
193
+ * 1. LLM selects function and fills arguments from conversation
194
+ * 2. You execute the function with LLM-prepared arguments
195
+ * 3. Return value is passed back to LLM via system prompt
196
+ * 4. LLM continues conversation based on return value
197
+ *
198
+ * Related functions:
199
+ *
200
+ * - {@link application} — Multiple function schemas from class/interface
201
+ * - {@link controller} — Application with executor
202
+ * - {@link parameters} — Parameters schema for structured output
203
+ *
204
+ * @template T Target type
205
+ * @template Config LLM schema configuration
206
+ * @param $defs Shared schema definitions for `$ref` referencing
207
+ * @returns LLM type schema
208
+ */
209
+ export function schema<T, Config extends Partial<ILlmSchema.IConfig> = {}>(
210
+ $defs: Record<string, ILlmSchema>,
211
+ ): ILlmSchema;
212
+
213
+ /** @internal */
214
+ export function schema(): never {
215
+ NoTransformConfigurationError("llm.schema");
216
+ }
217
+
218
+ /**
219
+ * Parse LLM response JSON with type coercion.
220
+ *
221
+ * @danger You must configure the generic argument `Parameters`
222
+ */
223
+ export function parse(input: string): never;
224
+
225
+ /**
226
+ * Parse lenient JSON with schema-based type coercion.
227
+ *
228
+ * Handles incomplete or malformed JSON commonly produced by LLMs:
229
+ *
230
+ * - Unclosed brackets, strings, trailing commas
231
+ * - JavaScript-style comments (`//` and multi-line)
232
+ * - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
233
+ * - Markdown code block extraction, junk prefix skipping
234
+ *
235
+ * Also coerces double-stringified values based on the `Parameters` schema:
236
+ *
237
+ * - `"42"` → `42` (when schema expects number)
238
+ * - `"true"` → `true` (when schema expects boolean)
239
+ * - `"null"` → `null` (when schema expects null)
240
+ * - `"{...}"` → `{...}` (when schema expects object)
241
+ * - `"[...]"` → `[...]` (when schema expects array)
242
+ *
243
+ * Type validation is NOT performed—use {@link ILlmFunction.validate} or
244
+ * `typia.validate()` for that.
245
+ *
246
+ * For repeated parsing, use {@link createParse} to avoid regenerating the schema
247
+ * each time.
248
+ *
249
+ * Related functions:
250
+ *
251
+ * - {@link createParse} — Create reusable parser function
252
+ * - {@link coerce} — Type coercion for already-parsed objects
253
+ * - {@link parameters} — Generate parameters schema from type
254
+ *
255
+ * @template Parameters Target parameters type (object with static properties)
256
+ * @template Config LLM schema configuration
257
+ * @param input Raw JSON string (potentially incomplete or malformed)
258
+ * @returns Parse result with typed data on success, or partial data with errors
259
+ */
260
+ export function parse<
261
+ Parameters extends Record<string, any>,
262
+ Config extends Partial<ILlmSchema.IConfig> = {},
263
+ >(input: string): IJsonParseResult<Parameters>;
264
+
265
+ /** @internal */
266
+ export function parse(): never {
267
+ NoTransformConfigurationError("llm.parse");
268
+ }
269
+
270
+ /**
271
+ * Coerce LLM arguments to match expected schema types.
272
+ *
273
+ * LLMs often return values with incorrect types (e.g., numbers as strings).
274
+ * This function recursively coerces values based on the `Parameters` schema:
275
+ *
276
+ * - `"42"` → `42` (when schema expects number)
277
+ * - `"true"` → `true` (when schema expects boolean)
278
+ * - `"null"` → `null` (when schema expects null)
279
+ * - `"{...}"` → `{...}` (when schema expects object)
280
+ * - `"[...]"` → `[...]` (when schema expects array)
281
+ *
282
+ * Use this when your SDK provides already-parsed objects but values may have
283
+ * wrong types. For raw JSON strings, use {@link parse} instead.
284
+ *
285
+ * For repeated coercion, use {@link createCoerce} to avoid regenerating the
286
+ * schema each time.
287
+ *
288
+ * Type validation is NOT performed—use {@link ILlmFunction.validate} or
289
+ * `typia.validate()` for that.
290
+ *
291
+ * Related functions:
292
+ *
293
+ * - {@link createCoerce} — Create reusable coercer function
294
+ * - {@link parse} — Parse and coerce raw JSON strings
295
+ * - {@link parameters} — Generate parameters schema from type
296
+ *
297
+ * @template Parameters Target parameters type (object with static properties)
298
+ * @template Config LLM schema configuration
299
+ * @param input Parsed arguments object from LLM (with potentially wrong types)
300
+ * @returns Coerced arguments with corrected types
301
+ */
302
+ export function coerce<
303
+ Parameters extends Record<string, any>,
304
+ Config extends Partial<ILlmSchema.IConfig> = {},
305
+ >(input: Parameters): Parameters;
306
+
307
+ /** @internal */
308
+ export function coerce(): never {
309
+ NoTransformConfigurationError("llm.coerce");
310
+ }
311
+
312
+ /**
313
+ * Create reusable LLM JSON parser with type coercion.
314
+ *
315
+ * @danger You must configure the generic argument `Parameters`
316
+ */
317
+ export function createParse(): never;
318
+
319
+ /**
320
+ * Create reusable lenient JSON parser with schema-based type coercion.
321
+ *
322
+ * Returns a parser function that handles incomplete or malformed JSON commonly
323
+ * produced by LLMs:
324
+ *
325
+ * - Unclosed brackets, strings, trailing commas
326
+ * - JavaScript-style comments (`//` and multi-line)
327
+ * - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
328
+ * - Markdown code block extraction, junk prefix skipping
329
+ *
330
+ * Also coerces double-stringified values based on the `Parameters` schema:
331
+ *
332
+ * - `"42"` → `42` (when schema expects number)
333
+ * - `"true"` → `true` (when schema expects boolean)
334
+ * - `"null"` → `null` (when schema expects null)
335
+ * - `"{...}"` → `{...}` (when schema expects object)
336
+ * - `"[...]"` → `[...]` (when schema expects array)
337
+ *
338
+ * Use this instead of {@link parse} when parsing multiple inputs to avoid
339
+ * regenerating the schema each time.
340
+ *
341
+ * Type validation is NOT performed—use {@link ILlmFunction.validate} or
342
+ * `typia.validate()` for that.
343
+ *
344
+ * Related functions:
345
+ *
346
+ * - {@link parse} — One-shot parsing (regenerates schema each call)
347
+ * - {@link createCoerce} — Create reusable coercer function
348
+ * - {@link parameters} — Generate parameters schema from type
349
+ *
350
+ * @template Parameters Target parameters type (object with static properties)
351
+ * @template Config LLM schema configuration
352
+ * @returns Reusable parser function
353
+ */
354
+ export function createParse<
355
+ Parameters extends Record<string, any>,
356
+ Config extends Partial<ILlmSchema.IConfig> = {},
357
+ >(): (input: string) => IJsonParseResult<Parameters>;
358
+
359
+ /** @internal */
360
+ export function createParse(): never {
361
+ NoTransformConfigurationError("llm.createParse");
362
+ }
363
+
364
+ /**
365
+ * Create reusable LLM arguments coercer.
366
+ *
367
+ * @danger You must configure the generic argument `Parameters`
368
+ */
369
+ export function createCoerce(): never;
370
+
371
+ /**
372
+ * Create reusable coercer for LLM arguments.
373
+ *
374
+ * Returns a coercer function that fixes incorrect types commonly returned by
375
+ * LLMs (e.g., numbers as strings). Coerces values based on the `Parameters`
376
+ * schema:
377
+ *
378
+ * - `"42"` → `42` (when schema expects number)
379
+ * - `"true"` → `true` (when schema expects boolean)
380
+ * - `"null"` → `null` (when schema expects null)
381
+ * - `"{...}"` → `{...}` (when schema expects object)
382
+ * - `"[...]"` → `[...]` (when schema expects array)
383
+ *
384
+ * Use this instead of {@link coerce} when coercing multiple inputs to avoid
385
+ * regenerating the schema each time.
386
+ *
387
+ * Type validation is NOT performed—use {@link ILlmFunction.validate} or
388
+ * `typia.validate()` for that.
389
+ *
390
+ * Related functions:
391
+ *
392
+ * - {@link coerce} — One-shot coercion (regenerates schema each call)
393
+ * - {@link createParse} — Create reusable parser function
394
+ * - {@link parameters} — Generate parameters schema from type
395
+ *
396
+ * @template Parameters Target parameters type (object with static properties)
397
+ * @template Config LLM schema configuration
398
+ * @returns Reusable coercer function
399
+ */
400
+ export function createCoerce<
401
+ Parameters extends Record<string, any>,
402
+ Config extends Partial<ILlmSchema.IConfig> = {},
403
+ >(): (input: Parameters) => Parameters;
404
+
405
+ /** @internal */
406
+ export function createCoerce(): never {
407
+ NoTransformConfigurationError("llm.createCoerce");
408
+ }