@typia/interface 12.0.0-dev.20260309 → 12.0.0-dev.20260311

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 (85) hide show
  1. package/lib/http/IHttpLlmController.d.ts +5 -5
  2. package/lib/schema/IJsonParseResult.d.ts +1 -3
  3. package/lib/schema/ILlmApplication.d.ts +1 -2
  4. package/lib/schema/ILlmController.d.ts +2 -5
  5. package/lib/schema/ILlmSchema.d.ts +1 -11
  6. package/package.json +1 -1
  7. package/src/http/IHttpConnection.ts +200 -200
  8. package/src/http/IHttpLlmApplication.ts +72 -72
  9. package/src/http/IHttpLlmController.ts +96 -96
  10. package/src/http/IHttpLlmFunction.ts +34 -34
  11. package/src/http/IHttpMigrateApplication.ts +48 -48
  12. package/src/http/IHttpMigrateRoute.ts +165 -165
  13. package/src/http/IHttpResponse.ts +42 -42
  14. package/src/http/index.ts +7 -7
  15. package/src/index.ts +9 -9
  16. package/src/metadata/IJsDocTagInfo.ts +25 -25
  17. package/src/metadata/IMetadataComponents.ts +24 -24
  18. package/src/metadata/IMetadataSchema.ts +293 -293
  19. package/src/metadata/IMetadataSchemaCollection.ts +20 -20
  20. package/src/metadata/IMetadataSchemaUnit.ts +20 -20
  21. package/src/metadata/IMetadataTypeTag.ts +39 -39
  22. package/src/metadata/index.ts +6 -6
  23. package/src/openapi/OpenApi.ts +643 -643
  24. package/src/openapi/OpenApiV3.ts +655 -655
  25. package/src/openapi/OpenApiV3_1.ts +735 -735
  26. package/src/openapi/SwaggerV2.ts +559 -559
  27. package/src/openapi/index.ts +4 -4
  28. package/src/protobuf/ProtobufWire.ts +51 -51
  29. package/src/protobuf/index.ts +1 -1
  30. package/src/schema/IJsonParseResult.ts +134 -136
  31. package/src/schema/IJsonSchemaApplication.ts +274 -274
  32. package/src/schema/IJsonSchemaAttribute.ts +158 -158
  33. package/src/schema/IJsonSchemaCollection.ts +123 -123
  34. package/src/schema/IJsonSchemaTransformError.ts +86 -86
  35. package/src/schema/IJsonSchemaUnit.ts +120 -120
  36. package/src/schema/ILlmApplication.ts +98 -99
  37. package/src/schema/ILlmController.ts +54 -57
  38. package/src/schema/ILlmFunction.ts +145 -145
  39. package/src/schema/ILlmSchema.ts +473 -484
  40. package/src/schema/IResult.ts +84 -84
  41. package/src/schema/IValidation.ts +134 -134
  42. package/src/schema/index.ts +14 -14
  43. package/src/tags/Constant.ts +49 -49
  44. package/src/tags/ContentMediaType.ts +40 -40
  45. package/src/tags/Default.ts +50 -50
  46. package/src/tags/Example.ts +48 -48
  47. package/src/tags/Examples.ts +50 -50
  48. package/src/tags/ExclusiveMaximum.ts +46 -46
  49. package/src/tags/ExclusiveMinimum.ts +46 -46
  50. package/src/tags/Format.ts +76 -76
  51. package/src/tags/JsonSchemaPlugin.ts +45 -45
  52. package/src/tags/MaxItems.ts +39 -39
  53. package/src/tags/MaxLength.ts +37 -37
  54. package/src/tags/Maximum.ts +44 -44
  55. package/src/tags/MinItems.ts +39 -39
  56. package/src/tags/MinLength.ts +37 -37
  57. package/src/tags/Minimum.ts +44 -44
  58. package/src/tags/MultipleOf.ts +54 -54
  59. package/src/tags/Pattern.ts +59 -59
  60. package/src/tags/Sequence.ts +43 -43
  61. package/src/tags/TagBase.ts +131 -131
  62. package/src/tags/Type.ts +70 -70
  63. package/src/tags/UniqueItems.ts +44 -44
  64. package/src/tags/index.ts +21 -21
  65. package/src/typings/AssertionGuard.ts +12 -12
  66. package/src/typings/Atomic.ts +21 -21
  67. package/src/typings/CamelCase.ts +75 -75
  68. package/src/typings/ClassProperties.ts +15 -15
  69. package/src/typings/DeepPartial.ts +39 -39
  70. package/src/typings/OmitNever.ts +12 -12
  71. package/src/typings/PascalCase.ts +71 -71
  72. package/src/typings/Primitive.ts +71 -71
  73. package/src/typings/ProtobufAtomic.ts +30 -30
  74. package/src/typings/Resolved.ts +58 -58
  75. package/src/typings/SnakeCase.ts +126 -126
  76. package/src/typings/SpecialFields.ts +13 -13
  77. package/src/typings/ValidationPipe.ts +20 -20
  78. package/src/typings/index.ts +14 -14
  79. package/src/typings/internal/Equal.ts +14 -14
  80. package/src/typings/internal/IsTuple.ts +17 -17
  81. package/src/typings/internal/NativeClass.ts +31 -31
  82. package/src/typings/internal/ValueOf.ts +29 -29
  83. package/src/utils/IRandomGenerator.ts +105 -105
  84. package/src/utils/IReadableURLSearchParams.ts +25 -25
  85. package/src/utils/index.ts +2 -2
@@ -7,16 +7,16 @@ import { IHttpResponse } from "./IHttpResponse";
7
7
  *
8
8
  * `IHttpLlmController` is a controller for registering OpenAPI operations as
9
9
  * LLM function calling tools. It contains {@link IHttpLlmApplication} with
10
- * {@link IHttpLlmFunction function calling schemas}, {@link name identifier},
11
- * and {@link connection} to the API server.
10
+ * {@link IHttpLlmFunction function calling schemas}, {@link name identifier}, and
11
+ * {@link connection} to the API server.
12
12
  *
13
- * You can create this controller with {@link HttpLlm.controller} function,
14
- * and register it to MCP server with {@link registerMcpControllers}:
13
+ * You can create this controller with {@link HttpLlm.controller} function, and
14
+ * register it to MCP server with {@link registerMcpControllers}:
15
15
  *
16
16
  * ```typescript
17
17
  * import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
18
- * import { HttpLlm } from "@typia/utils";
19
18
  * import { registerMcpControllers } from "@typia/mcp";
19
+ * import { HttpLlm } from "@typia/utils";
20
20
  *
21
21
  * const server = new McpServer({ name: "my-server", version: "1.0.0" });
22
22
  * registerMcpControllers({
@@ -78,9 +78,7 @@ export declare namespace IJsonParseResult {
78
78
  */
79
79
  errors: IError[];
80
80
  }
81
- /**
82
- * Detailed information about a parsing error.
83
- */
81
+ /** Detailed information about a parsing error. */
84
82
  interface IError {
85
83
  /**
86
84
  * Property path to the error location.
@@ -12,7 +12,6 @@ import { IValidation } from "./IValidation";
12
12
  *
13
13
  * - {@link ILlmApplication.IConfig.validate}: Custom validation per method
14
14
  * - {@link ILlmSchema.IConfig.strict}: OpenAI structured output mode
15
- * - {@link ILlmSchema.IConfig.reference}: Control `$ref` inlining behavior
16
15
  *
17
16
  * @author Jeongho Nam - https://github.com/samchon
18
17
  * @template Class Source class/interface type
@@ -30,7 +29,7 @@ export interface ILlmApplication<Class extends object = any> {
30
29
  * Configuration used to generate this application.
31
30
  *
32
31
  * Contains the settings that were applied during schema generation, including
33
- * reference handling, strict mode, and parameter separation.
32
+ * strict mode and any custom validation hooks.
34
33
  */
35
34
  config: ILlmApplication.IConfig<Class>;
36
35
  /**
@@ -12,8 +12,8 @@ import { ILlmApplication } from "./ILlmApplication";
12
12
  *
13
13
  * ```typescript
14
14
  * import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
15
- * import typia from "typia";
16
15
  * import { registerMcpControllers } from "@typia/mcp";
16
+ * import typia from "typia";
17
17
  *
18
18
  * class Calculator {
19
19
  * add(input: { a: number; b: number }): number {
@@ -28,10 +28,7 @@ import { ILlmApplication } from "./ILlmApplication";
28
28
  * registerMcpControllers({
29
29
  * server,
30
30
  * controllers: [
31
- * typia.llm.controller<Calculator>(
32
- * "calculator",
33
- * new Calculator(),
34
- * ),
31
+ * typia.llm.controller<Calculator>("calculator", new Calculator()),
35
32
  * ],
36
33
  * });
37
34
  * ```
@@ -25,19 +25,9 @@ export declare namespace ILlmSchema {
25
25
  * Configuration options for LLM schema generation.
26
26
  *
27
27
  * Controls how TypeScript types are converted to LLM-compatible JSON schemas.
28
- * These settings affect reference handling and OpenAI structured output
29
- * compatibility.
28
+ * These settings affect OpenAI structured output compatibility.
30
29
  */
31
30
  interface IConfig {
32
- /**
33
- * Whether to allow `$ref` references everywhere.
34
- *
35
- * When `false`, references are inlined except for recursive types.
36
- * References reduce token cost but may cause hallucination.
37
- *
38
- * @default true
39
- */
40
- reference: boolean;
41
31
  /**
42
32
  * Whether to enable strict mode (OpenAI structured output).
43
33
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typia/interface",
3
- "version": "12.0.0-dev.20260309",
3
+ "version": "12.0.0-dev.20260311",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -1,200 +1,200 @@
1
- /// <reference lib="dom" />
2
-
3
- /**
4
- * HTTP connection configuration for remote server communication.
5
- *
6
- * `IHttpConnection` defines connection settings required to communicate with
7
- * remote HTTP servers. This interface is primarily used by `@nestia/fetcher`
8
- * and generated SDK functions to establish HTTP connections.
9
- *
10
- * The {@link host} property specifies the base URL of the target server, while
11
- * {@link headers} allows passing custom HTTP headers with each request. For
12
- * fine-grained control over fetch behavior, use {@link options} to configure
13
- * caching, CORS, credentials, and other fetch API settings.
14
- *
15
- * In Node.js versions prior to 20 (which lack native fetch), provide a polyfill
16
- * like `node-fetch` via the {@link fetch} property.
17
- *
18
- * @author Jeongho Nam - https://github.com/samchon
19
- * @author Seungjun We - https://github.com/SeungjunWe
20
- */
21
- export interface IHttpConnection {
22
- /**
23
- * Base URL of the remote HTTP server.
24
- *
25
- * Must include protocol (http:// or https://) and may include port. Example:
26
- * `"https://api.example.com"` or `"http://localhost:3000"`.
27
- */
28
- host: string;
29
-
30
- /**
31
- * Custom HTTP headers to send with every request.
32
- *
33
- * Common use cases include authentication tokens, API keys, and content
34
- * negotiation headers. Values can be primitives or arrays.
35
- */
36
- headers?: Record<string, IHttpConnection.HeaderValue>;
37
-
38
- /**
39
- * Additional fetch API options.
40
- *
41
- * Configure caching, CORS mode, credentials handling, and other
42
- * fetch-specific behaviors. These options are passed directly to the
43
- * underlying fetch call.
44
- */
45
- options?: IHttpConnection.IOptions;
46
-
47
- /**
48
- * Custom fetch function implementation.
49
- *
50
- * For Node.js versions before 20 that lack native fetch support, provide a
51
- * polyfill such as `node-fetch`. This allows the same connection
52
- * configuration to work across all Node.js versions.
53
- *
54
- * @example
55
- * import fetch from "node-fetch";
56
- *
57
- * const connection: IHttpConnection = {
58
- * host: "https://api.example.com",
59
- * fetch: fetch as any,
60
- * };
61
- */
62
- fetch?: typeof fetch;
63
- }
64
- export namespace IHttpConnection {
65
- /**
66
- * Fetch API request options.
67
- *
68
- * Subset of the standard `RequestInit` interface, excluding properties that
69
- * are managed internally (body, headers, method). These options control
70
- * caching, CORS, credentials, and request lifecycle behavior.
71
- */
72
- export interface IOptions {
73
- /**
74
- * Request cache mode.
75
- *
76
- * Controls how the request interacts with the browser's HTTP cache.
77
- *
78
- * - `"default"`: Standard browser caching behavior
79
- * - `"no-store"`: Bypass cache completely, don't store response
80
- * - `"reload"`: Bypass cache, but store response
81
- * - `"no-cache"`: Validate with server before using cache
82
- * - `"force-cache"`: Use cache even if stale
83
- * - `"only-if-cached"`: Only use cache, fail if not cached
84
- */
85
- cache?:
86
- | "default"
87
- | "force-cache"
88
- | "no-cache"
89
- | "no-store"
90
- | "only-if-cached"
91
- | "reload";
92
-
93
- /**
94
- * Credentials inclusion mode.
95
- *
96
- * Controls whether cookies and HTTP authentication are sent.
97
- *
98
- * - `"omit"`: Never send credentials
99
- * - `"same-origin"`: Send credentials only for same-origin requests
100
- * - `"include"`: Always send credentials, even cross-origin
101
- */
102
- credentials?: "omit" | "same-origin" | "include";
103
-
104
- /**
105
- * Subresource integrity hash for verification.
106
- *
107
- * A cryptographic hash (e.g., `"sha256-abc123..."`) to verify the fetched
108
- * resource hasn't been tampered with. The browser will reject responses
109
- * that don't match the expected hash.
110
- */
111
- integrity?: string;
112
-
113
- /**
114
- * Whether to keep the connection alive after page unload.
115
- *
116
- * When `true`, the request can outlive the page that initiated it. Useful
117
- * for analytics or logging requests that should complete even if the user
118
- * navigates away.
119
- */
120
- keepalive?: boolean;
121
-
122
- /**
123
- * CORS (Cross-Origin Resource Sharing) mode.
124
- *
125
- * Controls cross-origin request behavior.
126
- *
127
- * - `"cors"`: Standard CORS request (requires server support)
128
- * - `"no-cors"`: Limited cross-origin request (opaque response)
129
- * - `"same-origin"`: Only allow same-origin requests
130
- * - `"navigate"`: For navigation requests (used by browsers)
131
- */
132
- mode?: "cors" | "navigate" | "no-cors" | "same-origin";
133
-
134
- /**
135
- * HTTP redirect handling behavior.
136
- *
137
- * - `"follow"`: Automatically follow redirects (default)
138
- * - `"error"`: Throw an error on redirect
139
- * - `"manual"`: Return redirect response for manual handling
140
- */
141
- redirect?: "error" | "follow" | "manual";
142
-
143
- /**
144
- * Referrer URL to send with the request.
145
- *
146
- * Overrides the default referrer. Use empty string to suppress the referrer
147
- * header entirely.
148
- */
149
- referrer?: string;
150
-
151
- /**
152
- * Policy for how much referrer information to include.
153
- *
154
- * Controls what referrer information is sent with requests. More
155
- * restrictive policies improve privacy but may break some server-side
156
- * analytics or security checks.
157
- */
158
- referrerPolicy?:
159
- | ""
160
- | "no-referrer"
161
- | "no-referrer-when-downgrade"
162
- | "origin"
163
- | "origin-when-cross-origin"
164
- | "same-origin"
165
- | "strict-origin"
166
- | "strict-origin-when-cross-origin"
167
- | "unsafe-url";
168
-
169
- /**
170
- * AbortSignal for request cancellation.
171
- *
172
- * Connect to an AbortController to enable cancellation of in-flight
173
- * requests. When the signal is aborted, the fetch promise rejects with an
174
- * AbortError.
175
- *
176
- * @example
177
- * const controller = new AbortController();
178
- * const options = { signal: controller.signal };
179
- * // Later: controller.abort();
180
- */
181
- signal?: AbortSignal | null;
182
- }
183
-
184
- /**
185
- * Allowed types for HTTP header values.
186
- *
187
- * Supports primitive types (string, boolean, number, bigint) and arrays of
188
- * primitives. Arrays are typically joined with commas when sent as HTTP
189
- * headers.
190
- */
191
- export type HeaderValue =
192
- | string
193
- | boolean
194
- | number
195
- | bigint
196
- | Array<boolean>
197
- | Array<number>
198
- | Array<bigint>
199
- | Array<string>;
200
- }
1
+ /// <reference lib="dom" />
2
+
3
+ /**
4
+ * HTTP connection configuration for remote server communication.
5
+ *
6
+ * `IHttpConnection` defines connection settings required to communicate with
7
+ * remote HTTP servers. This interface is primarily used by `@nestia/fetcher`
8
+ * and generated SDK functions to establish HTTP connections.
9
+ *
10
+ * The {@link host} property specifies the base URL of the target server, while
11
+ * {@link headers} allows passing custom HTTP headers with each request. For
12
+ * fine-grained control over fetch behavior, use {@link options} to configure
13
+ * caching, CORS, credentials, and other fetch API settings.
14
+ *
15
+ * In Node.js versions prior to 20 (which lack native fetch), provide a polyfill
16
+ * like `node-fetch` via the {@link fetch} property.
17
+ *
18
+ * @author Jeongho Nam - https://github.com/samchon
19
+ * @author Seungjun We - https://github.com/SeungjunWe
20
+ */
21
+ export interface IHttpConnection {
22
+ /**
23
+ * Base URL of the remote HTTP server.
24
+ *
25
+ * Must include protocol (http:// or https://) and may include port. Example:
26
+ * `"https://api.example.com"` or `"http://localhost:3000"`.
27
+ */
28
+ host: string;
29
+
30
+ /**
31
+ * Custom HTTP headers to send with every request.
32
+ *
33
+ * Common use cases include authentication tokens, API keys, and content
34
+ * negotiation headers. Values can be primitives or arrays.
35
+ */
36
+ headers?: Record<string, IHttpConnection.HeaderValue>;
37
+
38
+ /**
39
+ * Additional fetch API options.
40
+ *
41
+ * Configure caching, CORS mode, credentials handling, and other
42
+ * fetch-specific behaviors. These options are passed directly to the
43
+ * underlying fetch call.
44
+ */
45
+ options?: IHttpConnection.IOptions;
46
+
47
+ /**
48
+ * Custom fetch function implementation.
49
+ *
50
+ * For Node.js versions before 20 that lack native fetch support, provide a
51
+ * polyfill such as `node-fetch`. This allows the same connection
52
+ * configuration to work across all Node.js versions.
53
+ *
54
+ * @example
55
+ * import fetch from "node-fetch";
56
+ *
57
+ * const connection: IHttpConnection = {
58
+ * host: "https://api.example.com",
59
+ * fetch: fetch as any,
60
+ * };
61
+ */
62
+ fetch?: typeof fetch;
63
+ }
64
+ export namespace IHttpConnection {
65
+ /**
66
+ * Fetch API request options.
67
+ *
68
+ * Subset of the standard `RequestInit` interface, excluding properties that
69
+ * are managed internally (body, headers, method). These options control
70
+ * caching, CORS, credentials, and request lifecycle behavior.
71
+ */
72
+ export interface IOptions {
73
+ /**
74
+ * Request cache mode.
75
+ *
76
+ * Controls how the request interacts with the browser's HTTP cache.
77
+ *
78
+ * - `"default"`: Standard browser caching behavior
79
+ * - `"no-store"`: Bypass cache completely, don't store response
80
+ * - `"reload"`: Bypass cache, but store response
81
+ * - `"no-cache"`: Validate with server before using cache
82
+ * - `"force-cache"`: Use cache even if stale
83
+ * - `"only-if-cached"`: Only use cache, fail if not cached
84
+ */
85
+ cache?:
86
+ | "default"
87
+ | "force-cache"
88
+ | "no-cache"
89
+ | "no-store"
90
+ | "only-if-cached"
91
+ | "reload";
92
+
93
+ /**
94
+ * Credentials inclusion mode.
95
+ *
96
+ * Controls whether cookies and HTTP authentication are sent.
97
+ *
98
+ * - `"omit"`: Never send credentials
99
+ * - `"same-origin"`: Send credentials only for same-origin requests
100
+ * - `"include"`: Always send credentials, even cross-origin
101
+ */
102
+ credentials?: "omit" | "same-origin" | "include";
103
+
104
+ /**
105
+ * Subresource integrity hash for verification.
106
+ *
107
+ * A cryptographic hash (e.g., `"sha256-abc123..."`) to verify the fetched
108
+ * resource hasn't been tampered with. The browser will reject responses
109
+ * that don't match the expected hash.
110
+ */
111
+ integrity?: string;
112
+
113
+ /**
114
+ * Whether to keep the connection alive after page unload.
115
+ *
116
+ * When `true`, the request can outlive the page that initiated it. Useful
117
+ * for analytics or logging requests that should complete even if the user
118
+ * navigates away.
119
+ */
120
+ keepalive?: boolean;
121
+
122
+ /**
123
+ * CORS (Cross-Origin Resource Sharing) mode.
124
+ *
125
+ * Controls cross-origin request behavior.
126
+ *
127
+ * - `"cors"`: Standard CORS request (requires server support)
128
+ * - `"no-cors"`: Limited cross-origin request (opaque response)
129
+ * - `"same-origin"`: Only allow same-origin requests
130
+ * - `"navigate"`: For navigation requests (used by browsers)
131
+ */
132
+ mode?: "cors" | "navigate" | "no-cors" | "same-origin";
133
+
134
+ /**
135
+ * HTTP redirect handling behavior.
136
+ *
137
+ * - `"follow"`: Automatically follow redirects (default)
138
+ * - `"error"`: Throw an error on redirect
139
+ * - `"manual"`: Return redirect response for manual handling
140
+ */
141
+ redirect?: "error" | "follow" | "manual";
142
+
143
+ /**
144
+ * Referrer URL to send with the request.
145
+ *
146
+ * Overrides the default referrer. Use empty string to suppress the referrer
147
+ * header entirely.
148
+ */
149
+ referrer?: string;
150
+
151
+ /**
152
+ * Policy for how much referrer information to include.
153
+ *
154
+ * Controls what referrer information is sent with requests. More
155
+ * restrictive policies improve privacy but may break some server-side
156
+ * analytics or security checks.
157
+ */
158
+ referrerPolicy?:
159
+ | ""
160
+ | "no-referrer"
161
+ | "no-referrer-when-downgrade"
162
+ | "origin"
163
+ | "origin-when-cross-origin"
164
+ | "same-origin"
165
+ | "strict-origin"
166
+ | "strict-origin-when-cross-origin"
167
+ | "unsafe-url";
168
+
169
+ /**
170
+ * AbortSignal for request cancellation.
171
+ *
172
+ * Connect to an AbortController to enable cancellation of in-flight
173
+ * requests. When the signal is aborted, the fetch promise rejects with an
174
+ * AbortError.
175
+ *
176
+ * @example
177
+ * const controller = new AbortController();
178
+ * const options = { signal: controller.signal };
179
+ * // Later: controller.abort();
180
+ */
181
+ signal?: AbortSignal | null;
182
+ }
183
+
184
+ /**
185
+ * Allowed types for HTTP header values.
186
+ *
187
+ * Supports primitive types (string, boolean, number, bigint) and arrays of
188
+ * primitives. Arrays are typically joined with commas when sent as HTTP
189
+ * headers.
190
+ */
191
+ export type HeaderValue =
192
+ | string
193
+ | boolean
194
+ | number
195
+ | bigint
196
+ | Array<boolean>
197
+ | Array<number>
198
+ | Array<bigint>
199
+ | Array<string>;
200
+ }
@@ -1,72 +1,72 @@
1
- import { OpenApi } from "../openapi/OpenApi";
2
- import { ILlmSchema } from "../schema/ILlmSchema";
3
- import { IHttpLlmFunction } from "./IHttpLlmFunction";
4
- import { IHttpMigrateRoute } from "./IHttpMigrateRoute";
5
-
6
- /**
7
- * LLM function calling application from OpenAPI document.
8
- *
9
- * `IHttpLlmApplication` is a collection of {@link IHttpLlmFunction} schemas
10
- * converted from {@link OpenApi.IDocument} by `HttpLlm.application()`. Each
11
- * OpenAPI operation becomes an LLM-callable function.
12
- *
13
- * Successful conversions go to {@link functions}, failed ones to {@link errors}
14
- * with detailed error messages. Common failure causes:
15
- *
16
- * - Unsupported schema features (tuples, `oneOf` with incompatible types)
17
- * - Missing required fields in OpenAPI document
18
- * - Operations marked with `x-samchon-human: true`
19
- *
20
- * Configure behavior via {@link IHttpLlmApplication.IConfig}:
21
- *
22
- * - {@link IHttpLlmApplication.IConfig.maxLength}: Function name length limit
23
- * - {@link ILlmSchema.IConfig.strict}: OpenAI structured output mode
24
- *
25
- * @author Jeongho Nam - https://github.com/samchon
26
- */
27
- export interface IHttpLlmApplication {
28
- /** Successfully converted LLM function schemas. */
29
- functions: IHttpLlmFunction[];
30
-
31
- /** Operations that failed conversion. */
32
- errors: IHttpLlmApplication.IError[];
33
-
34
- /** Configuration used for composition. */
35
- config: IHttpLlmApplication.IConfig;
36
- }
37
- export namespace IHttpLlmApplication {
38
- /** Configuration for HTTP LLM application composition. */
39
- export interface IConfig extends ILlmSchema.IConfig {
40
- /**
41
- * Maximum function name length. Truncated or UUID if exceeded.
42
- *
43
- * @default 64
44
- */
45
- maxLength: number;
46
-
47
- /**
48
- * Whether to disallow superfluous properties.
49
- *
50
- * @default false
51
- */
52
- equals: boolean;
53
- }
54
-
55
- /** Composition error for an operation. */
56
- export interface IError {
57
- /** HTTP method of the failed operation. */
58
- method: "get" | "post" | "put" | "patch" | "delete" | "head";
59
-
60
- /** Path of the failed operation. */
61
- path: string;
62
-
63
- /** Error messages describing the failure. */
64
- messages: string[];
65
-
66
- /** Returns source {@link OpenApi.IOperation}. */
67
- operation: () => OpenApi.IOperation;
68
-
69
- /** Returns source route. Undefined if error occurred at migration level. */
70
- route: () => IHttpMigrateRoute | undefined;
71
- }
72
- }
1
+ import { OpenApi } from "../openapi/OpenApi";
2
+ import { ILlmSchema } from "../schema/ILlmSchema";
3
+ import { IHttpLlmFunction } from "./IHttpLlmFunction";
4
+ import { IHttpMigrateRoute } from "./IHttpMigrateRoute";
5
+
6
+ /**
7
+ * LLM function calling application from OpenAPI document.
8
+ *
9
+ * `IHttpLlmApplication` is a collection of {@link IHttpLlmFunction} schemas
10
+ * converted from {@link OpenApi.IDocument} by `HttpLlm.application()`. Each
11
+ * OpenAPI operation becomes an LLM-callable function.
12
+ *
13
+ * Successful conversions go to {@link functions}, failed ones to {@link errors}
14
+ * with detailed error messages. Common failure causes:
15
+ *
16
+ * - Unsupported schema features (tuples, `oneOf` with incompatible types)
17
+ * - Missing required fields in OpenAPI document
18
+ * - Operations marked with `x-samchon-human: true`
19
+ *
20
+ * Configure behavior via {@link IHttpLlmApplication.IConfig}:
21
+ *
22
+ * - {@link IHttpLlmApplication.IConfig.maxLength}: Function name length limit
23
+ * - {@link ILlmSchema.IConfig.strict}: OpenAI structured output mode
24
+ *
25
+ * @author Jeongho Nam - https://github.com/samchon
26
+ */
27
+ export interface IHttpLlmApplication {
28
+ /** Successfully converted LLM function schemas. */
29
+ functions: IHttpLlmFunction[];
30
+
31
+ /** Operations that failed conversion. */
32
+ errors: IHttpLlmApplication.IError[];
33
+
34
+ /** Configuration used for composition. */
35
+ config: IHttpLlmApplication.IConfig;
36
+ }
37
+ export namespace IHttpLlmApplication {
38
+ /** Configuration for HTTP LLM application composition. */
39
+ export interface IConfig extends ILlmSchema.IConfig {
40
+ /**
41
+ * Maximum function name length. Truncated or UUID if exceeded.
42
+ *
43
+ * @default 64
44
+ */
45
+ maxLength: number;
46
+
47
+ /**
48
+ * Whether to disallow superfluous properties.
49
+ *
50
+ * @default false
51
+ */
52
+ equals: boolean;
53
+ }
54
+
55
+ /** Composition error for an operation. */
56
+ export interface IError {
57
+ /** HTTP method of the failed operation. */
58
+ method: "get" | "post" | "put" | "patch" | "delete" | "head";
59
+
60
+ /** Path of the failed operation. */
61
+ path: string;
62
+
63
+ /** Error messages describing the failure. */
64
+ messages: string[];
65
+
66
+ /** Returns source {@link OpenApi.IOperation}. */
67
+ operation: () => OpenApi.IOperation;
68
+
69
+ /** Returns source route. Undefined if error occurred at migration level. */
70
+ route: () => IHttpMigrateRoute | undefined;
71
+ }
72
+ }