typia 10.0.2 → 11.0.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/README.md +14 -10
- package/lib/factories/internal/metadata/emplace_metadata_object.js +11 -1
- package/lib/factories/internal/metadata/emplace_metadata_object.js.map +1 -1
- package/lib/factories/internal/metadata/emplace_metadata_object.mjs +11 -0
- package/lib/index.mjs +2 -2
- package/lib/internal/_createStandardSchema.d.mts +1 -1
- package/lib/internal/_createStandardSchema.d.ts +1 -1
- package/lib/internal/_createStandardSchema.js.map +1 -1
- package/lib/internal/_llmApplicationFinalize.d.mts +2 -2
- package/lib/internal/_llmApplicationFinalize.d.ts +2 -2
- package/lib/internal/_llmApplicationFinalize.js +9 -10
- package/lib/internal/_llmApplicationFinalize.js.map +1 -1
- package/lib/internal/_llmApplicationFinalize.mjs +12 -13
- package/lib/llm.d.mts +20 -199
- package/lib/llm.d.ts +20 -199
- package/lib/llm.js.map +1 -1
- package/lib/misc.d.mts +3 -3
- package/lib/misc.d.ts +3 -3
- package/lib/misc.js.map +1 -1
- package/lib/module.d.mts +2 -2
- package/lib/module.d.ts +2 -2
- package/lib/programmers/internal/json_schema_object.js +1 -0
- package/lib/programmers/internal/json_schema_object.js.map +1 -1
- package/lib/programmers/internal/json_schema_object.mjs +1 -0
- package/lib/programmers/llm/LlmApplicationProgrammer.d.mts +8 -8
- package/lib/programmers/llm/LlmApplicationProgrammer.d.ts +8 -8
- package/lib/programmers/llm/LlmApplicationProgrammer.js +58 -64
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.mjs +63 -68
- package/lib/programmers/llm/{LlmModelPredicator.d.mts → LlmMetadataFactory.d.mts} +2 -8
- package/lib/programmers/llm/{LlmModelPredicator.d.ts → LlmMetadataFactory.d.ts} +2 -8
- package/lib/programmers/llm/{LlmModelPredicator.js → LlmMetadataFactory.js} +6 -37
- package/lib/programmers/llm/LlmMetadataFactory.js.map +1 -0
- package/lib/programmers/llm/{LlmModelPredicator.mjs → LlmMetadataFactory.mjs} +6 -34
- package/lib/programmers/llm/LlmMetadataFactory.mjs.map +1 -0
- package/lib/programmers/llm/LlmParametersProgrammer.d.mts +8 -8
- package/lib/programmers/llm/LlmParametersProgrammer.d.ts +8 -8
- package/lib/programmers/llm/LlmParametersProgrammer.js +10 -10
- package/lib/programmers/llm/LlmParametersProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmParametersProgrammer.mjs +10 -13
- package/lib/programmers/llm/LlmSchemaProgrammer.d.mts +10 -12
- package/lib/programmers/llm/LlmSchemaProgrammer.d.ts +10 -12
- package/lib/programmers/llm/LlmSchemaProgrammer.js +21 -33
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.mjs +21 -37
- package/lib/schemas/metadata/IMetadataProperty.d.mts +1 -0
- package/lib/schemas/metadata/IMetadataProperty.d.ts +1 -0
- package/lib/schemas/metadata/MetadataProperty.d.mts +1 -0
- package/lib/schemas/metadata/MetadataProperty.d.ts +1 -0
- package/lib/schemas/metadata/MetadataProperty.js +3 -0
- package/lib/schemas/metadata/MetadataProperty.js.map +1 -1
- package/lib/schemas/metadata/MetadataProperty.mjs +4 -0
- package/lib/transformers/features/llm/LlmApplicationTransformer.d.mts +0 -2
- package/lib/transformers/features/llm/LlmApplicationTransformer.d.ts +0 -2
- package/lib/transformers/features/llm/LlmApplicationTransformer.js +9 -20
- package/lib/transformers/features/llm/LlmApplicationTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmApplicationTransformer.mjs +9 -20
- package/lib/transformers/features/llm/LlmControllerTransformer.js +1 -8
- package/lib/transformers/features/llm/LlmControllerTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmControllerTransformer.mjs +1 -8
- package/lib/transformers/features/llm/LlmParametersTransformer.js +6 -15
- package/lib/transformers/features/llm/LlmParametersTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmParametersTransformer.mjs +6 -15
- package/lib/transformers/features/llm/LlmSchemaTransformer.js +11 -26
- package/lib/transformers/features/llm/LlmSchemaTransformer.js.map +1 -1
- package/lib/transformers/features/llm/LlmSchemaTransformer.mjs +11 -26
- package/package.json +4 -3
- package/src/factories/internal/metadata/emplace_metadata_object.ts +16 -0
- package/src/internal/_createStandardSchema.ts +2 -2
- package/src/internal/_llmApplicationFinalize.ts +18 -25
- package/src/llm.ts +28 -221
- package/src/misc.ts +9 -9
- package/src/module.ts +2 -2
- package/src/programmers/internal/json_schema_object.ts +1 -0
- package/src/programmers/llm/LlmApplicationProgrammer.ts +139 -151
- package/src/programmers/llm/{LlmModelPredicator.ts → LlmMetadataFactory.ts} +4 -42
- package/src/programmers/llm/LlmParametersProgrammer.ts +34 -41
- package/src/programmers/llm/LlmSchemaProgrammer.ts +59 -98
- package/src/schemas/metadata/IMetadataProperty.ts +1 -0
- package/src/schemas/metadata/MetadataProperty.ts +4 -0
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +14 -29
- package/src/transformers/features/llm/LlmControllerTransformer.ts +1 -12
- package/src/transformers/features/llm/LlmParametersTransformer.ts +10 -21
- package/src/transformers/features/llm/LlmSchemaTransformer.ts +29 -65
- package/lib/programmers/llm/LlmModelPredicator.js.map +0 -1
- package/lib/programmers/llm/LlmModelPredicator.mjs.map +0 -1
|
@@ -2,13 +2,13 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
2
2
|
import { MetadataFactory } from "../../factories/MetadataFactory";
|
|
3
3
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
4
4
|
export declare namespace LlmParametersProgrammer {
|
|
5
|
-
const write:
|
|
6
|
-
model: Model;
|
|
5
|
+
const write: (props: {
|
|
7
6
|
metadata: Metadata;
|
|
8
|
-
config?: Partial<ILlmSchema.
|
|
9
|
-
}) => ILlmSchema.
|
|
10
|
-
const validate:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
config?: Partial<ILlmSchema.IConfig>;
|
|
8
|
+
}) => ILlmSchema.IParameters;
|
|
9
|
+
const validate: (props: {
|
|
10
|
+
config?: Partial<ILlmSchema.IConfig>;
|
|
11
|
+
metadata: Metadata;
|
|
12
|
+
explore: MetadataFactory.IExplore;
|
|
13
|
+
}) => string[];
|
|
14
14
|
}
|
|
@@ -25,8 +25,8 @@ var LlmParametersProgrammer;
|
|
|
25
25
|
}
|
|
26
26
|
throw new Error("Unreachable code. Failed to find the object schema.");
|
|
27
27
|
})();
|
|
28
|
-
const result = LlmSchemaComposer_1.LlmSchemaComposer.parameters(
|
|
29
|
-
config:
|
|
28
|
+
const result = LlmSchemaComposer_1.LlmSchemaComposer.parameters({
|
|
29
|
+
config: LlmSchemaComposer_1.LlmSchemaComposer.getConfig(props.config),
|
|
30
30
|
components: collection.components,
|
|
31
31
|
schema,
|
|
32
32
|
});
|
|
@@ -40,23 +40,23 @@ var LlmParametersProgrammer;
|
|
|
40
40
|
});
|
|
41
41
|
return result.value;
|
|
42
42
|
};
|
|
43
|
-
LlmParametersProgrammer.validate = (props) =>
|
|
43
|
+
LlmParametersProgrammer.validate = (props) => {
|
|
44
44
|
const output = [];
|
|
45
|
-
if (explore.top === true) {
|
|
46
|
-
if (metadata.objects.length === 0)
|
|
45
|
+
if (props.explore.top === true) {
|
|
46
|
+
if (props.metadata.objects.length === 0)
|
|
47
47
|
output.push("LLM parameters must be an object type.");
|
|
48
|
-
else if (metadata.objects.length !== 1 || metadata.size() > 1)
|
|
48
|
+
else if (props.metadata.objects.length !== 1 || props.metadata.size() > 1)
|
|
49
49
|
output.push("LLM parameters must be a single object type.");
|
|
50
50
|
else {
|
|
51
|
-
if (metadata.objects[0].type.properties.some((p) => p.key.isSoleLiteral() === false))
|
|
51
|
+
if (props.metadata.objects[0].type.properties.some((p) => p.key.isSoleLiteral() === false))
|
|
52
52
|
output.push("LLM parameters must not have dynamic keys.");
|
|
53
|
-
if (metadata.nullable)
|
|
53
|
+
if (props.metadata.nullable)
|
|
54
54
|
output.push("LLM parameters must be a non-nullable object type.");
|
|
55
|
-
if (metadata.isRequired() === false)
|
|
55
|
+
if (props.metadata.isRequired() === false)
|
|
56
56
|
output.push("LLM parameters must be a non-undefined object type.");
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
output.push(...LlmSchemaProgrammer_1.LlmSchemaProgrammer.validate(props)
|
|
59
|
+
output.push(...LlmSchemaProgrammer_1.LlmSchemaProgrammer.validate(props));
|
|
60
60
|
return output;
|
|
61
61
|
};
|
|
62
62
|
})(LlmParametersProgrammer || (exports.LlmParametersProgrammer = LlmParametersProgrammer = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmParametersProgrammer.js","sourceRoot":"","sources":["../../../src/programmers/llm/LlmParametersProgrammer.ts"],"names":[],"mappings":";;;AAAA,8CAM0B;AAC1B,wFAAqF;AAMrF,0EAAuE;AAGvE,yEAAsE;AACtE,+DAA4D;AAE5D,IAAiB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"LlmParametersProgrammer.js","sourceRoot":"","sources":["../../../src/programmers/llm/LlmParametersProgrammer.ts"],"names":[],"mappings":";;;AAAA,8CAM0B;AAC1B,wFAAqF;AAMrF,0EAAuE;AAGvE,yEAAsE;AACtE,+DAA4D;AAE5D,IAAiB,uBAAuB,CAkEvC;AAlED,WAAiB,uBAAuB;IACzB,6BAAK,GAAG,CAAC,KAGrB,EAA0B,EAAE;QAC3B,MAAM,UAAU,GACd,6CAAqB,CAAC,KAAK,CAAC;YAC1B,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;SAC5B,CAAC,CAAC;QACL,MAAM,MAAM,GAAgC,CAAC,GAAG,EAAE;;YAChD,MAAM,MAAM,GAAwB,UAAU,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC;YAC3D,IAAI,4BAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAE,OAAO,MAAM,CAA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nD,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;gBACvE,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;iBACzD,CAAC;gBACJ,IACE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAC7C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,KAAK,CACvC;oBAED,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;gBAC5D,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ;oBACzB,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;gBACpE,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,KAAK;oBACvC,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,yCAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,EAlEgB,uBAAuB,uCAAvB,uBAAuB,QAkEvC"}
|
|
@@ -22,11 +22,8 @@ var LlmParametersProgrammer;
|
|
|
22
22
|
}
|
|
23
23
|
throw new Error("Unreachable code. Failed to find the object schema.");
|
|
24
24
|
})();
|
|
25
|
-
const result = LlmSchemaComposer.parameters(
|
|
26
|
-
config:
|
|
27
|
-
...LlmSchemaComposer.defaultConfig(props.model),
|
|
28
|
-
...props.config,
|
|
29
|
-
},
|
|
25
|
+
const result = LlmSchemaComposer.parameters({
|
|
26
|
+
config: LlmSchemaComposer.getConfig(props.config),
|
|
30
27
|
components: collection.components,
|
|
31
28
|
schema,
|
|
32
29
|
});
|
|
@@ -40,23 +37,23 @@ var LlmParametersProgrammer;
|
|
|
40
37
|
});
|
|
41
38
|
return result.value;
|
|
42
39
|
};
|
|
43
|
-
LlmParametersProgrammer.validate = (props) =>
|
|
40
|
+
LlmParametersProgrammer.validate = (props) => {
|
|
44
41
|
const output = [];
|
|
45
|
-
if (explore.top === true) {
|
|
46
|
-
if (metadata.objects.length === 0)
|
|
42
|
+
if (props.explore.top === true) {
|
|
43
|
+
if (props.metadata.objects.length === 0)
|
|
47
44
|
output.push("LLM parameters must be an object type.");
|
|
48
|
-
else if (metadata.objects.length !== 1 || metadata.size() > 1)
|
|
45
|
+
else if (props.metadata.objects.length !== 1 || props.metadata.size() > 1)
|
|
49
46
|
output.push("LLM parameters must be a single object type.");
|
|
50
47
|
else {
|
|
51
|
-
if (metadata.objects[0].type.properties.some((p) => p.key.isSoleLiteral() === false))
|
|
48
|
+
if (props.metadata.objects[0].type.properties.some((p) => p.key.isSoleLiteral() === false))
|
|
52
49
|
output.push("LLM parameters must not have dynamic keys.");
|
|
53
|
-
if (metadata.nullable)
|
|
50
|
+
if (props.metadata.nullable)
|
|
54
51
|
output.push("LLM parameters must be a non-nullable object type.");
|
|
55
|
-
if (metadata.isRequired() === false)
|
|
52
|
+
if (props.metadata.isRequired() === false)
|
|
56
53
|
output.push("LLM parameters must be a non-undefined object type.");
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
output.push(...LlmSchemaProgrammer.validate(props)
|
|
56
|
+
output.push(...LlmSchemaProgrammer.validate(props));
|
|
60
57
|
return output;
|
|
61
58
|
};
|
|
62
59
|
})(LlmParametersProgrammer || (LlmParametersProgrammer = {}));
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
3
3
|
export declare namespace LlmSchemaProgrammer {
|
|
4
|
-
interface IOutput
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
$defs: Record<string, ILlmSchema.ModelSchema[Model]>;
|
|
4
|
+
interface IOutput {
|
|
5
|
+
schema: ILlmSchema;
|
|
6
|
+
$defs: Record<string, ILlmSchema>;
|
|
8
7
|
}
|
|
9
|
-
const write:
|
|
10
|
-
model: Model;
|
|
8
|
+
const write: (props: {
|
|
11
9
|
metadata: Metadata;
|
|
12
|
-
config?: Partial<ILlmSchema.
|
|
13
|
-
}) => IOutput
|
|
14
|
-
const validate:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) =>
|
|
10
|
+
config?: Partial<ILlmSchema.IConfig>;
|
|
11
|
+
}) => IOutput;
|
|
12
|
+
const validate: (props: {
|
|
13
|
+
config?: Partial<ILlmSchema.IConfig>;
|
|
14
|
+
metadata: Metadata;
|
|
15
|
+
}) => string[];
|
|
18
16
|
}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
3
3
|
export declare namespace LlmSchemaProgrammer {
|
|
4
|
-
interface IOutput
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
$defs: Record<string, ILlmSchema.ModelSchema[Model]>;
|
|
4
|
+
interface IOutput {
|
|
5
|
+
schema: ILlmSchema;
|
|
6
|
+
$defs: Record<string, ILlmSchema>;
|
|
8
7
|
}
|
|
9
|
-
const write:
|
|
10
|
-
model: Model;
|
|
8
|
+
const write: (props: {
|
|
11
9
|
metadata: Metadata;
|
|
12
|
-
config?: Partial<ILlmSchema.
|
|
13
|
-
}) => IOutput
|
|
14
|
-
const validate:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) =>
|
|
10
|
+
config?: Partial<ILlmSchema.IConfig>;
|
|
11
|
+
}) => IOutput;
|
|
12
|
+
const validate: (props: {
|
|
13
|
+
config?: Partial<ILlmSchema.IConfig>;
|
|
14
|
+
metadata: Metadata;
|
|
15
|
+
}) => string[];
|
|
18
16
|
}
|
|
@@ -18,11 +18,11 @@ var LlmSchemaProgrammer;
|
|
|
18
18
|
metadatas: [props.metadata],
|
|
19
19
|
});
|
|
20
20
|
const $defs = {};
|
|
21
|
-
const result = LlmSchemaComposer_1.LlmSchemaComposer.schema(
|
|
22
|
-
config:
|
|
21
|
+
const result = LlmSchemaComposer_1.LlmSchemaComposer.schema({
|
|
22
|
+
config: LlmSchemaComposer_1.LlmSchemaComposer.getConfig(props.config),
|
|
23
23
|
components: collection.components,
|
|
24
24
|
schema: collection.schemas[0],
|
|
25
|
-
$defs
|
|
25
|
+
$defs,
|
|
26
26
|
});
|
|
27
27
|
if (result.success === false)
|
|
28
28
|
throw new TransformerError_1.TransformerError({
|
|
@@ -33,46 +33,34 @@ var LlmSchemaProgrammer;
|
|
|
33
33
|
.join("\n"),
|
|
34
34
|
});
|
|
35
35
|
return {
|
|
36
|
-
model: props.model,
|
|
37
36
|
$defs,
|
|
38
37
|
schema: result.value,
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
|
-
LlmSchemaProgrammer.validate = (props) =>
|
|
42
|
-
var _a, _b, _c, _d;
|
|
40
|
+
LlmSchemaProgrammer.validate = (props) => {
|
|
43
41
|
const output = [];
|
|
44
|
-
// no additionalProperties in
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
metadata.objects.some((o) => o.type.properties.some((p) => p.key.isSoleLiteral() === false && p.value.size() !== 0)))
|
|
48
|
-
output.push(`
|
|
49
|
-
//
|
|
50
|
-
if (
|
|
51
|
-
((
|
|
52
|
-
|
|
53
|
-
output.push(`LLM schema of "chatgpt" (strict mode) does not support optional property in object.`);
|
|
54
|
-
// no recursive rule of Gemini and V3
|
|
55
|
-
if (props.model === "3.0" &&
|
|
56
|
-
(((_c = props.config) === null || _c === void 0 ? void 0 : _c.recursive) ===
|
|
57
|
-
false ||
|
|
58
|
-
((_d = props.config) === null || _d === void 0 ? void 0 : _d.recursive) === 0)) {
|
|
59
|
-
if (metadata.objects.some((o) => o.type.recursive))
|
|
60
|
-
output.push(`LLM schema of "${props.model}" does not support recursive object.`);
|
|
61
|
-
if (metadata.arrays.some((a) => a.type.recursive))
|
|
62
|
-
output.push(`LLM schema of "${props.model}" does not support recursive array.`);
|
|
63
|
-
}
|
|
42
|
+
// no additionalProperties in OpenAI strict mode
|
|
43
|
+
const config = LlmSchemaComposer_1.LlmSchemaComposer.getConfig(props.config);
|
|
44
|
+
if (config.strict === true &&
|
|
45
|
+
props.metadata.objects.some((o) => o.type.properties.some((p) => p.key.isSoleLiteral() === false && p.value.size() !== 0)))
|
|
46
|
+
output.push(`Strict mode does not allow dynamic property in object.`);
|
|
47
|
+
// OpenAI strict mode even does not support the optional property
|
|
48
|
+
if (config.strict === true &&
|
|
49
|
+
props.metadata.objects.some((o) => o.type.properties.some((p) => p.value.isRequired() === false)))
|
|
50
|
+
output.push(`Strict mode does not support optional property in object.`);
|
|
64
51
|
// just JSON rule
|
|
65
|
-
if (metadata.atomics.some((a) => a.type === "bigint") ||
|
|
66
|
-
metadata.constants.some((c) => c.type === "bigint"))
|
|
52
|
+
if (props.metadata.atomics.some((a) => a.type === "bigint") ||
|
|
53
|
+
props.metadata.constants.some((c) => c.type === "bigint"))
|
|
67
54
|
output.push("LLM schema does not support bigint type.");
|
|
68
|
-
if (metadata.tuples.
|
|
69
|
-
|
|
55
|
+
if (props.metadata.tuples.length !== 0)
|
|
56
|
+
output.push("LLM schema does not support tuple type.");
|
|
57
|
+
if (props.metadata.arrays.some((a) => a.type.value.isRequired() === false))
|
|
70
58
|
output.push("LLM schema does not support undefined type in array.");
|
|
71
|
-
if (metadata.maps.length)
|
|
59
|
+
if (props.metadata.maps.length)
|
|
72
60
|
output.push("LLM schema does not support Map type.");
|
|
73
|
-
if (metadata.sets.length)
|
|
61
|
+
if (props.metadata.sets.length)
|
|
74
62
|
output.push("LLM schema does not support Set type.");
|
|
75
|
-
for (const native of metadata.natives)
|
|
63
|
+
for (const native of props.metadata.natives)
|
|
76
64
|
if (AtomicPredicator_1.AtomicPredicator.native(native.name) === false &&
|
|
77
65
|
native.name !== "Date" &&
|
|
78
66
|
native.name !== "Blob" &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmSchemaProgrammer.js","sourceRoot":"","sources":["../../../src/programmers/llm/LlmSchemaProgrammer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"LlmSchemaProgrammer.js","sourceRoot":"","sources":["../../../src/programmers/llm/LlmSchemaProgrammer.ts"],"names":[],"mappings":";;;AACA,wFAAqF;AAKrF,0EAAuE;AAEvE,kEAA+D;AAC/D,uEAAoE;AACpE,yEAAsE;AACtE,uEAAoE;AACpE,uEAAoE;AACpE,uEAAoE;AACpE,yEAAsE;AAEtE,IAAiB,mBAAmB,CA4FnC;AA5FD,WAAiB,mBAAmB;IAMrB,yBAAK,GAAG,CAAC,KAGrB,EAAW,EAAE;QACZ,MAAM,UAAU,GACd,6CAAqB,CAAC,KAAK,CAAC;YAC1B,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;SAC5B,CAAC,CAAC;QAEL,MAAM,KAAK,GAA+B,EAAE,CAAC;QAC7C,MAAM,MAAM,GACV,qCAAiB,CAAC,MAAM,CAAC;YACvB,MAAM,EAAE,qCAAiB,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;YACjD,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAE;YAC9B,KAAK;SACN,CAAC,CAAC;QACL,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;YAC1B,MAAM,IAAI,mCAAgB,CAAC;gBACzB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EACL,kDAAkD;oBAClD,MAAM,CAAC,KAAK,CAAC,OAAO;yBACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;yBAC7C,IAAI,CAAC,IAAI,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AAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK;QACzD,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,CAC9D;SACA,GAAG,CACF,CAAC,CAAC,EAAE,EAAE,CACJ,IAAA,uCAAkB,EAAC;QACjB,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,CAAC;KACV,CAAC,CAAC,MAAM,CACZ;SACA,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -11,14 +11,11 @@ var LlmSchemaProgrammer;
|
|
|
11
11
|
metadatas: [props.metadata],
|
|
12
12
|
});
|
|
13
13
|
const $defs = {};
|
|
14
|
-
const result = LlmSchemaComposer.schema(
|
|
15
|
-
config:
|
|
16
|
-
...LlmSchemaComposer.defaultConfig(props.model),
|
|
17
|
-
...props.config,
|
|
18
|
-
},
|
|
14
|
+
const result = LlmSchemaComposer.schema({
|
|
15
|
+
config: LlmSchemaComposer.getConfig(props.config),
|
|
19
16
|
components: collection.components,
|
|
20
17
|
schema: collection.schemas[0],
|
|
21
|
-
$defs
|
|
18
|
+
$defs,
|
|
22
19
|
});
|
|
23
20
|
if (result.success === false)
|
|
24
21
|
throw new TransformerError({
|
|
@@ -29,47 +26,34 @@ var LlmSchemaProgrammer;
|
|
|
29
26
|
.join("\n"),
|
|
30
27
|
});
|
|
31
28
|
return {
|
|
32
|
-
model: props.model,
|
|
33
29
|
$defs,
|
|
34
30
|
schema: result.value,
|
|
35
31
|
};
|
|
36
32
|
};
|
|
37
|
-
LlmSchemaProgrammer.validate = (props) =>
|
|
33
|
+
LlmSchemaProgrammer.validate = (props) => {
|
|
38
34
|
const output = [];
|
|
39
|
-
// no additionalProperties in
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
?.strict === true &&
|
|
49
|
-
metadata.objects.some((o) => o.type.properties.some((p) => p.value.isRequired() === false)))
|
|
50
|
-
output.push(`LLM schema of "chatgpt" (strict mode) does not support optional property in object.`);
|
|
51
|
-
// no recursive rule of Gemini and V3
|
|
52
|
-
if (props.model === "3.0" &&
|
|
53
|
-
(props.config?.recursive ===
|
|
54
|
-
false ||
|
|
55
|
-
props.config?.recursive === 0)) {
|
|
56
|
-
if (metadata.objects.some((o) => o.type.recursive))
|
|
57
|
-
output.push(`LLM schema of "${props.model}" does not support recursive object.`);
|
|
58
|
-
if (metadata.arrays.some((a) => a.type.recursive))
|
|
59
|
-
output.push(`LLM schema of "${props.model}" does not support recursive array.`);
|
|
60
|
-
}
|
|
35
|
+
// no additionalProperties in OpenAI strict mode
|
|
36
|
+
const config = LlmSchemaComposer.getConfig(props.config);
|
|
37
|
+
if (config.strict === true &&
|
|
38
|
+
props.metadata.objects.some((o) => o.type.properties.some((p) => p.key.isSoleLiteral() === false && p.value.size() !== 0)))
|
|
39
|
+
output.push(`Strict mode does not allow dynamic property in object.`);
|
|
40
|
+
// OpenAI strict mode even does not support the optional property
|
|
41
|
+
if (config.strict === true &&
|
|
42
|
+
props.metadata.objects.some((o) => o.type.properties.some((p) => p.value.isRequired() === false)))
|
|
43
|
+
output.push(`Strict mode does not support optional property in object.`);
|
|
61
44
|
// just JSON rule
|
|
62
|
-
if (metadata.atomics.some((a) => a.type === "bigint") ||
|
|
63
|
-
metadata.constants.some((c) => c.type === "bigint"))
|
|
45
|
+
if (props.metadata.atomics.some((a) => a.type === "bigint") ||
|
|
46
|
+
props.metadata.constants.some((c) => c.type === "bigint"))
|
|
64
47
|
output.push("LLM schema does not support bigint type.");
|
|
65
|
-
if (metadata.tuples.
|
|
66
|
-
|
|
48
|
+
if (props.metadata.tuples.length !== 0)
|
|
49
|
+
output.push("LLM schema does not support tuple type.");
|
|
50
|
+
if (props.metadata.arrays.some((a) => a.type.value.isRequired() === false))
|
|
67
51
|
output.push("LLM schema does not support undefined type in array.");
|
|
68
|
-
if (metadata.maps.length)
|
|
52
|
+
if (props.metadata.maps.length)
|
|
69
53
|
output.push("LLM schema does not support Map type.");
|
|
70
|
-
if (metadata.sets.length)
|
|
54
|
+
if (props.metadata.sets.length)
|
|
71
55
|
output.push("LLM schema does not support Set type.");
|
|
72
|
-
for (const native of metadata.natives)
|
|
56
|
+
for (const native of props.metadata.natives)
|
|
73
57
|
if (AtomicPredicator.native(native.name) === false &&
|
|
74
58
|
native.name !== "Date" &&
|
|
75
59
|
native.name !== "Blob" &&
|
|
@@ -7,6 +7,7 @@ export declare class MetadataProperty {
|
|
|
7
7
|
readonly value: Metadata;
|
|
8
8
|
readonly description: string | null;
|
|
9
9
|
readonly jsDocTags: IJsDocTagInfo[];
|
|
10
|
+
readonly mutability?: "readonly" | null | undefined;
|
|
10
11
|
of_protobuf_?: IProtobufProperty;
|
|
11
12
|
/** @ignore */
|
|
12
13
|
private constructor();
|
|
@@ -7,6 +7,7 @@ export declare class MetadataProperty {
|
|
|
7
7
|
readonly value: Metadata;
|
|
8
8
|
readonly description: string | null;
|
|
9
9
|
readonly jsDocTags: IJsDocTagInfo[];
|
|
10
|
+
readonly mutability?: "readonly" | null | undefined;
|
|
10
11
|
of_protobuf_?: IProtobufProperty;
|
|
11
12
|
/** @ignore */
|
|
12
13
|
private constructor();
|
|
@@ -12,6 +12,7 @@ class MetadataProperty {
|
|
|
12
12
|
this.value = props.value;
|
|
13
13
|
this.description = props.description;
|
|
14
14
|
this.jsDocTags = props.jsDocTags;
|
|
15
|
+
this.mutability = props.mutability;
|
|
15
16
|
}
|
|
16
17
|
/** @internal */
|
|
17
18
|
static create(props) {
|
|
@@ -24,6 +25,7 @@ class MetadataProperty {
|
|
|
24
25
|
value: Metadata_1.Metadata.from(property.value, dict),
|
|
25
26
|
description: property.description,
|
|
26
27
|
jsDocTags: property.jsDocTags.slice(),
|
|
28
|
+
mutability: property.mutability,
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
toJSON() {
|
|
@@ -32,6 +34,7 @@ class MetadataProperty {
|
|
|
32
34
|
value: this.value.toJSON(),
|
|
33
35
|
description: this.description,
|
|
34
36
|
jsDocTags: this.jsDocTags,
|
|
37
|
+
mutability: this.mutability,
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetadataProperty.js","sourceRoot":"","sources":["../../../src/schemas/metadata/MetadataProperty.ts"],"names":[],"mappings":";;;AAMA,yCAAsC;AAEtC,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"MetadataProperty.js","sourceRoot":"","sources":["../../../src/schemas/metadata/MetadataProperty.ts"],"names":[],"mappings":";;;AAMA,yCAAsC;AAEtC,MAAa,gBAAgB;IAS3B;;oEAEgE;IAChE,cAAc;IACd,YAAoB,KAAwC;QAC1D,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACrC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,MAAM,CAClB,KAAwC;QAExC,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,IAAI,CAAC,QAA2B,EAAE,IAAyB;QACvE,OAAO,gBAAgB,CAAC,MAAM,CAAC;YAC7B,GAAG,EAAE,mBAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;YACtC,KAAK,EAAE,mBAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;YAC1C,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE;YACrC,UAAU,EAAE,QAAQ,CAAC,UAAU;SAChC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM;QACX,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAC1B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;IACJ,CAAC;CACF;AAhDD,4CAgDC"}
|
|
@@ -5,6 +5,7 @@ class MetadataProperty {
|
|
|
5
5
|
value;
|
|
6
6
|
description;
|
|
7
7
|
jsDocTags;
|
|
8
|
+
mutability;
|
|
8
9
|
of_protobuf_;
|
|
9
10
|
/* -----------------------------------------------------------
|
|
10
11
|
CONSTRUCTORS
|
|
@@ -15,6 +16,7 @@ class MetadataProperty {
|
|
|
15
16
|
this.value = props.value;
|
|
16
17
|
this.description = props.description;
|
|
17
18
|
this.jsDocTags = props.jsDocTags;
|
|
19
|
+
this.mutability = props.mutability;
|
|
18
20
|
}
|
|
19
21
|
/** @internal */
|
|
20
22
|
static create(props) {
|
|
@@ -27,6 +29,7 @@ class MetadataProperty {
|
|
|
27
29
|
value: Metadata.from(property.value, dict),
|
|
28
30
|
description: property.description,
|
|
29
31
|
jsDocTags: property.jsDocTags.slice(),
|
|
32
|
+
mutability: property.mutability,
|
|
30
33
|
});
|
|
31
34
|
}
|
|
32
35
|
toJSON() {
|
|
@@ -35,6 +38,7 @@ class MetadataProperty {
|
|
|
35
38
|
value: this.value.toJSON(),
|
|
36
39
|
description: this.description,
|
|
37
40
|
jsDocTags: this.jsDocTags,
|
|
41
|
+
mutability: this.mutability,
|
|
38
42
|
};
|
|
39
43
|
}
|
|
40
44
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
1
|
import ts from "typescript";
|
|
3
2
|
import { ITransformProps } from "../../ITransformProps";
|
|
4
3
|
import { ITypiaContext } from "../../ITypiaContext";
|
|
@@ -9,6 +8,5 @@ export declare namespace LlmApplicationTransformer {
|
|
|
9
8
|
value: ts.Expression;
|
|
10
9
|
argument: ts.Expression;
|
|
11
10
|
equals?: boolean;
|
|
12
|
-
model: ILlmSchema.Model;
|
|
13
11
|
}) => ts.CallExpression;
|
|
14
12
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
1
|
import ts from "typescript";
|
|
3
2
|
import { ITransformProps } from "../../ITransformProps";
|
|
4
3
|
import { ITypiaContext } from "../../ITypiaContext";
|
|
@@ -9,6 +8,5 @@ export declare namespace LlmApplicationTransformer {
|
|
|
9
8
|
value: ts.Expression;
|
|
10
9
|
argument: ts.Expression;
|
|
11
10
|
equals?: boolean;
|
|
12
|
-
model: ILlmSchema.Model;
|
|
13
11
|
}) => ts.CallExpression;
|
|
14
12
|
}
|
|
@@ -11,7 +11,7 @@ const MetadataCollection_1 = require("../../../factories/MetadataCollection");
|
|
|
11
11
|
const MetadataFactory_1 = require("../../../factories/MetadataFactory");
|
|
12
12
|
const StatementFactory_1 = require("../../../factories/StatementFactory");
|
|
13
13
|
const LlmApplicationProgrammer_1 = require("../../../programmers/llm/LlmApplicationProgrammer");
|
|
14
|
-
const
|
|
14
|
+
const LlmMetadataFactory_1 = require("../../../programmers/llm/LlmMetadataFactory");
|
|
15
15
|
const TransformerError_1 = require("../../TransformerError");
|
|
16
16
|
var LlmApplicationTransformer;
|
|
17
17
|
(function (LlmApplicationTransformer) {
|
|
@@ -23,11 +23,9 @@ var LlmApplicationTransformer;
|
|
|
23
23
|
const literal = typescript_1.default.factory.createAsExpression(LiteralFactory_1.LiteralFactory.write(dec.application), props.context.importer.type({
|
|
24
24
|
file: "@samchon/openapi",
|
|
25
25
|
name: "ILlmApplication",
|
|
26
|
-
arguments: [
|
|
27
|
-
typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral(dec.application.model)),
|
|
28
|
-
],
|
|
26
|
+
arguments: [dec.node],
|
|
29
27
|
}));
|
|
30
|
-
if (
|
|
28
|
+
if (((_a = props.expression.arguments) === null || _a === void 0 ? void 0 : _a[0]) === undefined)
|
|
31
29
|
return literal;
|
|
32
30
|
return ExpressionFactory_1.ExpressionFactory.selfCall(typescript_1.default.factory.createBlock([
|
|
33
31
|
StatementFactory_1.StatementFactory.constant({
|
|
@@ -39,7 +37,6 @@ var LlmApplicationTransformer;
|
|
|
39
37
|
value: typescript_1.default.factory.createIdentifier("application"),
|
|
40
38
|
argument: props.expression.arguments[0],
|
|
41
39
|
equals: (_b = dec.config) === null || _b === void 0 ? void 0 : _b.equals,
|
|
42
|
-
model: dec.application.model,
|
|
43
40
|
})),
|
|
44
41
|
typescript_1.default.factory.createReturnStatement(typescript_1.default.factory.createIdentifier("application")),
|
|
45
42
|
], true));
|
|
@@ -57,16 +54,10 @@ var LlmApplicationTransformer;
|
|
|
57
54
|
if (typescript_1.default.isTypeNode(top) === false)
|
|
58
55
|
return null;
|
|
59
56
|
// GET TYPE
|
|
60
|
-
const
|
|
61
|
-
checker: props.context.checker,
|
|
62
|
-
method,
|
|
63
|
-
node: props.expression.typeArguments[1],
|
|
64
|
-
});
|
|
65
|
-
const config = LlmModelPredicator_1.LlmModelPredicator.getConfig({
|
|
57
|
+
const config = LlmMetadataFactory_1.LlmMetadataFactory.getConfig({
|
|
66
58
|
context: props.context,
|
|
67
59
|
method,
|
|
68
|
-
|
|
69
|
-
node: props.expression.typeArguments[2],
|
|
60
|
+
node: props.expression.typeArguments[1],
|
|
70
61
|
});
|
|
71
62
|
const type = props.context.checker.getTypeFromTypeNode(top);
|
|
72
63
|
// VALIDATE TYPE
|
|
@@ -80,9 +71,10 @@ var LlmApplicationTransformer;
|
|
|
80
71
|
constant: true,
|
|
81
72
|
functional: true,
|
|
82
73
|
validate: validate === true
|
|
83
|
-
? LlmApplicationProgrammer_1.LlmApplicationProgrammer.validate({
|
|
84
|
-
model,
|
|
74
|
+
? (metadata, explore) => LlmApplicationProgrammer_1.LlmApplicationProgrammer.validate({
|
|
85
75
|
config,
|
|
76
|
+
metadata,
|
|
77
|
+
explore,
|
|
86
78
|
})
|
|
87
79
|
: undefined,
|
|
88
80
|
},
|
|
@@ -102,7 +94,6 @@ var LlmApplicationTransformer;
|
|
|
102
94
|
// GENERATE LLM APPLICATION
|
|
103
95
|
return {
|
|
104
96
|
application: LlmApplicationProgrammer_1.LlmApplicationProgrammer.write({
|
|
105
|
-
model,
|
|
106
97
|
context: props.context,
|
|
107
98
|
modulo: props.modulo,
|
|
108
99
|
metadata: analyze(false),
|
|
@@ -117,9 +108,7 @@ var LlmApplicationTransformer;
|
|
|
117
108
|
LlmApplicationTransformer.finalize = (props) => {
|
|
118
109
|
const satisfiesTypeNode = typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createIdentifier("Partial"), [
|
|
119
110
|
typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createIdentifier("Pick"), [
|
|
120
|
-
typescript_1.default.factory.createImportTypeNode(typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral("@samchon/openapi")), undefined, typescript_1.default.factory.createQualifiedName(typescript_1.default.factory.createIdentifier("ILlmApplication"), typescript_1.default.factory.createIdentifier("
|
|
121
|
-
typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral(props.model)),
|
|
122
|
-
], false),
|
|
111
|
+
typescript_1.default.factory.createImportTypeNode(typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral("@samchon/openapi")), undefined, typescript_1.default.factory.createQualifiedName(typescript_1.default.factory.createIdentifier("ILlmApplication"), typescript_1.default.factory.createIdentifier("IConfig")), undefined, false),
|
|
123
112
|
typescript_1.default.factory.createUnionTypeNode([
|
|
124
113
|
typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral("separate")),
|
|
125
114
|
typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral("validate")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmApplicationTransformer.ts"],"names":[],"mappings":";;;;;;AACA,4DAA4B;AAE5B,4EAAyE;AACzE,sEAAmE;AACnE,8EAA2E;AAC3E,wEAAqE;AACrE,0EAAuE;AAIvE,gGAA6F;AAC7F,oFAAiF;AAMjF,6DAA0D;AAE1D,IAAiB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"LlmApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/llm/LlmApplicationTransformer.ts"],"names":[],"mappings":";;;;;;AACA,4DAA4B;AAE5B,4EAAyE;AACzE,sEAAmE;AACnE,8EAA2E;AAC3E,wEAAqE;AACrE,0EAAuE;AAIvE,gGAA6F;AAC7F,oFAAiF;AAMjF,6DAA0D;AAE1D,IAAiB,yBAAyB,CA4LzC;AA5LD,WAAiB,yBAAyB;IAC3B,mCAAS,GAAG,CAAC,KAAsB,EAAiB,EAAE;;QACjE,MAAM,GAAG,GAAG,0BAAA,SAAS,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QAC5C,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC,UAAU,CAAC;QAE1C,MAAM,OAAO,GAAkB,oBAAE,CAAC,OAAO,CAAC,kBAAkB,CAC1D,+BAAc,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,EACrC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC1B,IAAI,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