@typia/interface 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.
- package/lib/http/IHttpLlmController.d.ts +5 -5
- package/lib/schema/IJsonParseResult.d.ts +1 -3
- package/lib/schema/ILlmController.d.ts +2 -5
- package/package.json +1 -1
- package/src/http/IHttpConnection.ts +200 -200
- package/src/http/IHttpLlmApplication.ts +72 -72
- package/src/http/IHttpLlmController.ts +96 -96
- package/src/http/IHttpLlmFunction.ts +34 -34
- package/src/http/IHttpMigrateApplication.ts +48 -48
- package/src/http/IHttpMigrateRoute.ts +165 -165
- package/src/http/IHttpResponse.ts +42 -42
- package/src/http/index.ts +7 -7
- package/src/index.ts +9 -9
- package/src/metadata/IJsDocTagInfo.ts +25 -25
- package/src/metadata/IMetadataComponents.ts +24 -24
- package/src/metadata/IMetadataSchema.ts +293 -293
- package/src/metadata/IMetadataSchemaCollection.ts +20 -20
- package/src/metadata/IMetadataSchemaUnit.ts +20 -20
- package/src/metadata/IMetadataTypeTag.ts +39 -39
- package/src/metadata/index.ts +6 -6
- package/src/openapi/OpenApi.ts +643 -643
- package/src/openapi/OpenApiV3.ts +655 -655
- package/src/openapi/OpenApiV3_1.ts +735 -735
- package/src/openapi/SwaggerV2.ts +559 -559
- package/src/openapi/index.ts +4 -4
- package/src/protobuf/ProtobufWire.ts +51 -51
- package/src/protobuf/index.ts +1 -1
- package/src/schema/IJsonParseResult.ts +134 -136
- package/src/schema/IJsonSchemaApplication.ts +274 -274
- package/src/schema/IJsonSchemaAttribute.ts +158 -158
- package/src/schema/IJsonSchemaCollection.ts +123 -123
- package/src/schema/IJsonSchemaTransformError.ts +86 -86
- package/src/schema/IJsonSchemaUnit.ts +120 -120
- package/src/schema/ILlmApplication.ts +99 -99
- package/src/schema/ILlmController.ts +54 -57
- package/src/schema/ILlmFunction.ts +145 -145
- package/src/schema/ILlmSchema.ts +484 -484
- package/src/schema/IResult.ts +84 -84
- package/src/schema/IValidation.ts +134 -134
- package/src/schema/index.ts +14 -14
- package/src/tags/Constant.ts +49 -49
- package/src/tags/ContentMediaType.ts +40 -40
- package/src/tags/Default.ts +50 -50
- package/src/tags/Example.ts +48 -48
- package/src/tags/Examples.ts +50 -50
- package/src/tags/ExclusiveMaximum.ts +46 -46
- package/src/tags/ExclusiveMinimum.ts +46 -46
- package/src/tags/Format.ts +76 -76
- package/src/tags/JsonSchemaPlugin.ts +45 -45
- package/src/tags/MaxItems.ts +39 -39
- package/src/tags/MaxLength.ts +37 -37
- package/src/tags/Maximum.ts +44 -44
- package/src/tags/MinItems.ts +39 -39
- package/src/tags/MinLength.ts +37 -37
- package/src/tags/Minimum.ts +44 -44
- package/src/tags/MultipleOf.ts +54 -54
- package/src/tags/Pattern.ts +59 -59
- package/src/tags/Sequence.ts +43 -43
- package/src/tags/TagBase.ts +131 -131
- package/src/tags/Type.ts +70 -70
- package/src/tags/UniqueItems.ts +44 -44
- package/src/tags/index.ts +21 -21
- package/src/typings/AssertionGuard.ts +12 -12
- package/src/typings/Atomic.ts +21 -21
- package/src/typings/CamelCase.ts +75 -75
- package/src/typings/ClassProperties.ts +15 -15
- package/src/typings/DeepPartial.ts +39 -39
- package/src/typings/OmitNever.ts +12 -12
- package/src/typings/PascalCase.ts +71 -71
- package/src/typings/Primitive.ts +71 -71
- package/src/typings/ProtobufAtomic.ts +30 -30
- package/src/typings/Resolved.ts +58 -58
- package/src/typings/SnakeCase.ts +126 -126
- package/src/typings/SpecialFields.ts +13 -13
- package/src/typings/ValidationPipe.ts +20 -20
- package/src/typings/index.ts +14 -14
- package/src/typings/internal/Equal.ts +14 -14
- package/src/typings/internal/IsTuple.ts +17 -17
- package/src/typings/internal/NativeClass.ts +31 -31
- package/src/typings/internal/ValueOf.ts +29 -29
- package/src/utils/IRandomGenerator.ts +105 -105
- package/src/utils/IReadableURLSearchParams.ts +25 -25
- package/src/utils/index.ts +2 -2
|
@@ -1,57 +1,54 @@
|
|
|
1
|
-
import { ILlmApplication } from "./ILlmApplication";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Controller of TypeScript class-based LLM function calling.
|
|
5
|
-
*
|
|
6
|
-
* `ILlmController` is a controller for registering TypeScript class methods as
|
|
7
|
-
* LLM function calling tools. It contains {@link ILlmApplication} with
|
|
8
|
-
* {@link ILlmFunction function calling schemas}, {@link name identifier}, and
|
|
9
|
-
* {@link execute class instance} for method execution.
|
|
10
|
-
*
|
|
11
|
-
* You can create this controller with `typia.llm.controller<Class>()` function,
|
|
12
|
-
* and register it to MCP server with {@link registerMcpControllers}:
|
|
13
|
-
*
|
|
14
|
-
* ```typescript
|
|
15
|
-
* import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
-
* import
|
|
17
|
-
* import
|
|
18
|
-
*
|
|
19
|
-
* class Calculator {
|
|
20
|
-
* add(input: { a: number; b: number }): number {
|
|
21
|
-
* return input.a + input.b;
|
|
22
|
-
* }
|
|
23
|
-
* subtract(input: { a: number; b: number }): number {
|
|
24
|
-
* return input.a - input.b;
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
*
|
|
28
|
-
* const server = new McpServer({ name: "my-server", version: "1.0.0" });
|
|
29
|
-
* registerMcpControllers({
|
|
30
|
-
* server,
|
|
31
|
-
* controllers: [
|
|
32
|
-
* typia.llm.controller<Calculator>(
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* }
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/** Target class instance for function execution. */
|
|
56
|
-
execute: Class;
|
|
57
|
-
}
|
|
1
|
+
import { ILlmApplication } from "./ILlmApplication";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Controller of TypeScript class-based LLM function calling.
|
|
5
|
+
*
|
|
6
|
+
* `ILlmController` is a controller for registering TypeScript class methods as
|
|
7
|
+
* LLM function calling tools. It contains {@link ILlmApplication} with
|
|
8
|
+
* {@link ILlmFunction function calling schemas}, {@link name identifier}, and
|
|
9
|
+
* {@link execute class instance} for method execution.
|
|
10
|
+
*
|
|
11
|
+
* You can create this controller with `typia.llm.controller<Class>()` function,
|
|
12
|
+
* and register it to MCP server with {@link registerMcpControllers}:
|
|
13
|
+
*
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
* import { registerMcpControllers } from "@typia/mcp";
|
|
17
|
+
* import typia from "typia";
|
|
18
|
+
*
|
|
19
|
+
* class Calculator {
|
|
20
|
+
* add(input: { a: number; b: number }): number {
|
|
21
|
+
* return input.a + input.b;
|
|
22
|
+
* }
|
|
23
|
+
* subtract(input: { a: number; b: number }): number {
|
|
24
|
+
* return input.a - input.b;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* const server = new McpServer({ name: "my-server", version: "1.0.0" });
|
|
29
|
+
* registerMcpControllers({
|
|
30
|
+
* server,
|
|
31
|
+
* controllers: [
|
|
32
|
+
* typia.llm.controller<Calculator>("calculator", new Calculator()),
|
|
33
|
+
* ],
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* For OpenAPI/HTTP-based controller, use {@link IHttpLlmController} instead.
|
|
38
|
+
*
|
|
39
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
40
|
+
* @template Class Class type of the function executor
|
|
41
|
+
*/
|
|
42
|
+
export interface ILlmController<Class extends object = any> {
|
|
43
|
+
/** Protocol discriminator. */
|
|
44
|
+
protocol: "class";
|
|
45
|
+
|
|
46
|
+
/** Identifier name of the controller. */
|
|
47
|
+
name: string;
|
|
48
|
+
|
|
49
|
+
/** Application schema of function calling. */
|
|
50
|
+
application: ILlmApplication<Class>;
|
|
51
|
+
|
|
52
|
+
/** Target class instance for function execution. */
|
|
53
|
+
execute: Class;
|
|
54
|
+
}
|
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
import { tags } from "..";
|
|
2
|
-
import { IJsonParseResult } from "./IJsonParseResult";
|
|
3
|
-
import { ILlmSchema } from "./ILlmSchema";
|
|
4
|
-
import { IValidation } from "./IValidation";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* LLM function calling schema for TypeScript functions.
|
|
8
|
-
*
|
|
9
|
-
* Generated by `typia.llm.application<App>()` as part of
|
|
10
|
-
* {@link ILlmApplication}.
|
|
11
|
-
*
|
|
12
|
-
* - {@link name}: Function identifier (max 64 chars for OpenAI)
|
|
13
|
-
* - {@link parameters}: Input schema, {@link output}: Return schema
|
|
14
|
-
* - {@link description}: Guides LLM function selection
|
|
15
|
-
* - {@link parse}: Lenient JSON parser with type coercion
|
|
16
|
-
* - {@link validate}: Argument validator for LLM error correction
|
|
17
|
-
*
|
|
18
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
19
|
-
*/
|
|
20
|
-
export interface ILlmFunction {
|
|
21
|
-
/**
|
|
22
|
-
* Function name for LLM invocation.
|
|
23
|
-
*
|
|
24
|
-
* The identifier used by the LLM to call this function. Must be unique within
|
|
25
|
-
* the application.
|
|
26
|
-
*
|
|
27
|
-
* OpenAI limits function names to 64 characters.
|
|
28
|
-
*/
|
|
29
|
-
name: string & tags.MaxLength<64>;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Schema for function parameters.
|
|
33
|
-
*
|
|
34
|
-
* Defines the expected argument types as a JSON Schema object. Contains
|
|
35
|
-
* `$defs` for shared type definitions and `properties` for each named
|
|
36
|
-
* parameter.
|
|
37
|
-
*/
|
|
38
|
-
parameters: ILlmSchema.IParameters;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Schema for the return type.
|
|
42
|
-
*
|
|
43
|
-
* Defines the expected output type as an object parameters schema, wrapping
|
|
44
|
-
* the return type in an {@link ILlmSchema.IParameters} object with `$defs` for
|
|
45
|
-
* shared type definitions and `properties` for the structured output.
|
|
46
|
-
*
|
|
47
|
-
* `undefined` when the function returns `void` or has no meaningful return
|
|
48
|
-
* value.
|
|
49
|
-
*/
|
|
50
|
-
output?: ILlmSchema.IParameters | undefined;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Human-readable function description.
|
|
54
|
-
*
|
|
55
|
-
* Explains what the function does, when to use it, and any important
|
|
56
|
-
* considerations. This description is crucial for LLMs to understand when to
|
|
57
|
-
* invoke this function. Extracted from JSDoc comments.
|
|
58
|
-
*/
|
|
59
|
-
description?: string | undefined;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Whether this function is deprecated.
|
|
63
|
-
*
|
|
64
|
-
* When `true`, indicates the function should no longer be used. LLMs may
|
|
65
|
-
* still invoke deprecated functions but should prefer non-deprecated
|
|
66
|
-
* alternatives when available.
|
|
67
|
-
*/
|
|
68
|
-
deprecated?: boolean | undefined;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Category tags for function organization.
|
|
72
|
-
*
|
|
73
|
-
* Extracted from `@tag` JSDoc annotations. Useful for grouping related
|
|
74
|
-
* functions and filtering the function list.
|
|
75
|
-
*/
|
|
76
|
-
tags?: string[] | undefined;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Lenient JSON parser with schema-based coercion.
|
|
80
|
-
*
|
|
81
|
-
* Handles incomplete/malformed JSON commonly produced by LLMs:
|
|
82
|
-
*
|
|
83
|
-
* - Unclosed brackets, strings, trailing commas
|
|
84
|
-
* - JavaScript-style comments (`//` and multi-line)
|
|
85
|
-
* - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
|
|
86
|
-
* - Markdown code block extraction, junk prefix skipping
|
|
87
|
-
*
|
|
88
|
-
* Also coerces double-stringified values (`"42"` → `42`) using the
|
|
89
|
-
* {@link parameters} schema.
|
|
90
|
-
*
|
|
91
|
-
* Type validation is NOT performed — use {@link validate} after parsing.
|
|
92
|
-
*
|
|
93
|
-
* If the SDK (e.g., LangChain, Vercel AI, MCP) already parses JSON internally
|
|
94
|
-
* and provides a pre-parsed object, use {@link coerce} instead to apply
|
|
95
|
-
* schema-based type coercion without re-parsing.
|
|
96
|
-
*
|
|
97
|
-
* @param str Raw JSON string from LLM output
|
|
98
|
-
* @returns Parse result with data on success, or partial data with errors
|
|
99
|
-
*/
|
|
100
|
-
parse: (str: string) => IJsonParseResult<unknown>;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Coerce pre-parsed arguments to match expected schema types.
|
|
104
|
-
*
|
|
105
|
-
* **Use this only when the SDK (e.g., LangChain, Vercel AI, MCP) already
|
|
106
|
-
* parses JSON internally.** For raw JSON strings from LLM output, use
|
|
107
|
-
* {@link parse} instead — it handles both lenient parsing and type coercion in
|
|
108
|
-
* one step.
|
|
109
|
-
*
|
|
110
|
-
* LLMs often return values with incorrect types even after parsing:
|
|
111
|
-
*
|
|
112
|
-
* - `"42"` → `42` (when schema expects number)
|
|
113
|
-
* - `"true"` → `true` (when schema expects boolean)
|
|
114
|
-
* - `"null"` → `null` (when schema expects null)
|
|
115
|
-
* - `"{...}"` → `{...}` (when schema expects object)
|
|
116
|
-
* - `"[...]"` → `[...]` (when schema expects array)
|
|
117
|
-
*
|
|
118
|
-
* This function recursively coerces these double-stringified values based on
|
|
119
|
-
* the {@link parameters} schema.
|
|
120
|
-
*
|
|
121
|
-
* Type validation is NOT performed — use {@link validate} after coercion.
|
|
122
|
-
*
|
|
123
|
-
* @param data Pre-parsed arguments object from SDK
|
|
124
|
-
* @returns Coerced arguments with corrected types
|
|
125
|
-
*/
|
|
126
|
-
coerce: (data: unknown) => unknown;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Validates LLM-generated arguments against the schema.
|
|
130
|
-
*
|
|
131
|
-
* LLMs frequently make type errors such as returning strings instead of
|
|
132
|
-
* numbers or missing required properties. Use this validator to check
|
|
133
|
-
* arguments before execution.
|
|
134
|
-
*
|
|
135
|
-
* When validation fails, use {@link LlmJson.stringify} from `@typia/utils` to
|
|
136
|
-
* format the error for LLM feedback. The formatted output shows the invalid
|
|
137
|
-
* JSON with inline error comments, helping the LLM understand and correct its
|
|
138
|
-
* mistakes in the next turn.
|
|
139
|
-
*
|
|
140
|
-
* @param args The arguments generated by the LLM
|
|
141
|
-
* @returns Validation result with success status and any errors
|
|
142
|
-
* @see stringifyValidationFailure Format errors for LLM auto-correction
|
|
143
|
-
*/
|
|
144
|
-
validate: (args: unknown) => IValidation<unknown>;
|
|
145
|
-
}
|
|
1
|
+
import { tags } from "..";
|
|
2
|
+
import { IJsonParseResult } from "./IJsonParseResult";
|
|
3
|
+
import { ILlmSchema } from "./ILlmSchema";
|
|
4
|
+
import { IValidation } from "./IValidation";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LLM function calling schema for TypeScript functions.
|
|
8
|
+
*
|
|
9
|
+
* Generated by `typia.llm.application<App>()` as part of
|
|
10
|
+
* {@link ILlmApplication}.
|
|
11
|
+
*
|
|
12
|
+
* - {@link name}: Function identifier (max 64 chars for OpenAI)
|
|
13
|
+
* - {@link parameters}: Input schema, {@link output}: Return schema
|
|
14
|
+
* - {@link description}: Guides LLM function selection
|
|
15
|
+
* - {@link parse}: Lenient JSON parser with type coercion
|
|
16
|
+
* - {@link validate}: Argument validator for LLM error correction
|
|
17
|
+
*
|
|
18
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
19
|
+
*/
|
|
20
|
+
export interface ILlmFunction {
|
|
21
|
+
/**
|
|
22
|
+
* Function name for LLM invocation.
|
|
23
|
+
*
|
|
24
|
+
* The identifier used by the LLM to call this function. Must be unique within
|
|
25
|
+
* the application.
|
|
26
|
+
*
|
|
27
|
+
* OpenAI limits function names to 64 characters.
|
|
28
|
+
*/
|
|
29
|
+
name: string & tags.MaxLength<64>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Schema for function parameters.
|
|
33
|
+
*
|
|
34
|
+
* Defines the expected argument types as a JSON Schema object. Contains
|
|
35
|
+
* `$defs` for shared type definitions and `properties` for each named
|
|
36
|
+
* parameter.
|
|
37
|
+
*/
|
|
38
|
+
parameters: ILlmSchema.IParameters;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Schema for the return type.
|
|
42
|
+
*
|
|
43
|
+
* Defines the expected output type as an object parameters schema, wrapping
|
|
44
|
+
* the return type in an {@link ILlmSchema.IParameters} object with `$defs` for
|
|
45
|
+
* shared type definitions and `properties` for the structured output.
|
|
46
|
+
*
|
|
47
|
+
* `undefined` when the function returns `void` or has no meaningful return
|
|
48
|
+
* value.
|
|
49
|
+
*/
|
|
50
|
+
output?: ILlmSchema.IParameters | undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Human-readable function description.
|
|
54
|
+
*
|
|
55
|
+
* Explains what the function does, when to use it, and any important
|
|
56
|
+
* considerations. This description is crucial for LLMs to understand when to
|
|
57
|
+
* invoke this function. Extracted from JSDoc comments.
|
|
58
|
+
*/
|
|
59
|
+
description?: string | undefined;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Whether this function is deprecated.
|
|
63
|
+
*
|
|
64
|
+
* When `true`, indicates the function should no longer be used. LLMs may
|
|
65
|
+
* still invoke deprecated functions but should prefer non-deprecated
|
|
66
|
+
* alternatives when available.
|
|
67
|
+
*/
|
|
68
|
+
deprecated?: boolean | undefined;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Category tags for function organization.
|
|
72
|
+
*
|
|
73
|
+
* Extracted from `@tag` JSDoc annotations. Useful for grouping related
|
|
74
|
+
* functions and filtering the function list.
|
|
75
|
+
*/
|
|
76
|
+
tags?: string[] | undefined;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Lenient JSON parser with schema-based coercion.
|
|
80
|
+
*
|
|
81
|
+
* Handles incomplete/malformed JSON commonly produced by LLMs:
|
|
82
|
+
*
|
|
83
|
+
* - Unclosed brackets, strings, trailing commas
|
|
84
|
+
* - JavaScript-style comments (`//` and multi-line)
|
|
85
|
+
* - Unquoted object keys, incomplete keywords (`tru`, `fal`, `nul`)
|
|
86
|
+
* - Markdown code block extraction, junk prefix skipping
|
|
87
|
+
*
|
|
88
|
+
* Also coerces double-stringified values (`"42"` → `42`) using the
|
|
89
|
+
* {@link parameters} schema.
|
|
90
|
+
*
|
|
91
|
+
* Type validation is NOT performed — use {@link validate} after parsing.
|
|
92
|
+
*
|
|
93
|
+
* If the SDK (e.g., LangChain, Vercel AI, MCP) already parses JSON internally
|
|
94
|
+
* and provides a pre-parsed object, use {@link coerce} instead to apply
|
|
95
|
+
* schema-based type coercion without re-parsing.
|
|
96
|
+
*
|
|
97
|
+
* @param str Raw JSON string from LLM output
|
|
98
|
+
* @returns Parse result with data on success, or partial data with errors
|
|
99
|
+
*/
|
|
100
|
+
parse: (str: string) => IJsonParseResult<unknown>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Coerce pre-parsed arguments to match expected schema types.
|
|
104
|
+
*
|
|
105
|
+
* **Use this only when the SDK (e.g., LangChain, Vercel AI, MCP) already
|
|
106
|
+
* parses JSON internally.** For raw JSON strings from LLM output, use
|
|
107
|
+
* {@link parse} instead — it handles both lenient parsing and type coercion in
|
|
108
|
+
* one step.
|
|
109
|
+
*
|
|
110
|
+
* LLMs often return values with incorrect types even after parsing:
|
|
111
|
+
*
|
|
112
|
+
* - `"42"` → `42` (when schema expects number)
|
|
113
|
+
* - `"true"` → `true` (when schema expects boolean)
|
|
114
|
+
* - `"null"` → `null` (when schema expects null)
|
|
115
|
+
* - `"{...}"` → `{...}` (when schema expects object)
|
|
116
|
+
* - `"[...]"` → `[...]` (when schema expects array)
|
|
117
|
+
*
|
|
118
|
+
* This function recursively coerces these double-stringified values based on
|
|
119
|
+
* the {@link parameters} schema.
|
|
120
|
+
*
|
|
121
|
+
* Type validation is NOT performed — use {@link validate} after coercion.
|
|
122
|
+
*
|
|
123
|
+
* @param data Pre-parsed arguments object from SDK
|
|
124
|
+
* @returns Coerced arguments with corrected types
|
|
125
|
+
*/
|
|
126
|
+
coerce: (data: unknown) => unknown;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Validates LLM-generated arguments against the schema.
|
|
130
|
+
*
|
|
131
|
+
* LLMs frequently make type errors such as returning strings instead of
|
|
132
|
+
* numbers or missing required properties. Use this validator to check
|
|
133
|
+
* arguments before execution.
|
|
134
|
+
*
|
|
135
|
+
* When validation fails, use {@link LlmJson.stringify} from `@typia/utils` to
|
|
136
|
+
* format the error for LLM feedback. The formatted output shows the invalid
|
|
137
|
+
* JSON with inline error comments, helping the LLM understand and correct its
|
|
138
|
+
* mistakes in the next turn.
|
|
139
|
+
*
|
|
140
|
+
* @param args The arguments generated by the LLM
|
|
141
|
+
* @returns Validation result with success status and any errors
|
|
142
|
+
* @see stringifyValidationFailure Format errors for LLM auto-correction
|
|
143
|
+
*/
|
|
144
|
+
validate: (args: unknown) => IValidation<unknown>;
|
|
145
|
+
}
|