typia 9.6.1 → 9.7.0
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/CamelCase.d.mts +1 -1
- package/lib/CamelCase.d.ts +1 -1
- package/lib/IRandomGenerator.d.mts +240 -0
- package/lib/IRandomGenerator.d.ts +240 -0
- package/lib/PascalCase.d.mts +1 -1
- package/lib/PascalCase.d.ts +1 -1
- package/lib/Primitive.d.mts +8 -8
- package/lib/Primitive.d.ts +8 -8
- package/lib/Resolved.d.mts +9 -9
- package/lib/Resolved.d.ts +9 -9
- package/lib/SnakeCase.d.mts +1 -1
- package/lib/SnakeCase.d.ts +1 -1
- package/lib/factories/TypeFactory.d.mts +1 -0
- package/lib/factories/TypeFactory.d.ts +1 -0
- package/lib/factories/TypeFactory.js +1 -1
- package/lib/factories/TypeFactory.js.map +1 -1
- package/lib/factories/TypeFactory.mjs +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_map.js +2 -3
- package/lib/factories/internal/metadata/iterate_metadata_map.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_map.mjs +2 -3
- package/lib/factories/internal/metadata/iterate_metadata_set.js +2 -3
- package/lib/factories/internal/metadata/iterate_metadata_set.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_set.mjs +2 -3
- package/lib/functional.js +1 -1
- package/lib/functional.js.map +1 -1
- package/lib/functional.mjs +1 -1
- package/lib/http.d.mts +23 -23
- package/lib/http.d.ts +23 -23
- package/lib/internal/_llmApplicationFinalize.d.mts +1 -1
- package/lib/internal/_llmApplicationFinalize.d.ts +1 -1
- package/lib/internal/_llmApplicationFinalize.js +14 -11
- package/lib/internal/_llmApplicationFinalize.js.map +1 -1
- package/lib/internal/_llmApplicationFinalize.mjs +13 -9
- package/lib/json.d.mts +16 -16
- package/lib/json.d.ts +16 -16
- package/lib/llm.d.mts +18 -18
- package/lib/llm.d.ts +18 -18
- package/lib/llm.js.map +1 -1
- package/lib/misc.d.mts +23 -23
- package/lib/misc.d.ts +23 -23
- package/lib/module.d.mts +75 -75
- package/lib/module.d.ts +75 -75
- package/lib/module.js.map +1 -1
- package/lib/transformers/features/llm/LlmApplicationTransformer.js +8 -9
- package/lib/transformers/features/llm/LlmApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmApplicationTransformer.mjs +8 -9
- package/package.json +2 -2
- package/src/CamelCase.ts +1 -1
- package/src/IRandomGenerator.ts +284 -6
- package/src/PascalCase.ts +1 -1
- package/src/Primitive.ts +8 -8
- package/src/Resolved.ts +9 -9
- package/src/SnakeCase.ts +1 -1
- package/src/factories/TypeFactory.ts +5 -3
- package/src/factories/internal/metadata/iterate_metadata_map.ts +3 -3
- package/src/factories/internal/metadata/iterate_metadata_set.ts +2 -3
- package/src/functional.ts +1 -1
- package/src/http.ts +23 -23
- package/src/internal/_llmApplicationFinalize.ts +25 -11
- package/src/json.ts +16 -16
- package/src/llm.ts +26 -18
- package/src/misc.ts +23 -23
- package/src/module.ts +76 -75
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +18 -22
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ILlmApplication,
|
|
3
|
+
ILlmFunction,
|
|
4
|
+
ILlmSchema,
|
|
5
|
+
IValidation,
|
|
6
|
+
} from "@samchon/openapi";
|
|
2
7
|
import { LlmSchemaComposer } from "@samchon/openapi/lib/composers/LlmSchemaComposer";
|
|
3
8
|
|
|
4
9
|
export const _llmApplicationFinalize = <Model extends ILlmSchema.Model>(
|
|
5
10
|
app: ILlmApplication<Model>,
|
|
6
11
|
options?: Partial<
|
|
7
|
-
Pick<ILlmApplication.IOptions<Model>, "separate"> & {
|
|
12
|
+
Pick<ILlmApplication.IOptions<Model>, "separate" | "validate"> & {
|
|
8
13
|
equals?: boolean;
|
|
9
14
|
}
|
|
10
15
|
>,
|
|
@@ -12,14 +17,23 @@ export const _llmApplicationFinalize = <Model extends ILlmSchema.Model>(
|
|
|
12
17
|
app.options = {
|
|
13
18
|
...LlmSchemaComposer.defaultConfig(app.model),
|
|
14
19
|
separate: options?.separate ?? null,
|
|
20
|
+
validate: options?.validate ?? null,
|
|
15
21
|
};
|
|
16
|
-
if (app.options.separate
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
if (app.options.separate !== null)
|
|
23
|
+
for (const func of app.functions)
|
|
24
|
+
func.separated = LlmSchemaComposer.separateParameters(app.model)({
|
|
25
|
+
parameters:
|
|
26
|
+
func.parameters satisfies ILlmSchema.IParameters<Model> as any,
|
|
27
|
+
predicate: app.options
|
|
28
|
+
.separate as ILlmApplication.IOptions<Model>["separate"] as any,
|
|
29
|
+
equals: options?.equals ?? false,
|
|
30
|
+
}) as ILlmFunction.ISeparated<Model>;
|
|
31
|
+
if (app.options.validate !== null)
|
|
32
|
+
for (const func of app.functions)
|
|
33
|
+
if (typeof app.options.validate?.[func.name] === "function")
|
|
34
|
+
func.validate = app.options.validate[
|
|
35
|
+
func.name
|
|
36
|
+
]! satisfies Validator as Validator;
|
|
25
37
|
};
|
|
38
|
+
|
|
39
|
+
type Validator = (input: unknown) => IValidation<unknown>;
|
package/src/json.ts
CHANGED
|
@@ -26,8 +26,8 @@ import { TypeGuardError } from "./TypeGuardError";
|
|
|
26
26
|
* {@link IJsonSchemaCollection.components} property for the `$ref` referencing.
|
|
27
27
|
*
|
|
28
28
|
* Also, you can specify the OpenAPI version by configuring the second generic
|
|
29
|
-
* argument `Version`. For reference, the default version is `"3.1"`, and key
|
|
30
|
-
*
|
|
29
|
+
* argument `Version`. For reference, the default version is `"3.1"`, and the key
|
|
30
|
+
* difference between `"3.0"` and `"3.1"` is whether supporting the tuple type or not.
|
|
31
31
|
*
|
|
32
32
|
* @template Types Tuple of target types
|
|
33
33
|
* @template Version Version of OpenAPI specification. Default is 3.1
|
|
@@ -45,8 +45,8 @@ export function schemas(): never;
|
|
|
45
45
|
* {@link IJsonSchemaCollection.components} property for the `$ref` referencing.
|
|
46
46
|
*
|
|
47
47
|
* Also, you can specify the OpenAPI version by configuring the second generic
|
|
48
|
-
* argument `Version`. For reference, the default version is `"3.1"`, and key
|
|
49
|
-
*
|
|
48
|
+
* argument `Version`. For reference, the default version is `"3.1"`, and the key
|
|
49
|
+
* difference between `"3.0"` and `"3.1"` is whether supporting the tuple type or not.
|
|
50
50
|
*
|
|
51
51
|
* @template Types Tuple of target types
|
|
52
52
|
* @template Version Version of OpenAPI specification. Default is 3.1
|
|
@@ -132,7 +132,7 @@ export function schema(): never {
|
|
|
132
132
|
*
|
|
133
133
|
* In such reason, when parsed JSON string value is not matched with the type `T`, it
|
|
134
134
|
* throws {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
135
|
-
* there's no problem
|
|
135
|
+
* if there's no problem with the parsed value, the parsed value will be returned.
|
|
136
136
|
*
|
|
137
137
|
* @template T Expected type of parsed value
|
|
138
138
|
* @param input JSON string
|
|
@@ -188,7 +188,7 @@ export function assertParse<T>(): Primitive<T> {
|
|
|
188
188
|
*
|
|
189
189
|
* In such reason, when parsed JSON string value is not matched with the type `T`, it
|
|
190
190
|
* returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
|
|
191
|
-
* value
|
|
191
|
+
* value will be returned.
|
|
192
192
|
*
|
|
193
193
|
* @template T Expected type of parsed value
|
|
194
194
|
* @param input JSON string
|
|
@@ -207,7 +207,7 @@ export function isParse(input: string): never;
|
|
|
207
207
|
*
|
|
208
208
|
* In such reason, when parsed JSON string value is not matched with the type `T`, it
|
|
209
209
|
* returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
|
|
210
|
-
* value
|
|
210
|
+
* value will be returned.
|
|
211
211
|
*
|
|
212
212
|
* @template T Expected type of parsed value
|
|
213
213
|
* @param input JSON string
|
|
@@ -235,7 +235,7 @@ export function isParse<T>(): Primitive<T> | null {
|
|
|
235
235
|
*
|
|
236
236
|
* In such reason, when parsed JSON string value is not matched with the type `T`, it
|
|
237
237
|
* returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
|
|
238
|
-
* there's no problem on the parsed value, the parsed value
|
|
238
|
+
* there's no problem on the parsed value, the parsed value will be stored in `data`
|
|
239
239
|
* property of the output {@link IValidation.ISuccess} instance.
|
|
240
240
|
*
|
|
241
241
|
* @template T Expected type of parsed value
|
|
@@ -255,7 +255,7 @@ export function validateParse(input: string): never;
|
|
|
255
255
|
*
|
|
256
256
|
* In such reason, when parsed JSON string value is not matched with the type `T`, it
|
|
257
257
|
* returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
|
|
258
|
-
* there's no problem on the parsed value, the parsed value
|
|
258
|
+
* there's no problem on the parsed value, the parsed value will be stored in `data`
|
|
259
259
|
* property of the output {@link IValidation.ISuccess} instance.
|
|
260
260
|
*
|
|
261
261
|
* @template T Expected type of parsed value
|
|
@@ -285,7 +285,7 @@ export function validateParse<T>(): IValidation<Primitive<T>> {
|
|
|
285
285
|
*
|
|
286
286
|
* For reference, this `typia.json.stringify()` does not validate the input value type.
|
|
287
287
|
* It just believes that the input value is following the type `T`. Therefore, if you
|
|
288
|
-
* can't ensure the input value type, it
|
|
288
|
+
* can't ensure the input value type, it will be better to call one of below
|
|
289
289
|
* functions instead.
|
|
290
290
|
*
|
|
291
291
|
* - {@link assertStringify}
|
|
@@ -316,7 +316,7 @@ export function stringify(): never {
|
|
|
316
316
|
*
|
|
317
317
|
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
318
318
|
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
319
|
-
* there's no problem on the `input` value, JSON string
|
|
319
|
+
* there's no problem on the `input` value, JSON string will be returned.
|
|
320
320
|
*
|
|
321
321
|
* For reference, with type assertion, it is even 5x times faster than the native
|
|
322
322
|
* `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
|
|
@@ -343,7 +343,7 @@ export function assertStringify<T>(
|
|
|
343
343
|
*
|
|
344
344
|
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
345
345
|
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
346
|
-
* there's no problem on the `input` value, JSON string
|
|
346
|
+
* there's no problem on the `input` value, JSON string will be returned.
|
|
347
347
|
*
|
|
348
348
|
* For reference, with type assertion, it is even 5x times faster than the native
|
|
349
349
|
* `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
|
|
@@ -377,7 +377,7 @@ export function assertStringify(): string {
|
|
|
377
377
|
*
|
|
378
378
|
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
379
379
|
* `null` value. Otherwise, there's no problem on the `input` value, JSON string
|
|
380
|
-
*
|
|
380
|
+
* will be returned.
|
|
381
381
|
*
|
|
382
382
|
* For reference, with type checking, it is even 7x times faster than the native
|
|
383
383
|
* `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
|
|
@@ -400,7 +400,7 @@ export function isStringify<T>(input: T): string | null;
|
|
|
400
400
|
*
|
|
401
401
|
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
402
402
|
* `null` value. Otherwise, there's no problem on the `input` value, JSON string
|
|
403
|
-
*
|
|
403
|
+
* will be returned.
|
|
404
404
|
*
|
|
405
405
|
* For reference, with type checking, it is even 7x times faster than the native
|
|
406
406
|
* `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
|
|
@@ -430,7 +430,7 @@ export function isStringify(): string | null {
|
|
|
430
430
|
*
|
|
431
431
|
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
432
432
|
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
|
|
433
|
-
* there's no problem on the `input` value, JSON string
|
|
433
|
+
* there's no problem on the `input` value, JSON string will be stored in `data`
|
|
434
434
|
* property of the output {@link IValidation.ISuccess} instance.
|
|
435
435
|
*
|
|
436
436
|
* For reference, with detailed type validation, it is even 5x times faster than the
|
|
@@ -454,7 +454,7 @@ export function validateStringify<T>(input: T): IValidation<string>;
|
|
|
454
454
|
*
|
|
455
455
|
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
456
456
|
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
|
|
457
|
-
* there's no problem on the `input` value, JSON string
|
|
457
|
+
* there's no problem on the `input` value, JSON string will be stored in `data`
|
|
458
458
|
* property of the output {@link IValidation.ISuccess} instance.
|
|
459
459
|
*
|
|
460
460
|
* For reference, with detailed type validation, it is even 5x times faster than the
|
package/src/llm.ts
CHANGED
|
@@ -60,7 +60,7 @@ import { NoTransformConfigurationError } from "./transformers/NoTransformConfigu
|
|
|
60
60
|
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
61
61
|
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
62
62
|
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
63
|
-
* -
|
|
63
|
+
* - Middle layer schemas
|
|
64
64
|
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
65
65
|
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
66
66
|
*
|
|
@@ -77,7 +77,9 @@ import { NoTransformConfigurationError } from "./transformers/NoTransformConfigu
|
|
|
77
77
|
export function controller(
|
|
78
78
|
name: string,
|
|
79
79
|
execute: object,
|
|
80
|
-
options?: Partial<
|
|
80
|
+
options?: Partial<
|
|
81
|
+
Pick<ILlmApplication.IOptions<any, any>, "separate" | "validate">
|
|
82
|
+
>,
|
|
81
83
|
): never;
|
|
82
84
|
|
|
83
85
|
/**
|
|
@@ -136,7 +138,7 @@ export function controller(
|
|
|
136
138
|
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
137
139
|
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
138
140
|
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
139
|
-
* -
|
|
141
|
+
* - Middle layer schemas
|
|
140
142
|
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
141
143
|
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
142
144
|
*
|
|
@@ -170,7 +172,9 @@ export function controller<
|
|
|
170
172
|
>(
|
|
171
173
|
name: string,
|
|
172
174
|
execute: Class,
|
|
173
|
-
options?: Partial<
|
|
175
|
+
options?: Partial<
|
|
176
|
+
Pick<ILlmApplication.IOptions<Model, Class>, "separate" | "validate">
|
|
177
|
+
>,
|
|
174
178
|
): ILlmController<Model>;
|
|
175
179
|
|
|
176
180
|
/**
|
|
@@ -209,7 +213,7 @@ export function controller(..._args: any[]): never {
|
|
|
209
213
|
*
|
|
210
214
|
* Additionally, if you've configured {@link ILlmApplication.IOptions.separate},
|
|
211
215
|
* so that the parameters are separated to human and LLM sides, you can merge these
|
|
212
|
-
*
|
|
216
|
+
* human and LLM sides' parameters into one through {@link HttpLlm.mergeParameters}
|
|
213
217
|
* before the actual LLM function call execution.
|
|
214
218
|
*
|
|
215
219
|
* Here is the list of available `Model` types with their corresponding LLM schema.
|
|
@@ -222,7 +226,7 @@ export function controller(..._args: any[]): never {
|
|
|
222
226
|
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
223
227
|
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
224
228
|
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
225
|
-
* -
|
|
229
|
+
* - Middle layer schemas
|
|
226
230
|
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
227
231
|
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
228
232
|
*
|
|
@@ -235,7 +239,9 @@ export function controller(..._args: any[]): never {
|
|
|
235
239
|
* @author Jeongho Nam - https://github.com/samchon
|
|
236
240
|
*/
|
|
237
241
|
export function application(
|
|
238
|
-
options?: Partial<
|
|
242
|
+
options?: Partial<
|
|
243
|
+
Pick<ILlmApplication.IOptions<any, any>, "separate" | "validate">
|
|
244
|
+
>,
|
|
239
245
|
): never;
|
|
240
246
|
|
|
241
247
|
/**
|
|
@@ -265,7 +271,7 @@ export function application(
|
|
|
265
271
|
*
|
|
266
272
|
* Additionally, if you've configured {@link ILlmApplication.IOptions.separate},
|
|
267
273
|
* so that the parameters are separated to human and LLM sides, you can merge these
|
|
268
|
-
*
|
|
274
|
+
* human and LLM sides' parameters into one through {@link HttpLlm.mergeParameters}
|
|
269
275
|
* before the actual LLM function call execution.
|
|
270
276
|
*
|
|
271
277
|
* Here is the list of available `Model` types with their corresponding LLM schema.
|
|
@@ -278,7 +284,7 @@ export function application(
|
|
|
278
284
|
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
279
285
|
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
280
286
|
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
281
|
-
* -
|
|
287
|
+
* - Middle layer schemas
|
|
282
288
|
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
283
289
|
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
284
290
|
*
|
|
@@ -308,7 +314,9 @@ export function application<
|
|
|
308
314
|
} & ILlmSchema.ModelConfig[Model]
|
|
309
315
|
> = {},
|
|
310
316
|
>(
|
|
311
|
-
options?: Partial<
|
|
317
|
+
options?: Partial<
|
|
318
|
+
Pick<ILlmApplication.IOptions<Model, Class>, "separate" | "validate">
|
|
319
|
+
>,
|
|
312
320
|
): ILlmApplication<Model, Class>;
|
|
313
321
|
|
|
314
322
|
/**
|
|
@@ -330,7 +338,7 @@ export function application(): never {
|
|
|
330
338
|
*
|
|
331
339
|
* For references, LLM identifies only keyworded arguments, not positional arguments.
|
|
332
340
|
* Therefore, the TypeScript parameters type must be an object type, and its properties
|
|
333
|
-
* must be static. If dynamic properties are, it
|
|
341
|
+
* must be static. If dynamic properties are, it will be compilation error.
|
|
334
342
|
*
|
|
335
343
|
* Also, such parameters type can be utilized not only for the LLM function calling,
|
|
336
344
|
* but also for the LLM structured outputs. The LLM structured outputs is a feature
|
|
@@ -348,7 +356,7 @@ export function application(): never {
|
|
|
348
356
|
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
349
357
|
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
350
358
|
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
351
|
-
* -
|
|
359
|
+
* - Middle layer schemas
|
|
352
360
|
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
353
361
|
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
354
362
|
*
|
|
@@ -371,7 +379,7 @@ export function parameters(): never;
|
|
|
371
379
|
*
|
|
372
380
|
* For references, LLM identifies only keyworded arguments, not positional arguments.
|
|
373
381
|
* Therefore, the TypeScript parameters type must be an object type, and its properties
|
|
374
|
-
* must be static. If dynamic properties are, it
|
|
382
|
+
* must be static. If dynamic properties are, it will be compilation error.
|
|
375
383
|
*
|
|
376
384
|
* Also, such parameters type can be utilized not only for the LLM function calling,
|
|
377
385
|
* but also for the LLM structured outputs. The LLM structured outputs is a feature
|
|
@@ -389,7 +397,7 @@ export function parameters(): never;
|
|
|
389
397
|
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
390
398
|
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
391
399
|
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
392
|
-
* -
|
|
400
|
+
* - Middle layer schemas
|
|
393
401
|
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
394
402
|
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
395
403
|
*
|
|
@@ -422,7 +430,7 @@ export function parameters(): never {
|
|
|
422
430
|
* [LLM function calling](@reference https://platform.openai.com/docs/guides/function-calling),
|
|
423
431
|
* from a TypeScript type.
|
|
424
432
|
*
|
|
425
|
-
* The returned {@link ILlmSchema} type
|
|
433
|
+
* The returned {@link ILlmSchema} type will be specified by the `Model` argument,
|
|
426
434
|
* and here is the list of available `Model` types with their corresponding LLM schema.
|
|
427
435
|
* Reading the following list, and determine the `Model` type considering the
|
|
428
436
|
* characteristics of the target LLM provider.
|
|
@@ -433,7 +441,7 @@ export function parameters(): never {
|
|
|
433
441
|
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
434
442
|
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
435
443
|
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
436
|
-
* -
|
|
444
|
+
* - Middle layer schemas
|
|
437
445
|
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
438
446
|
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
439
447
|
*
|
|
@@ -472,7 +480,7 @@ export function schema(): never;
|
|
|
472
480
|
* [LLM function calling](@reference https://platform.openai.com/docs/guides/function-calling),
|
|
473
481
|
* from a TypeScript type.
|
|
474
482
|
*
|
|
475
|
-
* The returned {@link ILlmSchema} type
|
|
483
|
+
* The returned {@link ILlmSchema} type will be specified by the `Model` argument,
|
|
476
484
|
* and here is the list of available `Model` types with their corresponding LLM schema:
|
|
477
485
|
*
|
|
478
486
|
* - LLM provider schemas
|
|
@@ -481,7 +489,7 @@ export function schema(): never;
|
|
|
481
489
|
* - `deepseek`: [`IDeepSeekSchema`](https://samchon.github.io/openapi/api/types/IClaudeSchema-1.html)
|
|
482
490
|
* - `gemini`: [`IGeminiSchema`](https://samchon.github.io/openapi/api/types/IGeminiSchema-1.html)
|
|
483
491
|
* - `llama`: [`ILlamaSchema`](https://samchon.github.io/openapi/api/types/ILlamaSchema-1.html)
|
|
484
|
-
* -
|
|
492
|
+
* - Middle layer schemas
|
|
485
493
|
* - `3.0`: [`ILlmSchemaV3`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3-1.html)
|
|
486
494
|
* - `3.1`: [`ILlmSchemaV3_1`](https://samchon.github.io/openapi/api/types/ILlmSchemaV3_1-1.html)
|
|
487
495
|
*
|
package/src/misc.ts
CHANGED
|
@@ -60,7 +60,7 @@ export function literals(): never {
|
|
|
60
60
|
CLONE
|
|
61
61
|
----------------------------------------------------------- */
|
|
62
62
|
/**
|
|
63
|
-
* Clone
|
|
63
|
+
* Clone data.
|
|
64
64
|
*
|
|
65
65
|
* Clones an instance following type `T`. If the target *input* value or its member
|
|
66
66
|
* variable contains a class instance having methods, those methods would not be
|
|
@@ -87,7 +87,7 @@ export function clone(): never {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* Clone
|
|
90
|
+
* Clone data with type assertion.
|
|
91
91
|
*
|
|
92
92
|
* Clones an instance following type `T`, with type assertion. If the target `input`
|
|
93
93
|
* value or its member variable contains a class instance having methods, those
|
|
@@ -110,7 +110,7 @@ export function assertClone<T>(
|
|
|
110
110
|
): Resolved<T>;
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* Clone
|
|
113
|
+
* Clone data with type assertion.
|
|
114
114
|
*
|
|
115
115
|
* Clones an instance following type `T`, with type assertion. If the target `input`
|
|
116
116
|
* value or its member variable contains a class instance having methods, those
|
|
@@ -140,7 +140,7 @@ export function assertClone(): never {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
* Clone
|
|
143
|
+
* Clone data with type checking.
|
|
144
144
|
*
|
|
145
145
|
* Clones an instance following type `T`, with type checking. If the target `input`
|
|
146
146
|
* value or its member variable contains a class instance having methods, those
|
|
@@ -159,7 +159,7 @@ export function assertClone(): never {
|
|
|
159
159
|
export function isClone<T>(input: T): Resolved<T> | null;
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
* Clone
|
|
162
|
+
* Clone data with type checking.
|
|
163
163
|
*
|
|
164
164
|
* Clones an instance following type `T`, with type checking. If the target `input`
|
|
165
165
|
* value or its member variable contains a class instance having methods, those
|
|
@@ -185,7 +185,7 @@ export function isClone(): never {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
-
* Clone
|
|
188
|
+
* Clone data with detailed type validation.
|
|
189
189
|
*
|
|
190
190
|
* Clones an instance following type `T`, with detailed type validation. If the target
|
|
191
191
|
* `input` value or its member variable contains a class instance having methods,
|
|
@@ -203,7 +203,7 @@ export function isClone(): never {
|
|
|
203
203
|
export function validateClone<T>(input: T): IValidation<Resolved<T>>;
|
|
204
204
|
|
|
205
205
|
/**
|
|
206
|
-
* Clone
|
|
206
|
+
* Clone data with detailed type validation.
|
|
207
207
|
*
|
|
208
208
|
* Clones an instance following type `T`, with detailed type validation. If the target
|
|
209
209
|
* `input` value or its member variable contains a class instance having methods,
|
|
@@ -233,8 +233,8 @@ export function validateClone(): never {
|
|
|
233
233
|
/**
|
|
234
234
|
* Prune, erase superfluous properties.
|
|
235
235
|
*
|
|
236
|
-
* Remove
|
|
237
|
-
* objects. Note that, as
|
|
236
|
+
* Remove all superfluous properties from the `input` object, even including nested
|
|
237
|
+
* objects. Note that, as all superfluous properties would be deleted, you never can
|
|
238
238
|
* read those superfluous properties after calling this `prune()` function.
|
|
239
239
|
*
|
|
240
240
|
* For reference, this `typia.misc.prune()` function does not validate the input value
|
|
@@ -264,12 +264,12 @@ export function prune(): never {
|
|
|
264
264
|
* Prune, erase superfluous properties, with type assertion.
|
|
265
265
|
*
|
|
266
266
|
* `typia.misc.assertPrune()` is a combination function of {@link assert} and
|
|
267
|
-
* {@link prune}. Therefore, it removes
|
|
267
|
+
* {@link prune}. Therefore, it removes all superfluous properties from the `input`
|
|
268
268
|
* object including nested objects, with type assertion.
|
|
269
269
|
*
|
|
270
270
|
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
271
271
|
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
|
|
272
|
-
* there's no problem on the `input` value, its
|
|
272
|
+
* there's no problem on the `input` value, its all superfluous properties would be
|
|
273
273
|
* removed, including nested objects.
|
|
274
274
|
*
|
|
275
275
|
* @template T Type of the input value
|
|
@@ -287,12 +287,12 @@ export function assertPrune<T>(
|
|
|
287
287
|
* Prune, erase superfluous properties, with type assertion.
|
|
288
288
|
*
|
|
289
289
|
* `typia.misc.assertPrune()` is a combination function of {@link assert} and
|
|
290
|
-
* {@link prune}. Therefore, it removes
|
|
290
|
+
* {@link prune}. Therefore, it removes all superfluous properties from the `input`
|
|
291
291
|
* object including nested objects, with type assertion.
|
|
292
292
|
*
|
|
293
293
|
* In such reason, when `input` value is not matched with the type `T`, it throws an
|
|
294
294
|
* {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise, there's
|
|
295
|
-
* no problem on the `input` value, its
|
|
295
|
+
* no problem on the `input` value, its all superfluous properties would be removed,
|
|
296
296
|
* including nested objects.
|
|
297
297
|
*
|
|
298
298
|
* @template T Type of the input value
|
|
@@ -316,13 +316,13 @@ export function assertPrune(): unknown {
|
|
|
316
316
|
/**
|
|
317
317
|
* Prune, erase superfluous properties, with type checking.
|
|
318
318
|
*
|
|
319
|
-
* `typia.misc.
|
|
320
|
-
* {@link prune}. Therefore, it removes
|
|
319
|
+
* `typia.misc.isPrune()` is a combination function of {@link is} and
|
|
320
|
+
* {@link prune}. Therefore, it removes all superfluous properties from the `input`
|
|
321
321
|
* object including nested objects, with type checking.
|
|
322
322
|
*
|
|
323
323
|
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
324
324
|
* `false` value. Otherwise, there's no problem on the `input` value, it returns
|
|
325
|
-
* `true` after removing
|
|
325
|
+
* `true` after removing all superfluous properties, including nested objects.
|
|
326
326
|
*
|
|
327
327
|
* @template T Type of the input value
|
|
328
328
|
* @param input Target instance to check and prune
|
|
@@ -335,13 +335,13 @@ export function isPrune<T>(input: T): input is T;
|
|
|
335
335
|
/**
|
|
336
336
|
* Prune, erase superfluous properties, with type checking.
|
|
337
337
|
*
|
|
338
|
-
* `typia.misc.
|
|
339
|
-
* {@link prune}. Therefore, it removes
|
|
338
|
+
* `typia.misc.isPrune()` is a combination function of {@link is} and
|
|
339
|
+
* {@link prune}. Therefore, it removes all superfluous properties from the `input`
|
|
340
340
|
* object including nested objects, with type checking.
|
|
341
341
|
*
|
|
342
342
|
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
343
343
|
* `false` value. Otherwise, there's no problem on the `input` value, it returns
|
|
344
|
-
* `true` after removing
|
|
344
|
+
* `true` after removing all superfluous properties, including nested objects.
|
|
345
345
|
*
|
|
346
346
|
* @template T Type of the input value
|
|
347
347
|
* @param input Target instance to check and prune
|
|
@@ -362,13 +362,13 @@ export function isPrune(): never {
|
|
|
362
362
|
* Prune, erase superfluous properties, with type validation.
|
|
363
363
|
*
|
|
364
364
|
* `typia.misc.validatePrune()` is a combination function of {@link validate} and
|
|
365
|
-
* {@link prune}. Therefore, it removes
|
|
365
|
+
* {@link prune}. Therefore, it removes all superfluous properties from the `input`
|
|
366
366
|
* object including nested objects, with type validation.
|
|
367
367
|
*
|
|
368
368
|
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
369
369
|
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
370
370
|
* no problem on the `input` value, it returns {@link IValidation.ISuccess} value after
|
|
371
|
-
* removing
|
|
371
|
+
* removing all superfluous properties, including nested objects.
|
|
372
372
|
*
|
|
373
373
|
* @template T Type of the input value
|
|
374
374
|
* @param input Target instance to validate and prune
|
|
@@ -382,13 +382,13 @@ export function validatePrune<T>(input: T): IValidation<T>;
|
|
|
382
382
|
* Prune, erase superfluous properties, with type validation.
|
|
383
383
|
*
|
|
384
384
|
* `typia.misc.validatePrune()` is a combination function of {@link validate} and
|
|
385
|
-
* {@link prune}. Therefore, it removes
|
|
385
|
+
* {@link prune}. Therefore, it removes all superfluous properties from the `input`
|
|
386
386
|
* object including nested objects, with type validation.
|
|
387
387
|
*
|
|
388
388
|
* In such reason, when `input` value is not matched with the type `T`, it returns
|
|
389
389
|
* {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
|
|
390
390
|
* no problem on the `input` value, it returns {@link IValidation.ISuccess} value after
|
|
391
|
-
* removing
|
|
391
|
+
* removing all superfluous properties, including nested objects.
|
|
392
392
|
*
|
|
393
393
|
* @template T Type of the input value
|
|
394
394
|
* @param input Target instance to validate and prune
|