@xiuper/mpp-core 0.0.2
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/Kotlin-DateTime-library-kotlinx-datetime.js +7836 -0
- package/Kotlin-DateTime-library-kotlinx-datetime.js.map +1 -0
- package/Kotlin-Immutable-Collections-kotlinx-collections-immutable.js +1241 -0
- package/Kotlin-Immutable-Collections-kotlinx-collections-immutable.js.map +1 -0
- package/Xiuper-mpp-codegraph.js +1471 -0
- package/Xiuper-mpp-codegraph.js.map +1 -0
- package/annotations.js +15 -0
- package/annotations.js.map +1 -0
- package/autodev-mpp-core.d.ts +1312 -0
- package/autodev-mpp-core.js +86483 -0
- package/autodev-mpp-core.js.map +1 -0
- package/kaml.js +3387 -0
- package/kaml.js.map +1 -0
- package/koog-agents-agents-core.js +22927 -0
- package/koog-agents-agents-core.js.map +1 -0
- package/koog-agents-agents-ext.js +15 -0
- package/koog-agents-agents-ext.js.map +1 -0
- package/koog-agents-agents-features-agents-features-event-handler.js +15 -0
- package/koog-agents-agents-features-agents-features-event-handler.js.map +1 -0
- package/koog-agents-agents-features-agents-features-memory.js +15 -0
- package/koog-agents-agents-features-agents-features-memory.js.map +1 -0
- package/koog-agents-agents-features-agents-features-opentelemetry.js +15 -0
- package/koog-agents-agents-features-agents-features-opentelemetry.js.map +1 -0
- package/koog-agents-agents-features-agents-features-snapshot.js +15 -0
- package/koog-agents-agents-features-agents-features-snapshot.js.map +1 -0
- package/koog-agents-agents-features-agents-features-tokenizer.js +15 -0
- package/koog-agents-agents-features-agents-features-tokenizer.js.map +1 -0
- package/koog-agents-agents-features-agents-features-trace.js +15 -0
- package/koog-agents-agents-features-agents-features-trace.js.map +1 -0
- package/koog-agents-agents-mcp.js +15 -0
- package/koog-agents-agents-mcp.js.map +1 -0
- package/koog-agents-agents-tools.js +322 -0
- package/koog-agents-agents-tools.js.map +1 -0
- package/koog-agents-agents-utils.js +232 -0
- package/koog-agents-agents-utils.js.map +1 -0
- package/koog-embeddings-embeddings-base.js +15 -0
- package/koog-embeddings-embeddings-base.js.map +1 -0
- package/koog-embeddings-embeddings-llm.js +15 -0
- package/koog-embeddings-embeddings-llm.js.map +1 -0
- package/koog-http-client-http-client-core.js +57 -0
- package/koog-http-client-http-client-core.js.map +1 -0
- package/koog-http-client-http-client-ktor.js +703 -0
- package/koog-http-client-http-client-ktor.js.map +1 -0
- package/koog-koog-agents.js +15 -0
- package/koog-koog-agents.js.map +1 -0
- package/koog-prompt-prompt-cache-prompt-cache-files.js +15 -0
- package/koog-prompt-prompt-cache-prompt-cache-files.js.map +1 -0
- package/koog-prompt-prompt-cache-prompt-cache-model.js +15 -0
- package/koog-prompt-prompt-cache-prompt-cache-model.js.map +1 -0
- package/koog-prompt-prompt-cache-prompt-cache-redis.js +15 -0
- package/koog-prompt-prompt-cache-prompt-cache-redis.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-cached.js +15 -0
- package/koog-prompt-prompt-executor-prompt-executor-cached.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-anthropic-client.js +4991 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-anthropic-client.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-bedrock-client.js +15 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-bedrock-client.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-dashscope-client.js +15 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-dashscope-client.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-deepseek-client.js +1249 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-deepseek-client.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-google-client.js +4675 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-google-client.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-mistralai-client.js +15 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-mistralai-client.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-ollama-client.js +2343 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-ollama-client.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-openai-client-base.js +6613 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-openai-client-base.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-openai-client.js +19901 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-openai-client.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-openrouter-client.js +2313 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients-prompt-executor-openrouter-client.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients.js +222 -0
- package/koog-prompt-prompt-executor-prompt-executor-clients.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-llms-all.js +70 -0
- package/koog-prompt-prompt-executor-prompt-executor-llms-all.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-llms.js +134 -0
- package/koog-prompt-prompt-executor-prompt-executor-llms.js.map +1 -0
- package/koog-prompt-prompt-executor-prompt-executor-model.js +42 -0
- package/koog-prompt-prompt-executor-prompt-executor-model.js.map +1 -0
- package/koog-prompt-prompt-llm.js +1710 -0
- package/koog-prompt-prompt-llm.js.map +1 -0
- package/koog-prompt-prompt-markdown.js +122 -0
- package/koog-prompt-prompt-markdown.js.map +1 -0
- package/koog-prompt-prompt-model.js +5848 -0
- package/koog-prompt-prompt-model.js.map +1 -0
- package/koog-prompt-prompt-structure.js +1513 -0
- package/koog-prompt-prompt-structure.js.map +1 -0
- package/koog-prompt-prompt-tokenizer.js +15 -0
- package/koog-prompt-prompt-tokenizer.js.map +1 -0
- package/koog-prompt-prompt-xml.js +15 -0
- package/koog-prompt-prompt-xml.js.map +1 -0
- package/koog-rag-rag-base.js +15 -0
- package/koog-rag-rag-base.js.map +1 -0
- package/koog-rag-vector-storage.js +15 -0
- package/koog-rag-vector-storage.js.map +1 -0
- package/koog-utils.js +63 -0
- package/koog-utils.js.map +1 -0
- package/kotlin-kotlin-stdlib.js +18965 -0
- package/kotlin-kotlin-stdlib.js.map +1 -0
- package/kotlin-logging.js +509 -0
- package/kotlin-logging.js.map +1 -0
- package/kotlin-sdk-kotlin-sdk-client.js +1340 -0
- package/kotlin-sdk-kotlin-sdk-client.js.map +1 -0
- package/kotlin-sdk-kotlin-sdk-core.js +15195 -0
- package/kotlin-sdk-kotlin-sdk-core.js.map +1 -0
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js +15 -0
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js.map +1 -0
- package/kotlinx-atomicfu.js +259 -0
- package/kotlinx-atomicfu.js.map +1 -0
- package/kotlinx-coroutines-core.js +13742 -0
- package/kotlinx-coroutines-core.js.map +1 -0
- package/kotlinx-io-kotlinx-io-bytestring.js +214 -0
- package/kotlinx-io-kotlinx-io-bytestring.js.map +1 -0
- package/kotlinx-io-kotlinx-io-core.js +2892 -0
- package/kotlinx-io-kotlinx-io-core.js.map +1 -0
- package/kotlinx-serialization-kotlinx-serialization-core.js +6563 -0
- package/kotlinx-serialization-kotlinx-serialization-core.js.map +1 -0
- package/kotlinx-serialization-kotlinx-serialization-json-io.js +15 -0
- package/kotlinx-serialization-kotlinx-serialization-json-io.js.map +1 -0
- package/kotlinx-serialization-kotlinx-serialization-json.js +5927 -0
- package/kotlinx-serialization-kotlinx-serialization-json.js.map +1 -0
- package/ktor-ktor-client-content-negotiation.js +775 -0
- package/ktor-ktor-client-content-negotiation.js.map +1 -0
- package/ktor-ktor-client-core.js +11110 -0
- package/ktor-ktor-client-core.js.map +1 -0
- package/ktor-ktor-client-logging.js +15 -0
- package/ktor-ktor-client-logging.js.map +1 -0
- package/ktor-ktor-events.js +126 -0
- package/ktor-ktor-events.js.map +1 -0
- package/ktor-ktor-http-cio.js +4257 -0
- package/ktor-ktor-http-cio.js.map +1 -0
- package/ktor-ktor-http.js +3671 -0
- package/ktor-ktor-http.js.map +1 -0
- package/ktor-ktor-io.js +4114 -0
- package/ktor-ktor-io.js.map +1 -0
- package/ktor-ktor-network.js +1399 -0
- package/ktor-ktor-network.js.map +1 -0
- package/ktor-ktor-serialization-kotlinx-json.js +67 -0
- package/ktor-ktor-serialization-kotlinx-json.js.map +1 -0
- package/ktor-ktor-serialization-kotlinx.js +881 -0
- package/ktor-ktor-serialization-kotlinx.js.map +1 -0
- package/ktor-ktor-serialization.js +388 -0
- package/ktor-ktor-serialization.js.map +1 -0
- package/ktor-ktor-server-cio.js +3735 -0
- package/ktor-ktor-server-cio.js.map +1 -0
- package/ktor-ktor-server-core.js +8696 -0
- package/ktor-ktor-server-core.js.map +1 -0
- package/ktor-ktor-server-sse.js +668 -0
- package/ktor-ktor-server-sse.js.map +1 -0
- package/ktor-ktor-server-websockets.js +15 -0
- package/ktor-ktor-server-websockets.js.map +1 -0
- package/ktor-ktor-sse.js +161 -0
- package/ktor-ktor-sse.js.map +1 -0
- package/ktor-ktor-utils.js +3589 -0
- package/ktor-ktor-utils.js.map +1 -0
- package/ktor-ktor-websocket-serialization.js +15 -0
- package/ktor-ktor-websocket-serialization.js.map +1 -0
- package/ktor-ktor-websockets.js +450 -0
- package/ktor-ktor-websockets.js.map +1 -0
- package/markdown.js +5174 -0
- package/markdown.js.map +1 -0
- package/okio-parent-okio.js +2628 -0
- package/okio-parent-okio.js.map +1 -0
- package/package.json +18 -0
- package/snakeyaml-engine-kmp.js +7079 -0
- package/snakeyaml-engine-kmp.js.map +1 -0
- package/urlencoder-urlencoder-lib.js +322 -0
- package/urlencoder-urlencoder-lib.js.map +1 -0
- package/xiuper-mpp-core.d.ts +1312 -0
- package/xiuper-mpp-core.js +86483 -0
- package/xiuper-mpp-core.js.map +1 -0
|
@@ -0,0 +1,1513 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof define === 'function' && define.amd)
|
|
3
|
+
define(['exports', './kotlin-kotlin-stdlib.js', './koog-prompt-prompt-markdown.js', './koog-prompt-prompt-model.js', './kotlin-logging.js', './kotlinx-serialization-kotlinx-serialization-core.js', './kotlinx-serialization-kotlinx-serialization-json.js', './koog-agents-agents-tools.js'], factory);
|
|
4
|
+
else if (typeof exports === 'object')
|
|
5
|
+
factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./koog-prompt-prompt-markdown.js'), require('./koog-prompt-prompt-model.js'), require('./kotlin-logging.js'), require('./kotlinx-serialization-kotlinx-serialization-core.js'), require('./kotlinx-serialization-kotlinx-serialization-json.js'), require('./koog-agents-agents-tools.js'));
|
|
6
|
+
else {
|
|
7
|
+
if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
|
|
8
|
+
throw new Error("Error loading module 'koog-prompt-prompt-structure'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'koog-prompt-prompt-structure'.");
|
|
9
|
+
}
|
|
10
|
+
if (typeof globalThis['koog-prompt-prompt-markdown'] === 'undefined') {
|
|
11
|
+
throw new Error("Error loading module 'koog-prompt-prompt-structure'. Its dependency 'koog-prompt-prompt-markdown' was not found. Please, check whether 'koog-prompt-prompt-markdown' is loaded prior to 'koog-prompt-prompt-structure'.");
|
|
12
|
+
}
|
|
13
|
+
if (typeof globalThis['koog-prompt-prompt-model'] === 'undefined') {
|
|
14
|
+
throw new Error("Error loading module 'koog-prompt-prompt-structure'. Its dependency 'koog-prompt-prompt-model' was not found. Please, check whether 'koog-prompt-prompt-model' is loaded prior to 'koog-prompt-prompt-structure'.");
|
|
15
|
+
}
|
|
16
|
+
if (typeof globalThis['kotlin-logging'] === 'undefined') {
|
|
17
|
+
throw new Error("Error loading module 'koog-prompt-prompt-structure'. Its dependency 'kotlin-logging' was not found. Please, check whether 'kotlin-logging' is loaded prior to 'koog-prompt-prompt-structure'.");
|
|
18
|
+
}
|
|
19
|
+
if (typeof globalThis['kotlinx-serialization-kotlinx-serialization-core'] === 'undefined') {
|
|
20
|
+
throw new Error("Error loading module 'koog-prompt-prompt-structure'. Its dependency 'kotlinx-serialization-kotlinx-serialization-core' was not found. Please, check whether 'kotlinx-serialization-kotlinx-serialization-core' is loaded prior to 'koog-prompt-prompt-structure'.");
|
|
21
|
+
}
|
|
22
|
+
if (typeof globalThis['kotlinx-serialization-kotlinx-serialization-json'] === 'undefined') {
|
|
23
|
+
throw new Error("Error loading module 'koog-prompt-prompt-structure'. Its dependency 'kotlinx-serialization-kotlinx-serialization-json' was not found. Please, check whether 'kotlinx-serialization-kotlinx-serialization-json' is loaded prior to 'koog-prompt-prompt-structure'.");
|
|
24
|
+
}
|
|
25
|
+
if (typeof globalThis['koog-agents-agents-tools'] === 'undefined') {
|
|
26
|
+
throw new Error("Error loading module 'koog-prompt-prompt-structure'. Its dependency 'koog-agents-agents-tools' was not found. Please, check whether 'koog-agents-agents-tools' is loaded prior to 'koog-prompt-prompt-structure'.");
|
|
27
|
+
}
|
|
28
|
+
globalThis['koog-prompt-prompt-structure'] = factory(typeof globalThis['koog-prompt-prompt-structure'] === 'undefined' ? {} : globalThis['koog-prompt-prompt-structure'], globalThis['kotlin-kotlin-stdlib'], globalThis['koog-prompt-prompt-markdown'], globalThis['koog-prompt-prompt-model'], globalThis['kotlin-logging'], globalThis['kotlinx-serialization-kotlinx-serialization-core'], globalThis['kotlinx-serialization-kotlinx-serialization-json'], globalThis['koog-agents-agents-tools']);
|
|
29
|
+
}
|
|
30
|
+
}(function (_, kotlin_kotlin, kotlin_ai_koog_prompt_markdown, kotlin_ai_koog_prompt_model, kotlin_io_github_oshai_kotlin_logging, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json, kotlin_ai_koog_agents_tools) {
|
|
31
|
+
'use strict';
|
|
32
|
+
//region block: imports
|
|
33
|
+
var imul = Math.imul;
|
|
34
|
+
var Exception = kotlin_kotlin.$_$.ok;
|
|
35
|
+
var Exception_init_$Init$ = kotlin_kotlin.$_$.a2;
|
|
36
|
+
var captureStack = kotlin_kotlin.$_$.dd;
|
|
37
|
+
var protoOf = kotlin_kotlin.$_$.we;
|
|
38
|
+
var initMetadataForClass = kotlin_kotlin.$_$.ud;
|
|
39
|
+
var VOID = kotlin_kotlin.$_$.h;
|
|
40
|
+
var toString = kotlin_kotlin.$_$.gm;
|
|
41
|
+
var hashCode = kotlin_kotlin.$_$.td;
|
|
42
|
+
var THROW_CCE = kotlin_kotlin.$_$.zk;
|
|
43
|
+
var equals = kotlin_kotlin.$_$.md;
|
|
44
|
+
var toString_0 = kotlin_kotlin.$_$.af;
|
|
45
|
+
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.e2;
|
|
46
|
+
var MarkdownContentBuilder = kotlin_ai_koog_prompt_markdown.$_$.a;
|
|
47
|
+
var Unit_instance = kotlin_kotlin.$_$.h6;
|
|
48
|
+
var emptyMap = kotlin_kotlin.$_$.n8;
|
|
49
|
+
var noWhenBranchMatchedException = kotlin_kotlin.$_$.zl;
|
|
50
|
+
var prompt = kotlin_ai_koog_prompt_model.$_$.a;
|
|
51
|
+
var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.dc;
|
|
52
|
+
var Result = kotlin_kotlin.$_$.xk;
|
|
53
|
+
var CoroutineImpl = kotlin_kotlin.$_$.tc;
|
|
54
|
+
var single = kotlin_kotlin.$_$.ra;
|
|
55
|
+
var Companion_instance = kotlin_kotlin.$_$.c6;
|
|
56
|
+
var Assistant = kotlin_ai_koog_prompt_model.$_$.l;
|
|
57
|
+
var getKClassFromExpression = kotlin_kotlin.$_$.e;
|
|
58
|
+
var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.s3;
|
|
59
|
+
var createFailure = kotlin_kotlin.$_$.rl;
|
|
60
|
+
var initMetadataForCoroutine = kotlin_kotlin.$_$.wd;
|
|
61
|
+
var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.c1;
|
|
62
|
+
var KotlinLogging_instance = kotlin_io_github_oshai_kotlin_logging.$_$.b;
|
|
63
|
+
var initMetadataForCompanion = kotlin_kotlin.$_$.vd;
|
|
64
|
+
var until = kotlin_kotlin.$_$.of;
|
|
65
|
+
var SerializationException = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.a4;
|
|
66
|
+
var LLMParams = kotlin_ai_koog_prompt_model.$_$.w;
|
|
67
|
+
var prompt_0 = kotlin_ai_koog_prompt_model.$_$.b;
|
|
68
|
+
var initMetadataForObject = kotlin_kotlin.$_$.ae;
|
|
69
|
+
var ClassDiscriminatorMode_POLYMORPHIC_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.c;
|
|
70
|
+
var Json = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.x;
|
|
71
|
+
var JsonObject = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.r;
|
|
72
|
+
var getKClass = kotlin_kotlin.$_$.f;
|
|
73
|
+
var arrayOf = kotlin_kotlin.$_$.nl;
|
|
74
|
+
var createKType = kotlin_kotlin.$_$.c;
|
|
75
|
+
var serializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.j4;
|
|
76
|
+
var KSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.x3;
|
|
77
|
+
var isInterface = kotlin_kotlin.$_$.je;
|
|
78
|
+
var text = kotlin_ai_koog_prompt_model.$_$.f1;
|
|
79
|
+
var CLASS_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.u;
|
|
80
|
+
var OBJECT_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.x;
|
|
81
|
+
var MAP_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.w;
|
|
82
|
+
var listOf = kotlin_kotlin.$_$.u9;
|
|
83
|
+
var contains = kotlin_kotlin.$_$.q7;
|
|
84
|
+
var emptyList = kotlin_kotlin.$_$.m8;
|
|
85
|
+
var Basic = kotlin_ai_koog_prompt_model.$_$.s;
|
|
86
|
+
var toMutableMap = kotlin_kotlin.$_$.nb;
|
|
87
|
+
var JsonPrimitive = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.u;
|
|
88
|
+
var PolymorphicKind = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.q1;
|
|
89
|
+
var LIST_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.v;
|
|
90
|
+
var ENUM_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.t;
|
|
91
|
+
var FLOAT_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.n;
|
|
92
|
+
var DOUBLE_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.m;
|
|
93
|
+
var BYTE_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.l;
|
|
94
|
+
var SHORT_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.q;
|
|
95
|
+
var INT_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.o;
|
|
96
|
+
var LONG_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.p;
|
|
97
|
+
var BOOLEAN_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.k;
|
|
98
|
+
var STRING_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.r;
|
|
99
|
+
var put = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.i1;
|
|
100
|
+
var JsonObjectBuilder = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.q;
|
|
101
|
+
var get_elementNames = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.p2;
|
|
102
|
+
var collectionSizeOrDefault = kotlin_kotlin.$_$.p7;
|
|
103
|
+
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.s;
|
|
104
|
+
var JsonPrimitive_0 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.s;
|
|
105
|
+
var JsonArray = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.k;
|
|
106
|
+
var trimIndent = kotlin_kotlin.$_$.uj;
|
|
107
|
+
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.j2;
|
|
108
|
+
var KtMap = kotlin_kotlin.$_$.v6;
|
|
109
|
+
var plus = kotlin_kotlin.$_$.ia;
|
|
110
|
+
var JsonArrayBuilder = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.j;
|
|
111
|
+
var add = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.y;
|
|
112
|
+
var put_0 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.j1;
|
|
113
|
+
var getValue = kotlin_kotlin.$_$.b9;
|
|
114
|
+
var UnsupportedOperationException_init_$Create$ = kotlin_kotlin.$_$.b3;
|
|
115
|
+
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.t;
|
|
116
|
+
var LLMDescription = kotlin_ai_koog_agents_tools.$_$.a;
|
|
117
|
+
var firstOrNull = kotlin_kotlin.$_$.s8;
|
|
118
|
+
var getStringHashCode = kotlin_kotlin.$_$.sd;
|
|
119
|
+
var getPolymorphicDescriptors = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.r2;
|
|
120
|
+
var OPEN = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.o1;
|
|
121
|
+
var toList = kotlin_kotlin.$_$.gb;
|
|
122
|
+
var getOrNull = kotlin_kotlin.$_$.z8;
|
|
123
|
+
var get_elementDescriptors = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.o2;
|
|
124
|
+
var SEALED = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.p1;
|
|
125
|
+
var sortedWith = kotlin_kotlin.$_$.ua;
|
|
126
|
+
var FunctionAdapter = kotlin_kotlin.$_$.zc;
|
|
127
|
+
var Comparator = kotlin_kotlin.$_$.jk;
|
|
128
|
+
var compareValues = kotlin_kotlin.$_$.wb;
|
|
129
|
+
var eachCount = kotlin_kotlin.$_$.l8;
|
|
130
|
+
var mapCapacity = kotlin_kotlin.$_$.v9;
|
|
131
|
+
var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.b1;
|
|
132
|
+
var Standard = kotlin_ai_koog_prompt_model.$_$.t;
|
|
133
|
+
var get_jsonObject = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.b1;
|
|
134
|
+
var get_jsonArray = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.a1;
|
|
135
|
+
var distinct = kotlin_kotlin.$_$.i8;
|
|
136
|
+
var ClassDiscriminatorMode_ALL_JSON_OBJECTS_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.a;
|
|
137
|
+
//endregion
|
|
138
|
+
//region block: pre-declaration
|
|
139
|
+
initMetadataForClass(LLMStructuredParsingError, 'LLMStructuredParsingError', VOID, Exception);
|
|
140
|
+
initMetadataForClass(StructuredResponse, 'StructuredResponse');
|
|
141
|
+
initMetadataForClass(StructuredOutputConfig, 'StructuredOutputConfig', StructuredOutputConfig);
|
|
142
|
+
initMetadataForClass(Manual, 'Manual');
|
|
143
|
+
initMetadataForClass(Native, 'Native');
|
|
144
|
+
initMetadataForCoroutine($executeStructuredCOROUTINE$, CoroutineImpl);
|
|
145
|
+
initMetadataForCoroutine($parseResponseToStructuredResponseCOROUTINE$, CoroutineImpl);
|
|
146
|
+
initMetadataForCompanion(Companion);
|
|
147
|
+
initMetadataForCoroutine($parseCOROUTINE$, CoroutineImpl);
|
|
148
|
+
initMetadataForCoroutine($executeFixStructureCOROUTINE$, CoroutineImpl);
|
|
149
|
+
initMetadataForClass(StructuredData, 'StructuredData');
|
|
150
|
+
initMetadataForObject(StructuredOutputPrompts, 'StructuredOutputPrompts');
|
|
151
|
+
initMetadataForCompanion(Companion_0);
|
|
152
|
+
initMetadataForClass(JsonStructuredData, 'JsonStructuredData', VOID, StructuredData);
|
|
153
|
+
initMetadataForClass(JsonSchemaGenerator, 'JsonSchemaGenerator');
|
|
154
|
+
initMetadataForClass(GenericJsonSchemaGenerator, 'GenericJsonSchemaGenerator', VOID, JsonSchemaGenerator);
|
|
155
|
+
initMetadataForClass(BasicJsonSchemaGenerator, 'BasicJsonSchemaGenerator', BasicJsonSchemaGenerator, GenericJsonSchemaGenerator);
|
|
156
|
+
initMetadataForObject(Default, 'Default', VOID, BasicJsonSchemaGenerator);
|
|
157
|
+
initMetadataForClass(GenerationContext, 'GenerationContext');
|
|
158
|
+
initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
|
|
159
|
+
initMetadataForClass(StandardJsonSchemaGenerator, 'StandardJsonSchemaGenerator', StandardJsonSchemaGenerator, GenericJsonSchemaGenerator);
|
|
160
|
+
initMetadataForObject(Default_0, 'Default', VOID, StandardJsonSchemaGenerator);
|
|
161
|
+
initMetadataForClass(StandardJsonSchemaGenerator$generate$$inlined$groupingBy$1);
|
|
162
|
+
//endregion
|
|
163
|
+
function LLMStructuredParsingError(message, cause) {
|
|
164
|
+
Exception_init_$Init$(message, cause, this);
|
|
165
|
+
captureStack(this, LLMStructuredParsingError);
|
|
166
|
+
}
|
|
167
|
+
function get_RegisteredBasicJsonSchemaGenerators() {
|
|
168
|
+
_init_properties_PromptExecutorExtensions_kt__eniagb();
|
|
169
|
+
return RegisteredBasicJsonSchemaGenerators;
|
|
170
|
+
}
|
|
171
|
+
var RegisteredBasicJsonSchemaGenerators;
|
|
172
|
+
function get_RegisteredStandardJsonSchemaGenerators() {
|
|
173
|
+
_init_properties_PromptExecutorExtensions_kt__eniagb();
|
|
174
|
+
return RegisteredStandardJsonSchemaGenerators;
|
|
175
|
+
}
|
|
176
|
+
var RegisteredStandardJsonSchemaGenerators;
|
|
177
|
+
function StructuredResponse(structure, message) {
|
|
178
|
+
this.c85_1 = structure;
|
|
179
|
+
this.d85_1 = message;
|
|
180
|
+
}
|
|
181
|
+
protoOf(StructuredResponse).toString = function () {
|
|
182
|
+
return 'StructuredResponse(structure=' + toString(this.c85_1) + ', message=' + this.d85_1.toString() + ')';
|
|
183
|
+
};
|
|
184
|
+
protoOf(StructuredResponse).hashCode = function () {
|
|
185
|
+
var result = this.c85_1 == null ? 0 : hashCode(this.c85_1);
|
|
186
|
+
result = imul(result, 31) + this.d85_1.hashCode() | 0;
|
|
187
|
+
return result;
|
|
188
|
+
};
|
|
189
|
+
protoOf(StructuredResponse).equals = function (other) {
|
|
190
|
+
if (this === other)
|
|
191
|
+
return true;
|
|
192
|
+
if (!(other instanceof StructuredResponse))
|
|
193
|
+
return false;
|
|
194
|
+
var tmp0_other_with_cast = other instanceof StructuredResponse ? other : THROW_CCE();
|
|
195
|
+
if (!equals(this.c85_1, tmp0_other_with_cast.c85_1))
|
|
196
|
+
return false;
|
|
197
|
+
if (!this.d85_1.equals(tmp0_other_with_cast.d85_1))
|
|
198
|
+
return false;
|
|
199
|
+
return true;
|
|
200
|
+
};
|
|
201
|
+
function structuredOutput($this, model) {
|
|
202
|
+
var tmp0_elvis_lhs = $this.f85_1.j2(model.b3i_1);
|
|
203
|
+
var tmp1_elvis_lhs = tmp0_elvis_lhs == null ? $this.e85_1 : tmp0_elvis_lhs;
|
|
204
|
+
var tmp;
|
|
205
|
+
if (tmp1_elvis_lhs == null) {
|
|
206
|
+
throw IllegalArgumentException_init_$Create$('No structure found for provider ' + toString_0(model.b3i_1));
|
|
207
|
+
} else {
|
|
208
|
+
tmp = tmp1_elvis_lhs;
|
|
209
|
+
}
|
|
210
|
+
return tmp;
|
|
211
|
+
}
|
|
212
|
+
function StructuredOutputConfig$updatePrompt$lambda$lambda($mode) {
|
|
213
|
+
return function ($this$user) {
|
|
214
|
+
// Inline function 'ai.koog.prompt.markdown.markdown' call
|
|
215
|
+
// Inline function 'kotlin.apply' call
|
|
216
|
+
var this_0 = new MarkdownContentBuilder();
|
|
217
|
+
StructuredOutputPrompts_instance.i85(this_0, $mode.h85_1);
|
|
218
|
+
$this$user.b43(this_0.o3o());
|
|
219
|
+
return Unit_instance;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function StructuredOutputConfig$updatePrompt$lambda($mode) {
|
|
223
|
+
return function ($this$prompt) {
|
|
224
|
+
$this$prompt.z45(StructuredOutputConfig$updatePrompt$lambda$lambda($mode));
|
|
225
|
+
return Unit_instance;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function StructuredOutputConfig$updatePrompt$lambda_0($mode) {
|
|
229
|
+
return function ($this$withUpdatedParams) {
|
|
230
|
+
$this$withUpdatedParams.r44_1 = $mode.m85_1.k85_1;
|
|
231
|
+
return Unit_instance;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function StructuredOutputConfig(default_0, byProvider, fixingParser) {
|
|
235
|
+
default_0 = default_0 === VOID ? null : default_0;
|
|
236
|
+
byProvider = byProvider === VOID ? emptyMap() : byProvider;
|
|
237
|
+
fixingParser = fixingParser === VOID ? null : fixingParser;
|
|
238
|
+
this.e85_1 = default_0;
|
|
239
|
+
this.f85_1 = byProvider;
|
|
240
|
+
this.g85_1 = fixingParser;
|
|
241
|
+
}
|
|
242
|
+
protoOf(StructuredOutputConfig).n85 = function (model, prompt_0) {
|
|
243
|
+
var mode = structuredOutput(this, model);
|
|
244
|
+
var tmp;
|
|
245
|
+
if (mode instanceof Manual) {
|
|
246
|
+
tmp = prompt(prompt_0, VOID, StructuredOutputConfig$updatePrompt$lambda(mode));
|
|
247
|
+
} else {
|
|
248
|
+
if (mode instanceof Native) {
|
|
249
|
+
tmp = prompt_0.e45(StructuredOutputConfig$updatePrompt$lambda_0(mode));
|
|
250
|
+
} else {
|
|
251
|
+
noWhenBranchMatchedException();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return tmp;
|
|
255
|
+
};
|
|
256
|
+
protoOf(StructuredOutputConfig).o85 = function (model) {
|
|
257
|
+
return structuredOutput(this, model).p85();
|
|
258
|
+
};
|
|
259
|
+
protoOf(StructuredOutputConfig).toString = function () {
|
|
260
|
+
return 'StructuredOutputConfig(default=' + toString(this.e85_1) + ', byProvider=' + toString_0(this.f85_1) + ', fixingParser=' + toString(this.g85_1) + ')';
|
|
261
|
+
};
|
|
262
|
+
protoOf(StructuredOutputConfig).hashCode = function () {
|
|
263
|
+
var result = this.e85_1 == null ? 0 : hashCode(this.e85_1);
|
|
264
|
+
result = imul(result, 31) + hashCode(this.f85_1) | 0;
|
|
265
|
+
result = imul(result, 31) + (this.g85_1 == null ? 0 : hashCode(this.g85_1)) | 0;
|
|
266
|
+
return result;
|
|
267
|
+
};
|
|
268
|
+
protoOf(StructuredOutputConfig).equals = function (other) {
|
|
269
|
+
if (this === other)
|
|
270
|
+
return true;
|
|
271
|
+
if (!(other instanceof StructuredOutputConfig))
|
|
272
|
+
return false;
|
|
273
|
+
var tmp0_other_with_cast = other instanceof StructuredOutputConfig ? other : THROW_CCE();
|
|
274
|
+
if (!equals(this.e85_1, tmp0_other_with_cast.e85_1))
|
|
275
|
+
return false;
|
|
276
|
+
if (!equals(this.f85_1, tmp0_other_with_cast.f85_1))
|
|
277
|
+
return false;
|
|
278
|
+
if (!equals(this.g85_1, tmp0_other_with_cast.g85_1))
|
|
279
|
+
return false;
|
|
280
|
+
return true;
|
|
281
|
+
};
|
|
282
|
+
function executeStructured(_this__u8e3s4, prompt, model, config, $completion) {
|
|
283
|
+
var tmp = new $executeStructuredCOROUTINE$(_this__u8e3s4, prompt, model, config, $completion);
|
|
284
|
+
tmp.z9_1 = Unit_instance;
|
|
285
|
+
tmp.aa_1 = null;
|
|
286
|
+
var tmp_0 = tmp.fa();
|
|
287
|
+
if (tmp_0 === get_COROUTINE_SUSPENDED())
|
|
288
|
+
return tmp_0;
|
|
289
|
+
return tmp_0;
|
|
290
|
+
}
|
|
291
|
+
function parseResponseToStructuredResponse(_this__u8e3s4, response, config, model, $completion) {
|
|
292
|
+
var tmp = new $parseResponseToStructuredResponseCOROUTINE$(_this__u8e3s4, response, config, model, $completion);
|
|
293
|
+
tmp.z9_1 = Unit_instance;
|
|
294
|
+
tmp.aa_1 = null;
|
|
295
|
+
return tmp.fa();
|
|
296
|
+
}
|
|
297
|
+
function Manual(structure) {
|
|
298
|
+
this.h85_1 = structure;
|
|
299
|
+
}
|
|
300
|
+
protoOf(Manual).p85 = function () {
|
|
301
|
+
return this.h85_1;
|
|
302
|
+
};
|
|
303
|
+
protoOf(Manual).toString = function () {
|
|
304
|
+
return 'Manual(structure=' + toString_0(this.h85_1) + ')';
|
|
305
|
+
};
|
|
306
|
+
protoOf(Manual).hashCode = function () {
|
|
307
|
+
return hashCode(this.h85_1);
|
|
308
|
+
};
|
|
309
|
+
protoOf(Manual).equals = function (other) {
|
|
310
|
+
if (this === other)
|
|
311
|
+
return true;
|
|
312
|
+
if (!(other instanceof Manual))
|
|
313
|
+
return false;
|
|
314
|
+
var tmp0_other_with_cast = other instanceof Manual ? other : THROW_CCE();
|
|
315
|
+
if (!equals(this.h85_1, tmp0_other_with_cast.h85_1))
|
|
316
|
+
return false;
|
|
317
|
+
return true;
|
|
318
|
+
};
|
|
319
|
+
function Native() {
|
|
320
|
+
}
|
|
321
|
+
function $executeStructuredCOROUTINE$(_this__u8e3s4, prompt, model, config, resultContinuation) {
|
|
322
|
+
CoroutineImpl.call(this, resultContinuation);
|
|
323
|
+
this.y85_1 = _this__u8e3s4;
|
|
324
|
+
this.z85_1 = prompt;
|
|
325
|
+
this.a86_1 = model;
|
|
326
|
+
this.b86_1 = config;
|
|
327
|
+
}
|
|
328
|
+
protoOf($executeStructuredCOROUTINE$).fa = function () {
|
|
329
|
+
var suspendResult = this.z9_1;
|
|
330
|
+
$sm: do
|
|
331
|
+
try {
|
|
332
|
+
var tmp = this.x9_1;
|
|
333
|
+
switch (tmp) {
|
|
334
|
+
case 0:
|
|
335
|
+
this.y9_1 = 5;
|
|
336
|
+
this.c86_1 = this.b86_1.n85(this.a86_1, this.z85_1);
|
|
337
|
+
this.x9_1 = 1;
|
|
338
|
+
suspendResult = this.y85_1.k4f(this.c86_1, this.a86_1, VOID, this);
|
|
339
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
340
|
+
return suspendResult;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
continue $sm;
|
|
344
|
+
case 1:
|
|
345
|
+
this.d86_1 = suspendResult;
|
|
346
|
+
this.e86_1 = single(this.d86_1);
|
|
347
|
+
var tmp_0 = this;
|
|
348
|
+
tmp_0.f86_1 = this.y85_1;
|
|
349
|
+
this.g86_1 = this.f86_1;
|
|
350
|
+
this.y9_1 = 3;
|
|
351
|
+
var tmp_1 = this;
|
|
352
|
+
tmp_1.i86_1 = Companion_instance;
|
|
353
|
+
var tmp_2 = this;
|
|
354
|
+
tmp_2.j86_1 = this.g86_1;
|
|
355
|
+
this.k86_1 = this.j86_1;
|
|
356
|
+
var tmp_3 = this.e86_1;
|
|
357
|
+
if (!(tmp_3 instanceof Assistant)) {
|
|
358
|
+
var message = 'Response for structured output must be an assistant message, got ' + getKClassFromExpression(this.e86_1).zb() + ' instead';
|
|
359
|
+
throw IllegalArgumentException_init_$Create$(toString_0(message));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
this.x9_1 = 2;
|
|
363
|
+
suspendResult = parseResponseToStructuredResponse(this.k86_1, this.e86_1, this.b86_1, this.a86_1, this);
|
|
364
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
365
|
+
return suspendResult;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
continue $sm;
|
|
369
|
+
case 2:
|
|
370
|
+
var tmp2 = suspendResult;
|
|
371
|
+
var tmp_4 = this;
|
|
372
|
+
this.i86_1;
|
|
373
|
+
tmp_4.h86_1 = _Result___init__impl__xyqfz8(tmp2);
|
|
374
|
+
this.y9_1 = 5;
|
|
375
|
+
this.x9_1 = 4;
|
|
376
|
+
continue $sm;
|
|
377
|
+
case 3:
|
|
378
|
+
this.y9_1 = 5;
|
|
379
|
+
var tmp_5 = this.aa_1;
|
|
380
|
+
if (tmp_5 instanceof Error) {
|
|
381
|
+
var e = this.aa_1;
|
|
382
|
+
var tmp_6 = this;
|
|
383
|
+
tmp_6.h86_1 = _Result___init__impl__xyqfz8(createFailure(e));
|
|
384
|
+
this.x9_1 = 4;
|
|
385
|
+
continue $sm;
|
|
386
|
+
} else {
|
|
387
|
+
throw this.aa_1;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
case 4:
|
|
391
|
+
this.y9_1 = 5;
|
|
392
|
+
return new Result(this.h86_1);
|
|
393
|
+
case 5:
|
|
394
|
+
throw this.aa_1;
|
|
395
|
+
}
|
|
396
|
+
} catch ($p) {
|
|
397
|
+
var e_0 = $p;
|
|
398
|
+
if (this.y9_1 === 5) {
|
|
399
|
+
throw e_0;
|
|
400
|
+
} else {
|
|
401
|
+
this.x9_1 = this.y9_1;
|
|
402
|
+
this.aa_1 = e_0;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
while (true);
|
|
406
|
+
};
|
|
407
|
+
function $parseResponseToStructuredResponseCOROUTINE$(_this__u8e3s4, response, config, model, resultContinuation) {
|
|
408
|
+
CoroutineImpl.call(this, resultContinuation);
|
|
409
|
+
this.t86_1 = _this__u8e3s4;
|
|
410
|
+
this.u86_1 = response;
|
|
411
|
+
this.v86_1 = config;
|
|
412
|
+
this.w86_1 = model;
|
|
413
|
+
}
|
|
414
|
+
protoOf($parseResponseToStructuredResponseCOROUTINE$).fa = function () {
|
|
415
|
+
var suspendResult = this.z9_1;
|
|
416
|
+
$sm: do
|
|
417
|
+
try {
|
|
418
|
+
var tmp = this.x9_1;
|
|
419
|
+
switch (tmp) {
|
|
420
|
+
case 0:
|
|
421
|
+
this.y9_1 = 3;
|
|
422
|
+
this.x86_1 = this.v86_1.o85(this.w86_1);
|
|
423
|
+
this.y86_1 = this.v86_1.g85_1;
|
|
424
|
+
if (this.y86_1 == null) {
|
|
425
|
+
this.z86_1 = null;
|
|
426
|
+
this.x9_1 = 2;
|
|
427
|
+
continue $sm;
|
|
428
|
+
} else {
|
|
429
|
+
this.x9_1 = 1;
|
|
430
|
+
suspendResult = this.y86_1.d87(this.t86_1, this.x86_1, this.u86_1.v1j(), this);
|
|
431
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
432
|
+
return suspendResult;
|
|
433
|
+
}
|
|
434
|
+
continue $sm;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
case 1:
|
|
438
|
+
this.z86_1 = suspendResult;
|
|
439
|
+
this.x9_1 = 2;
|
|
440
|
+
continue $sm;
|
|
441
|
+
case 2:
|
|
442
|
+
var tmp1_elvis_lhs = this.z86_1;
|
|
443
|
+
var structureResponse = tmp1_elvis_lhs == null ? this.x86_1.dt(this.u86_1.v1j()) : tmp1_elvis_lhs;
|
|
444
|
+
return new StructuredResponse(structureResponse, this.u86_1);
|
|
445
|
+
case 3:
|
|
446
|
+
throw this.aa_1;
|
|
447
|
+
}
|
|
448
|
+
} catch ($p) {
|
|
449
|
+
var e = $p;
|
|
450
|
+
if (this.y9_1 === 3) {
|
|
451
|
+
throw e;
|
|
452
|
+
} else {
|
|
453
|
+
this.x9_1 = this.y9_1;
|
|
454
|
+
this.aa_1 = e;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
while (true);
|
|
458
|
+
};
|
|
459
|
+
var properties_initialized_PromptExecutorExtensions_kt_dk6r6b;
|
|
460
|
+
function _init_properties_PromptExecutorExtensions_kt__eniagb() {
|
|
461
|
+
if (!properties_initialized_PromptExecutorExtensions_kt_dk6r6b) {
|
|
462
|
+
properties_initialized_PromptExecutorExtensions_kt_dk6r6b = true;
|
|
463
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
464
|
+
RegisteredBasicJsonSchemaGenerators = LinkedHashMap_init_$Create$();
|
|
465
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
466
|
+
RegisteredStandardJsonSchemaGenerators = LinkedHashMap_init_$Create$();
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
function StructureFixingParser$Companion$logger$lambda() {
|
|
470
|
+
return Unit_instance;
|
|
471
|
+
}
|
|
472
|
+
function executeFixStructure($this, executor, content, structure, exception, $completion) {
|
|
473
|
+
var tmp = new $executeFixStructureCOROUTINE$($this, executor, content, structure, exception, $completion);
|
|
474
|
+
tmp.z9_1 = Unit_instance;
|
|
475
|
+
tmp.aa_1 = null;
|
|
476
|
+
return tmp.fa();
|
|
477
|
+
}
|
|
478
|
+
function Companion() {
|
|
479
|
+
Companion_instance_0 = this;
|
|
480
|
+
var tmp = this;
|
|
481
|
+
var tmp_0 = KotlinLogging_instance;
|
|
482
|
+
tmp.s87_1 = tmp_0.a3j(StructureFixingParser$Companion$logger$lambda);
|
|
483
|
+
}
|
|
484
|
+
var Companion_instance_0;
|
|
485
|
+
function Companion_getInstance() {
|
|
486
|
+
if (Companion_instance_0 == null)
|
|
487
|
+
new Companion();
|
|
488
|
+
return Companion_instance_0;
|
|
489
|
+
}
|
|
490
|
+
function StructureFixingParser$parse$lambda($attempt, this$0, $content) {
|
|
491
|
+
return function () {
|
|
492
|
+
return '' + $attempt + '/' + this$0.b87_1 + ': Try to parse LLM response content: <' + $content + '>';
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
function StructureFixingParser$parse$lambda_0($content) {
|
|
496
|
+
return function () {
|
|
497
|
+
return 'Failed to parse structure from content: <' + $content + '>';
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
function StructureFixingParser$executeFixStructure$lambda(this$0, $content, $structure, $exception) {
|
|
501
|
+
return function ($this$prompt) {
|
|
502
|
+
this$0.c87_1($this$prompt, $content, $structure, $exception);
|
|
503
|
+
return Unit_instance;
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
function $parseCOROUTINE$(_this__u8e3s4, executor, structure, content, resultContinuation) {
|
|
507
|
+
CoroutineImpl.call(this, resultContinuation);
|
|
508
|
+
this.b88_1 = _this__u8e3s4;
|
|
509
|
+
this.c88_1 = executor;
|
|
510
|
+
this.d88_1 = structure;
|
|
511
|
+
this.e88_1 = content;
|
|
512
|
+
}
|
|
513
|
+
protoOf($parseCOROUTINE$).fa = function () {
|
|
514
|
+
var suspendResult = this.z9_1;
|
|
515
|
+
$sm: do
|
|
516
|
+
try {
|
|
517
|
+
var tmp = this.x9_1;
|
|
518
|
+
switch (tmp) {
|
|
519
|
+
case 0:
|
|
520
|
+
this.y9_1 = 6;
|
|
521
|
+
this.f88_1 = this.e88_1;
|
|
522
|
+
this.g88_1 = null;
|
|
523
|
+
var tmp_0 = this;
|
|
524
|
+
tmp_0.h88_1 = this.b88_1.b87_1;
|
|
525
|
+
this.i88_1 = this.h88_1;
|
|
526
|
+
this.j88_1 = until(0, this.i88_1).p();
|
|
527
|
+
this.x9_1 = 1;
|
|
528
|
+
continue $sm;
|
|
529
|
+
case 1:
|
|
530
|
+
if (!this.j88_1.q()) {
|
|
531
|
+
this.x9_1 = 5;
|
|
532
|
+
continue $sm;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
this.k88_1 = this.j88_1.r();
|
|
536
|
+
var tmp_1 = this;
|
|
537
|
+
tmp_1.l88_1 = this.k88_1;
|
|
538
|
+
this.m88_1 = this.l88_1;
|
|
539
|
+
this.y9_1 = 2;
|
|
540
|
+
var tmp_2 = Companion_getInstance().s87_1;
|
|
541
|
+
tmp_2.o3i(StructureFixingParser$parse$lambda(this.m88_1, this.b88_1, this.e88_1));
|
|
542
|
+
return this.d88_1.dt(this.f88_1);
|
|
543
|
+
case 2:
|
|
544
|
+
this.y9_1 = 6;
|
|
545
|
+
var tmp_3 = this.aa_1;
|
|
546
|
+
if (tmp_3 instanceof SerializationException) {
|
|
547
|
+
this.n88_1 = this.aa_1;
|
|
548
|
+
var tmp_4 = Companion_getInstance().s87_1;
|
|
549
|
+
tmp_4.t3i(this.n88_1, StructureFixingParser$parse$lambda_0(this.e88_1));
|
|
550
|
+
this.g88_1 = this.n88_1;
|
|
551
|
+
this.x9_1 = 3;
|
|
552
|
+
suspendResult = executeFixStructure(this.b88_1, this.c88_1, this.e88_1, this.d88_1, this.n88_1, this);
|
|
553
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
554
|
+
return suspendResult;
|
|
555
|
+
}
|
|
556
|
+
continue $sm;
|
|
557
|
+
} else {
|
|
558
|
+
throw this.aa_1;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
case 3:
|
|
562
|
+
this.f88_1 = suspendResult;
|
|
563
|
+
this.x9_1 = 4;
|
|
564
|
+
continue $sm;
|
|
565
|
+
case 4:
|
|
566
|
+
this.y9_1 = 6;
|
|
567
|
+
this.x9_1 = 1;
|
|
568
|
+
continue $sm;
|
|
569
|
+
case 5:
|
|
570
|
+
throw new LLMStructuredParsingError('Unable to parse structure after ' + this.b88_1.b87_1 + ' retries', this.g88_1);
|
|
571
|
+
case 6:
|
|
572
|
+
throw this.aa_1;
|
|
573
|
+
}
|
|
574
|
+
} catch ($p) {
|
|
575
|
+
var e = $p;
|
|
576
|
+
if (this.y9_1 === 6) {
|
|
577
|
+
throw e;
|
|
578
|
+
} else {
|
|
579
|
+
this.x9_1 = this.y9_1;
|
|
580
|
+
this.aa_1 = e;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
while (true);
|
|
584
|
+
};
|
|
585
|
+
function $executeFixStructureCOROUTINE$(_this__u8e3s4, executor, content, structure, exception, resultContinuation) {
|
|
586
|
+
CoroutineImpl.call(this, resultContinuation);
|
|
587
|
+
this.m87_1 = _this__u8e3s4;
|
|
588
|
+
this.n87_1 = executor;
|
|
589
|
+
this.o87_1 = content;
|
|
590
|
+
this.p87_1 = structure;
|
|
591
|
+
this.q87_1 = exception;
|
|
592
|
+
}
|
|
593
|
+
protoOf($executeFixStructureCOROUTINE$).fa = function () {
|
|
594
|
+
var suspendResult = this.z9_1;
|
|
595
|
+
$sm: do
|
|
596
|
+
try {
|
|
597
|
+
var tmp = this.x9_1;
|
|
598
|
+
switch (tmp) {
|
|
599
|
+
case 0:
|
|
600
|
+
this.y9_1 = 2;
|
|
601
|
+
var tmp_0 = this;
|
|
602
|
+
var tmp_1;
|
|
603
|
+
if (this.m87_1.a87_1.d3i_1.w(this.p87_1.k85_1.h4a())) {
|
|
604
|
+
tmp_1 = this.p87_1.k85_1;
|
|
605
|
+
} else {
|
|
606
|
+
tmp_1 = null;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
var tmp_2 = new LLMParams(VOID, VOID, VOID, VOID, tmp_1);
|
|
610
|
+
tmp_0.r87_1 = prompt_0('structure-fixing', tmp_2, VOID, StructureFixingParser$executeFixStructure$lambda(this.m87_1, this.o87_1, this.p87_1, this.q87_1));
|
|
611
|
+
this.x9_1 = 1;
|
|
612
|
+
suspendResult = this.n87_1.k4f(this.r87_1, this.m87_1.a87_1, VOID, this);
|
|
613
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
614
|
+
return suspendResult;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
continue $sm;
|
|
618
|
+
case 1:
|
|
619
|
+
var ARGUMENT = suspendResult;
|
|
620
|
+
var response = single(ARGUMENT);
|
|
621
|
+
if (!(response instanceof Assistant)) {
|
|
622
|
+
var message = 'Response for fixing structure must be an assistant message, got ' + getKClassFromExpression(response).zb() + ' instead';
|
|
623
|
+
throw IllegalArgumentException_init_$Create$(toString_0(message));
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
return response.v1j();
|
|
627
|
+
case 2:
|
|
628
|
+
throw this.aa_1;
|
|
629
|
+
}
|
|
630
|
+
} catch ($p) {
|
|
631
|
+
var e = $p;
|
|
632
|
+
if (this.y9_1 === 2) {
|
|
633
|
+
throw e;
|
|
634
|
+
} else {
|
|
635
|
+
this.x9_1 = this.y9_1;
|
|
636
|
+
this.aa_1 = e;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
while (true);
|
|
640
|
+
};
|
|
641
|
+
function StructuredData(id, schema, examples) {
|
|
642
|
+
this.j85_1 = id;
|
|
643
|
+
this.k85_1 = schema;
|
|
644
|
+
this.l85_1 = examples;
|
|
645
|
+
}
|
|
646
|
+
function StructuredOutputPrompts() {
|
|
647
|
+
}
|
|
648
|
+
protoOf(StructuredOutputPrompts).i85 = function (builder, structure) {
|
|
649
|
+
// Inline function 'kotlin.apply' call
|
|
650
|
+
// Inline function 'ai.koog.prompt.markdown.markdown' call
|
|
651
|
+
// Inline function 'kotlin.apply' call
|
|
652
|
+
var this_0 = new MarkdownContentBuilder();
|
|
653
|
+
this_0.k4e('NEXT MESSAGE OUTPUT FORMAT');
|
|
654
|
+
this_0.a43('The output in the next message MUST ADHERE TO ' + structure.j85_1 + ' format.');
|
|
655
|
+
this_0.c4e();
|
|
656
|
+
structure.p88(this_0);
|
|
657
|
+
builder.b43(this_0.o3o());
|
|
658
|
+
return builder;
|
|
659
|
+
};
|
|
660
|
+
var StructuredOutputPrompts_instance;
|
|
661
|
+
function StructuredOutputPrompts_getInstance() {
|
|
662
|
+
return StructuredOutputPrompts_instance;
|
|
663
|
+
}
|
|
664
|
+
function structure(_this__u8e3s4, structure, value) {
|
|
665
|
+
_this__u8e3s4.a43(structure.o88(value));
|
|
666
|
+
}
|
|
667
|
+
function JsonStructuredData$Companion$defaultJson$lambda($this$Json) {
|
|
668
|
+
$this$Json.e1i_1 = true;
|
|
669
|
+
$this$Json.b1i_1 = false;
|
|
670
|
+
$this$Json.d1i_1 = true;
|
|
671
|
+
$this$Json.c1i_1 = true;
|
|
672
|
+
$this$Json.h1i_1 = 'kind';
|
|
673
|
+
$this$Json.i1i_1 = ClassDiscriminatorMode_POLYMORPHIC_getInstance();
|
|
674
|
+
return Unit_instance;
|
|
675
|
+
}
|
|
676
|
+
function JsonStructuredData$Companion$defaultDefinitionPrompt$lambda($$this$with, $example) {
|
|
677
|
+
return function ($this$text) {
|
|
678
|
+
structure($this$text, $$this$with, $example);
|
|
679
|
+
return Unit_instance;
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function Companion_0() {
|
|
683
|
+
Companion_instance_1 = this;
|
|
684
|
+
var tmp = this;
|
|
685
|
+
tmp.q88_1 = Json(VOID, JsonStructuredData$Companion$defaultJson$lambda);
|
|
686
|
+
}
|
|
687
|
+
protoOf(Companion_0).r88 = function (builder, structuredData) {
|
|
688
|
+
// Inline function 'kotlin.apply' call
|
|
689
|
+
// Inline function 'kotlin.with' call
|
|
690
|
+
// Inline function 'ai.koog.prompt.markdown.markdown' call
|
|
691
|
+
// Inline function 'kotlin.apply' call
|
|
692
|
+
var this_0 = new MarkdownContentBuilder();
|
|
693
|
+
this_0.l4e('DEFINITION OF ' + structuredData.j85_1);
|
|
694
|
+
this_0.a43('The ' + structuredData.j85_1 + ' format is defined only and solely with JSON, without any additional characters, comments, backticks or anything similar.');
|
|
695
|
+
this_0.c4e();
|
|
696
|
+
this_0.a43('You must adhere to the following JSON schema:');
|
|
697
|
+
var tmp0 = structuredData.w88_1;
|
|
698
|
+
// Inline function 'kotlinx.serialization.json.Json.encodeToString' call
|
|
699
|
+
var value = structuredData.k85_1.g4a();
|
|
700
|
+
// Inline function 'kotlinx.serialization.serializer' call
|
|
701
|
+
var this_1 = tmp0.lz();
|
|
702
|
+
// Inline function 'kotlinx.serialization.internal.cast' call
|
|
703
|
+
var this_2 = serializer(this_1, createKType(getKClass(JsonObject), arrayOf([]), false));
|
|
704
|
+
var tmp$ret$1 = isInterface(this_2, KSerializer) ? this_2 : THROW_CCE();
|
|
705
|
+
var tmp$ret$2 = tmp0.gw(tmp$ret$1, value);
|
|
706
|
+
this_0.a43(tmp$ret$2);
|
|
707
|
+
this_0.c4e();
|
|
708
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
709
|
+
if (!structuredData.l85_1.m()) {
|
|
710
|
+
this_0.m4e('EXAMPLES');
|
|
711
|
+
if (structuredData.l85_1.s() === 1) {
|
|
712
|
+
this_0.a43('Here is an example of a valid response:');
|
|
713
|
+
} else {
|
|
714
|
+
this_0.a43('Here are some examples of valid responses:');
|
|
715
|
+
}
|
|
716
|
+
// Inline function 'kotlin.collections.forEach' call
|
|
717
|
+
var _iterator__ex2g4s = structuredData.l85_1.p();
|
|
718
|
+
while (_iterator__ex2g4s.q()) {
|
|
719
|
+
var element = _iterator__ex2g4s.r();
|
|
720
|
+
this_0.n4e(text(JsonStructuredData$Companion$defaultDefinitionPrompt$lambda(structuredData, element)), 'json');
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
this_0.k4e('RESULT');
|
|
724
|
+
this_0.a43('Provide ONLY the resulting JSON, WITHOUT ANY free text comments, backticks, or other symbols.');
|
|
725
|
+
this_0.a43('Output should start with { and end with }');
|
|
726
|
+
this_0.d43();
|
|
727
|
+
builder.b43(this_0.o3o());
|
|
728
|
+
return builder;
|
|
729
|
+
};
|
|
730
|
+
protoOf(Companion_0).y88 = function (id, serializer, json, schemaGenerator, descriptionOverrides, excludedProperties, examples, definitionPrompt) {
|
|
731
|
+
return new JsonStructuredData(id, schemaGenerator.z88(json, id, serializer, descriptionOverrides, excludedProperties), examples, serializer, json, definitionPrompt);
|
|
732
|
+
};
|
|
733
|
+
var Companion_instance_1;
|
|
734
|
+
function Companion_getInstance_0() {
|
|
735
|
+
if (Companion_instance_1 == null)
|
|
736
|
+
new Companion_0();
|
|
737
|
+
return Companion_instance_1;
|
|
738
|
+
}
|
|
739
|
+
function JsonStructuredData$Companion$defaultDefinitionPrompt$ref(p0) {
|
|
740
|
+
var l = function (_this__u8e3s4, p0_0) {
|
|
741
|
+
return p0.r88(_this__u8e3s4, p0_0);
|
|
742
|
+
};
|
|
743
|
+
l.callableName = 'defaultDefinitionPrompt';
|
|
744
|
+
return l;
|
|
745
|
+
}
|
|
746
|
+
function JsonStructuredData(id, schema, examples, serializer, json, definitionPrompt) {
|
|
747
|
+
Companion_getInstance_0();
|
|
748
|
+
var tmp;
|
|
749
|
+
if (definitionPrompt === VOID) {
|
|
750
|
+
tmp = JsonStructuredData$Companion$defaultDefinitionPrompt$ref(Companion_getInstance_0());
|
|
751
|
+
} else {
|
|
752
|
+
tmp = definitionPrompt;
|
|
753
|
+
}
|
|
754
|
+
definitionPrompt = tmp;
|
|
755
|
+
StructuredData.call(this, id, schema, examples);
|
|
756
|
+
this.v88_1 = serializer;
|
|
757
|
+
this.w88_1 = json;
|
|
758
|
+
this.x88_1 = definitionPrompt;
|
|
759
|
+
}
|
|
760
|
+
protoOf(JsonStructuredData).dt = function (text) {
|
|
761
|
+
return this.w88_1.hw(this.v88_1, text);
|
|
762
|
+
};
|
|
763
|
+
protoOf(JsonStructuredData).o88 = function (value) {
|
|
764
|
+
return this.w88_1.gw(this.v88_1, value);
|
|
765
|
+
};
|
|
766
|
+
protoOf(JsonStructuredData).p88 = function (builder) {
|
|
767
|
+
return this.x88_1(builder, this);
|
|
768
|
+
};
|
|
769
|
+
function Default() {
|
|
770
|
+
Default_instance = this;
|
|
771
|
+
BasicJsonSchemaGenerator.call(this);
|
|
772
|
+
}
|
|
773
|
+
var Default_instance;
|
|
774
|
+
function Default_getInstance() {
|
|
775
|
+
if (Default_instance == null)
|
|
776
|
+
new Default();
|
|
777
|
+
return Default_instance;
|
|
778
|
+
}
|
|
779
|
+
function BasicJsonSchemaGenerator() {
|
|
780
|
+
Default_getInstance();
|
|
781
|
+
GenericJsonSchemaGenerator.call(this);
|
|
782
|
+
}
|
|
783
|
+
protoOf(BasicJsonSchemaGenerator).z88 = function (json, name, serializer, descriptionOverrides, excludedProperties) {
|
|
784
|
+
var descriptorKind = serializer.fv().uw();
|
|
785
|
+
// Inline function 'kotlin.require' call
|
|
786
|
+
if (!contains(listOf([CLASS_getInstance(), OBJECT_getInstance(), MAP_getInstance()]), descriptorKind)) {
|
|
787
|
+
var message = 'Only object-like and no polymorphic types are supported for ' + getKClassFromExpression(this).zb() + ' generator, got ' + descriptorKind.toString();
|
|
788
|
+
throw IllegalArgumentException_init_$Create$(toString_0(message));
|
|
789
|
+
}
|
|
790
|
+
var tmp = serializer.fv();
|
|
791
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
792
|
+
var tmp_0 = LinkedHashMap_init_$Create$();
|
|
793
|
+
// Inline function 'kotlin.collections.listOf' call
|
|
794
|
+
var tmp$ret$3 = emptyList();
|
|
795
|
+
var context = new GenerationContext(json, tmp, tmp_0, tmp$ret$3, descriptionOverrides, excludedProperties, null);
|
|
796
|
+
var schema = this.j89(context);
|
|
797
|
+
return new Basic(name, schema);
|
|
798
|
+
};
|
|
799
|
+
protoOf(BasicJsonSchemaGenerator).a89 = function (_this__u8e3s4, context) {
|
|
800
|
+
var schema = toMutableMap(_this__u8e3s4);
|
|
801
|
+
if (context.n89_1.qw()) {
|
|
802
|
+
var tmp2 = 'nullable';
|
|
803
|
+
// Inline function 'kotlin.collections.set' call
|
|
804
|
+
var value = JsonPrimitive(true);
|
|
805
|
+
schema.r2(tmp2, value);
|
|
806
|
+
}
|
|
807
|
+
return new JsonObject(schema);
|
|
808
|
+
};
|
|
809
|
+
protoOf(BasicJsonSchemaGenerator).b89 = function (context) {
|
|
810
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).b89.call(this, context), context);
|
|
811
|
+
};
|
|
812
|
+
protoOf(BasicJsonSchemaGenerator).c89 = function (context) {
|
|
813
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).c89.call(this, context), context);
|
|
814
|
+
};
|
|
815
|
+
protoOf(BasicJsonSchemaGenerator).d89 = function (context) {
|
|
816
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).d89.call(this, context), context);
|
|
817
|
+
};
|
|
818
|
+
protoOf(BasicJsonSchemaGenerator).e89 = function (context) {
|
|
819
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).e89.call(this, context), context);
|
|
820
|
+
};
|
|
821
|
+
protoOf(BasicJsonSchemaGenerator).f89 = function (context) {
|
|
822
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).f89.call(this, context), context);
|
|
823
|
+
};
|
|
824
|
+
protoOf(BasicJsonSchemaGenerator).g89 = function (context) {
|
|
825
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).g89.call(this, context), context);
|
|
826
|
+
};
|
|
827
|
+
protoOf(BasicJsonSchemaGenerator).h89 = function (context) {
|
|
828
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).h89.call(this, context), context);
|
|
829
|
+
};
|
|
830
|
+
protoOf(BasicJsonSchemaGenerator).i89 = function (context) {
|
|
831
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).i89.call(this, context), context);
|
|
832
|
+
};
|
|
833
|
+
function GenericJsonSchemaGenerator() {
|
|
834
|
+
JsonSchemaGenerator.call(this);
|
|
835
|
+
}
|
|
836
|
+
protoOf(GenericJsonSchemaGenerator).j89 = function (context) {
|
|
837
|
+
var tmp0_subject = context.n89_1.uw();
|
|
838
|
+
var tmp;
|
|
839
|
+
if (equals(tmp0_subject, STRING_getInstance())) {
|
|
840
|
+
tmp = this.b89(context);
|
|
841
|
+
} else {
|
|
842
|
+
if (equals(tmp0_subject, BOOLEAN_getInstance())) {
|
|
843
|
+
tmp = this.c89(context);
|
|
844
|
+
} else {
|
|
845
|
+
if (equals(tmp0_subject, BYTE_getInstance()) || equals(tmp0_subject, SHORT_getInstance()) || (equals(tmp0_subject, INT_getInstance()) || equals(tmp0_subject, LONG_getInstance()))) {
|
|
846
|
+
tmp = this.d89(context);
|
|
847
|
+
} else {
|
|
848
|
+
if (equals(tmp0_subject, FLOAT_getInstance()) || equals(tmp0_subject, DOUBLE_getInstance())) {
|
|
849
|
+
tmp = this.e89(context);
|
|
850
|
+
} else {
|
|
851
|
+
if (equals(tmp0_subject, ENUM_getInstance())) {
|
|
852
|
+
tmp = this.f89(context);
|
|
853
|
+
} else {
|
|
854
|
+
if (equals(tmp0_subject, LIST_getInstance())) {
|
|
855
|
+
tmp = this.g89(context);
|
|
856
|
+
} else {
|
|
857
|
+
if (equals(tmp0_subject, MAP_getInstance())) {
|
|
858
|
+
tmp = this.h89(context);
|
|
859
|
+
} else {
|
|
860
|
+
if (equals(tmp0_subject, CLASS_getInstance()) || equals(tmp0_subject, OBJECT_getInstance())) {
|
|
861
|
+
tmp = this.i89(context);
|
|
862
|
+
} else {
|
|
863
|
+
if (tmp0_subject instanceof PolymorphicKind) {
|
|
864
|
+
tmp = this.l89(context);
|
|
865
|
+
} else {
|
|
866
|
+
throw IllegalArgumentException_init_$Create$('Encountered unsupported type while generating JSON schema: ' + context.n89_1.uw().toString());
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
return tmp;
|
|
877
|
+
};
|
|
878
|
+
protoOf(GenericJsonSchemaGenerator).k89 = function (_this__u8e3s4, description) {
|
|
879
|
+
if (description == null)
|
|
880
|
+
null;
|
|
881
|
+
else {
|
|
882
|
+
// Inline function 'kotlin.let' call
|
|
883
|
+
put(_this__u8e3s4, 'description', description);
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
protoOf(GenericJsonSchemaGenerator).b89 = function (context) {
|
|
887
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
888
|
+
var builder = new JsonObjectBuilder();
|
|
889
|
+
put(builder, 'type', 'string');
|
|
890
|
+
this.k89(builder, context.s89_1);
|
|
891
|
+
return builder.s1i();
|
|
892
|
+
};
|
|
893
|
+
protoOf(GenericJsonSchemaGenerator).c89 = function (context) {
|
|
894
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
895
|
+
var builder = new JsonObjectBuilder();
|
|
896
|
+
put(builder, 'type', 'boolean');
|
|
897
|
+
this.k89(builder, context.s89_1);
|
|
898
|
+
return builder.s1i();
|
|
899
|
+
};
|
|
900
|
+
protoOf(GenericJsonSchemaGenerator).d89 = function (context) {
|
|
901
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
902
|
+
var builder = new JsonObjectBuilder();
|
|
903
|
+
put(builder, 'type', 'integer');
|
|
904
|
+
this.k89(builder, context.s89_1);
|
|
905
|
+
return builder.s1i();
|
|
906
|
+
};
|
|
907
|
+
protoOf(GenericJsonSchemaGenerator).e89 = function (context) {
|
|
908
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
909
|
+
var builder = new JsonObjectBuilder();
|
|
910
|
+
put(builder, 'type', 'number');
|
|
911
|
+
this.k89(builder, context.s89_1);
|
|
912
|
+
return builder.s1i();
|
|
913
|
+
};
|
|
914
|
+
protoOf(GenericJsonSchemaGenerator).f89 = function (context) {
|
|
915
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
916
|
+
var builder = new JsonObjectBuilder();
|
|
917
|
+
put(builder, 'type', 'string');
|
|
918
|
+
// Inline function 'kotlin.collections.map' call
|
|
919
|
+
var this_0 = get_elementNames(context.n89_1);
|
|
920
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
921
|
+
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
|
|
922
|
+
var _iterator__ex2g4s = this_0.p();
|
|
923
|
+
while (_iterator__ex2g4s.q()) {
|
|
924
|
+
var item = _iterator__ex2g4s.r();
|
|
925
|
+
var tmp$ret$0 = JsonPrimitive_0(item);
|
|
926
|
+
destination.h(tmp$ret$0);
|
|
927
|
+
}
|
|
928
|
+
builder.g1k('enum', new JsonArray(destination));
|
|
929
|
+
this.k89(builder, context.s89_1);
|
|
930
|
+
return builder.s1i();
|
|
931
|
+
};
|
|
932
|
+
protoOf(GenericJsonSchemaGenerator).g89 = function (context) {
|
|
933
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
934
|
+
var builder = new JsonObjectBuilder();
|
|
935
|
+
var itemDescriptor = context.n89_1.bx(0);
|
|
936
|
+
put(builder, 'type', 'array');
|
|
937
|
+
builder.g1k('items', this.j89(context.t89(VOID, itemDescriptor, VOID, VOID, VOID, VOID, null)));
|
|
938
|
+
this.k89(builder, context.s89_1);
|
|
939
|
+
return builder.s1i();
|
|
940
|
+
};
|
|
941
|
+
protoOf(GenericJsonSchemaGenerator).h89 = function (context) {
|
|
942
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
943
|
+
var builder = new JsonObjectBuilder();
|
|
944
|
+
var keyDescriptor = context.n89_1.bx(0);
|
|
945
|
+
var valueDescriptor = context.n89_1.bx(1);
|
|
946
|
+
// Inline function 'kotlin.require' call
|
|
947
|
+
if (!equals(keyDescriptor.uw(), STRING_getInstance())) {
|
|
948
|
+
var message = 'JSON schema only supports string keys in maps, found: ' + keyDescriptor.fw();
|
|
949
|
+
throw IllegalArgumentException_init_$Create$(toString_0(message));
|
|
950
|
+
}
|
|
951
|
+
put(builder, 'type', 'object');
|
|
952
|
+
builder.g1k('additionalProperties', this.j89(context.t89(VOID, valueDescriptor, VOID, VOID, VOID, VOID, null)));
|
|
953
|
+
this.k89(builder, context.s89_1);
|
|
954
|
+
return builder.s1i();
|
|
955
|
+
};
|
|
956
|
+
protoOf(GenericJsonSchemaGenerator).i89 = function (context) {
|
|
957
|
+
// Inline function 'kotlin.check' call
|
|
958
|
+
if (!!context.p89_1.w(context.n89_1)) {
|
|
959
|
+
var tmp = getKClassFromExpression(this).zb();
|
|
960
|
+
var tmp_0 = context.n89_1.fw();
|
|
961
|
+
// Inline function 'kotlin.collections.map' call
|
|
962
|
+
var this_0 = context.p89_1;
|
|
963
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
964
|
+
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
|
|
965
|
+
var _iterator__ex2g4s = this_0.p();
|
|
966
|
+
while (_iterator__ex2g4s.q()) {
|
|
967
|
+
var item = _iterator__ex2g4s.r();
|
|
968
|
+
var tmp$ret$0 = item.fw();
|
|
969
|
+
destination.h(tmp$ret$0);
|
|
970
|
+
}
|
|
971
|
+
var message = trimIndent('\n Recursion detected in type definitions while generating JSON schema.\n This usually means you have recursive type where one of the fields in a class has a type of this class itself\n or its base class when using ' + tmp + " generator, which is not supported by this generator.\n \n Consider some possible solutions:\n 1. Use other JSON schema generator that supports such classes and if the format it produces is supported by the LLM you're using.\n 2. Remove recursive type references.\n \n Current definition is " + tmp_0 + ' at path ' + toString_0(destination) + '\n ');
|
|
972
|
+
throw IllegalStateException_init_$Create$(toString_0(message));
|
|
973
|
+
}
|
|
974
|
+
var tmp_1;
|
|
975
|
+
var tmp0 = context.o89_1;
|
|
976
|
+
// Inline function 'kotlin.collections.contains' call
|
|
977
|
+
// Inline function 'kotlin.collections.containsKey' call
|
|
978
|
+
var key = context.n89_1;
|
|
979
|
+
if ((isInterface(tmp0, KtMap) ? tmp0 : THROW_CCE()).h2(key)) {
|
|
980
|
+
tmp_1 = getValue(context.o89_1, context.n89_1);
|
|
981
|
+
} else {
|
|
982
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
983
|
+
var builder = new JsonObjectBuilder();
|
|
984
|
+
var inductionVariable = 0;
|
|
985
|
+
var last = context.n89_1.ww();
|
|
986
|
+
if (inductionVariable < last)
|
|
987
|
+
$l$loop: do {
|
|
988
|
+
var i = inductionVariable;
|
|
989
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
990
|
+
var propertyName = context.n89_1.yw(i);
|
|
991
|
+
var propertyDescriptor = context.n89_1.bx(i);
|
|
992
|
+
var lookupKey = context.n89_1.fw() + '.' + propertyName;
|
|
993
|
+
if (context.r89_1.w(lookupKey)) {
|
|
994
|
+
if (!context.n89_1.cx(i)) {
|
|
995
|
+
throw IllegalArgumentException_init_$Create$("Property '" + lookupKey + "' is marked as excluded, but it is required in the schema.");
|
|
996
|
+
}
|
|
997
|
+
continue $l$loop;
|
|
998
|
+
}
|
|
999
|
+
var tmp_2 = plus(context.p89_1, context.n89_1);
|
|
1000
|
+
var tmp0_elvis_lhs = context.u89(i);
|
|
1001
|
+
builder.g1k(propertyName, this.j89(context.t89(VOID, propertyDescriptor, VOID, tmp_2, VOID, VOID, tmp0_elvis_lhs == null ? context.t89(VOID, propertyDescriptor).v89() : tmp0_elvis_lhs)));
|
|
1002
|
+
}
|
|
1003
|
+
while (inductionVariable < last);
|
|
1004
|
+
var properties = builder.s1i();
|
|
1005
|
+
// Inline function 'kotlinx.serialization.json.buildJsonArray' call
|
|
1006
|
+
var builder_0 = new JsonArrayBuilder();
|
|
1007
|
+
var inductionVariable_0 = 0;
|
|
1008
|
+
var last_0 = context.n89_1.ww();
|
|
1009
|
+
if (inductionVariable_0 < last_0)
|
|
1010
|
+
do {
|
|
1011
|
+
var i_0 = inductionVariable_0;
|
|
1012
|
+
inductionVariable_0 = inductionVariable_0 + 1 | 0;
|
|
1013
|
+
if (!context.n89_1.cx(i_0)) {
|
|
1014
|
+
add(builder_0, context.n89_1.yw(i_0));
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
while (inductionVariable_0 < last_0);
|
|
1018
|
+
var required = builder_0.s1i();
|
|
1019
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1020
|
+
var builder_1 = new JsonObjectBuilder();
|
|
1021
|
+
put(builder_1, 'type', 'object');
|
|
1022
|
+
builder_1.g1k('properties', properties);
|
|
1023
|
+
builder_1.g1k('required', required);
|
|
1024
|
+
put_0(builder_1, 'additionalProperties', false);
|
|
1025
|
+
// Inline function 'kotlin.also' call
|
|
1026
|
+
var this_1 = builder_1.s1i();
|
|
1027
|
+
var tmp0_0 = context.o89_1;
|
|
1028
|
+
// Inline function 'kotlin.collections.set' call
|
|
1029
|
+
var key_0 = context.n89_1;
|
|
1030
|
+
tmp0_0.r2(key_0, this_1);
|
|
1031
|
+
tmp_1 = this_1;
|
|
1032
|
+
}
|
|
1033
|
+
var schema = tmp_1;
|
|
1034
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1035
|
+
var builder_2 = new JsonObjectBuilder();
|
|
1036
|
+
// Inline function 'kotlin.collections.forEach' call
|
|
1037
|
+
// Inline function 'kotlin.collections.iterator' call
|
|
1038
|
+
var _iterator__ex2g4s_0 = schema.z().p();
|
|
1039
|
+
while (_iterator__ex2g4s_0.q()) {
|
|
1040
|
+
var element = _iterator__ex2g4s_0.r();
|
|
1041
|
+
// Inline function 'kotlin.collections.component1' call
|
|
1042
|
+
var key_1 = element.a1();
|
|
1043
|
+
// Inline function 'kotlin.collections.component2' call
|
|
1044
|
+
var value = element.b1();
|
|
1045
|
+
builder_2.g1k(key_1, value);
|
|
1046
|
+
}
|
|
1047
|
+
this.k89(builder_2, context.s89_1);
|
|
1048
|
+
return builder_2.s1i();
|
|
1049
|
+
};
|
|
1050
|
+
protoOf(GenericJsonSchemaGenerator).l89 = function (context) {
|
|
1051
|
+
throw UnsupportedOperationException_init_$Create$('Polymorphic types are not supported by ' + getKClassFromExpression(this).zb() + ' generator');
|
|
1052
|
+
};
|
|
1053
|
+
function GenerationContext(json, descriptor, processedTypeDefs, currentDefPath, descriptionOverrides, excludedProperties, currentDescription) {
|
|
1054
|
+
this.m89_1 = json;
|
|
1055
|
+
this.n89_1 = descriptor;
|
|
1056
|
+
this.o89_1 = processedTypeDefs;
|
|
1057
|
+
this.p89_1 = currentDefPath;
|
|
1058
|
+
this.q89_1 = descriptionOverrides;
|
|
1059
|
+
this.r89_1 = excludedProperties;
|
|
1060
|
+
this.s89_1 = currentDescription;
|
|
1061
|
+
}
|
|
1062
|
+
protoOf(GenerationContext).v89 = function () {
|
|
1063
|
+
var typeDescriptionOverride = this.q89_1.j2(this.n89_1.fw());
|
|
1064
|
+
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
1065
|
+
var tmp0 = this.n89_1.xw();
|
|
1066
|
+
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
1067
|
+
var destination = ArrayList_init_$Create$_0();
|
|
1068
|
+
var _iterator__ex2g4s = tmp0.p();
|
|
1069
|
+
while (_iterator__ex2g4s.q()) {
|
|
1070
|
+
var element = _iterator__ex2g4s.r();
|
|
1071
|
+
if (element instanceof LLMDescription) {
|
|
1072
|
+
destination.h(element);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
var tmp0_safe_receiver = firstOrNull(destination);
|
|
1076
|
+
var typeDescriptionAnnotation = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.i4f_1;
|
|
1077
|
+
return typeDescriptionOverride == null ? typeDescriptionAnnotation : typeDescriptionOverride;
|
|
1078
|
+
};
|
|
1079
|
+
protoOf(GenerationContext).u89 = function (index) {
|
|
1080
|
+
var elementName = this.n89_1.yw(index);
|
|
1081
|
+
var elementAnnotations = this.n89_1.ax(index);
|
|
1082
|
+
var lookupKey = this.n89_1.fw() + '.' + elementName;
|
|
1083
|
+
var elementDescriptionOverride = this.q89_1.j2(lookupKey);
|
|
1084
|
+
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
1085
|
+
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
1086
|
+
var destination = ArrayList_init_$Create$_0();
|
|
1087
|
+
var _iterator__ex2g4s = elementAnnotations.p();
|
|
1088
|
+
while (_iterator__ex2g4s.q()) {
|
|
1089
|
+
var element = _iterator__ex2g4s.r();
|
|
1090
|
+
if (element instanceof LLMDescription) {
|
|
1091
|
+
destination.h(element);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
var tmp0_safe_receiver = firstOrNull(destination);
|
|
1095
|
+
var elementDescriptionAnnotation = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.i4f_1;
|
|
1096
|
+
return elementDescriptionOverride == null ? elementDescriptionAnnotation : elementDescriptionOverride;
|
|
1097
|
+
};
|
|
1098
|
+
protoOf(GenerationContext).w89 = function (json, descriptor, processedTypeDefs, currentDefPath, descriptionOverrides, excludedProperties, currentDescription) {
|
|
1099
|
+
return new GenerationContext(json, descriptor, processedTypeDefs, currentDefPath, descriptionOverrides, excludedProperties, currentDescription);
|
|
1100
|
+
};
|
|
1101
|
+
protoOf(GenerationContext).t89 = function (json, descriptor, processedTypeDefs, currentDefPath, descriptionOverrides, excludedProperties, currentDescription, $super) {
|
|
1102
|
+
json = json === VOID ? this.m89_1 : json;
|
|
1103
|
+
descriptor = descriptor === VOID ? this.n89_1 : descriptor;
|
|
1104
|
+
processedTypeDefs = processedTypeDefs === VOID ? this.o89_1 : processedTypeDefs;
|
|
1105
|
+
currentDefPath = currentDefPath === VOID ? this.p89_1 : currentDefPath;
|
|
1106
|
+
descriptionOverrides = descriptionOverrides === VOID ? this.q89_1 : descriptionOverrides;
|
|
1107
|
+
excludedProperties = excludedProperties === VOID ? this.r89_1 : excludedProperties;
|
|
1108
|
+
currentDescription = currentDescription === VOID ? this.s89_1 : currentDescription;
|
|
1109
|
+
return $super === VOID ? this.w89(json, descriptor, processedTypeDefs, currentDefPath, descriptionOverrides, excludedProperties, currentDescription) : $super.w89.call(this, json, descriptor, processedTypeDefs, currentDefPath, descriptionOverrides, excludedProperties, currentDescription);
|
|
1110
|
+
};
|
|
1111
|
+
protoOf(GenerationContext).toString = function () {
|
|
1112
|
+
return 'GenerationContext(json=' + toString_0(this.m89_1) + ', descriptor=' + toString_0(this.n89_1) + ', processedTypeDefs=' + toString_0(this.o89_1) + ', currentDefPath=' + toString_0(this.p89_1) + ', descriptionOverrides=' + toString_0(this.q89_1) + ', excludedProperties=' + toString_0(this.r89_1) + ', currentDescription=' + this.s89_1 + ')';
|
|
1113
|
+
};
|
|
1114
|
+
protoOf(GenerationContext).hashCode = function () {
|
|
1115
|
+
var result = hashCode(this.m89_1);
|
|
1116
|
+
result = imul(result, 31) + hashCode(this.n89_1) | 0;
|
|
1117
|
+
result = imul(result, 31) + hashCode(this.o89_1) | 0;
|
|
1118
|
+
result = imul(result, 31) + hashCode(this.p89_1) | 0;
|
|
1119
|
+
result = imul(result, 31) + hashCode(this.q89_1) | 0;
|
|
1120
|
+
result = imul(result, 31) + hashCode(this.r89_1) | 0;
|
|
1121
|
+
result = imul(result, 31) + (this.s89_1 == null ? 0 : getStringHashCode(this.s89_1)) | 0;
|
|
1122
|
+
return result;
|
|
1123
|
+
};
|
|
1124
|
+
protoOf(GenerationContext).equals = function (other) {
|
|
1125
|
+
if (this === other)
|
|
1126
|
+
return true;
|
|
1127
|
+
if (!(other instanceof GenerationContext))
|
|
1128
|
+
return false;
|
|
1129
|
+
var tmp0_other_with_cast = other instanceof GenerationContext ? other : THROW_CCE();
|
|
1130
|
+
if (!equals(this.m89_1, tmp0_other_with_cast.m89_1))
|
|
1131
|
+
return false;
|
|
1132
|
+
if (!equals(this.n89_1, tmp0_other_with_cast.n89_1))
|
|
1133
|
+
return false;
|
|
1134
|
+
if (!equals(this.o89_1, tmp0_other_with_cast.o89_1))
|
|
1135
|
+
return false;
|
|
1136
|
+
if (!equals(this.p89_1, tmp0_other_with_cast.p89_1))
|
|
1137
|
+
return false;
|
|
1138
|
+
if (!equals(this.q89_1, tmp0_other_with_cast.q89_1))
|
|
1139
|
+
return false;
|
|
1140
|
+
if (!equals(this.r89_1, tmp0_other_with_cast.r89_1))
|
|
1141
|
+
return false;
|
|
1142
|
+
if (!(this.s89_1 == tmp0_other_with_cast.s89_1))
|
|
1143
|
+
return false;
|
|
1144
|
+
return true;
|
|
1145
|
+
};
|
|
1146
|
+
function JsonSchemaGenerator() {
|
|
1147
|
+
}
|
|
1148
|
+
function getPolymorphicDescriptors_0(_this__u8e3s4, json) {
|
|
1149
|
+
var tmp0_subject = _this__u8e3s4.uw();
|
|
1150
|
+
var tmp;
|
|
1151
|
+
if (tmp0_subject instanceof SEALED) {
|
|
1152
|
+
// Inline function 'kotlin.require' call
|
|
1153
|
+
if (!(getOrNull(toList(get_elementNames(_this__u8e3s4)), 1) === 'value')) {
|
|
1154
|
+
var message = "Expected second element to be 'value', got: " + toString_0(toList(get_elementNames(_this__u8e3s4)));
|
|
1155
|
+
throw IllegalArgumentException_init_$Create$(toString_0(message));
|
|
1156
|
+
}
|
|
1157
|
+
var tmp1_elvis_lhs = getOrNull(toList(get_elementDescriptors(_this__u8e3s4)), 1);
|
|
1158
|
+
var tmp_0;
|
|
1159
|
+
if (tmp1_elvis_lhs == null) {
|
|
1160
|
+
throw IllegalArgumentException_init_$Create$('Cannot find subclasses descriptor');
|
|
1161
|
+
} else {
|
|
1162
|
+
tmp_0 = tmp1_elvis_lhs;
|
|
1163
|
+
}
|
|
1164
|
+
var subclassesDescriptor = tmp_0;
|
|
1165
|
+
tmp = toList(get_elementDescriptors(subclassesDescriptor));
|
|
1166
|
+
} else {
|
|
1167
|
+
if (tmp0_subject instanceof OPEN) {
|
|
1168
|
+
tmp = getPolymorphicDescriptors(json.lz(), _this__u8e3s4);
|
|
1169
|
+
} else {
|
|
1170
|
+
throw IllegalArgumentException_init_$Create$('Unsupported descriptor type: ' + _this__u8e3s4.uw().toString());
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
var subclassDescriptor = tmp;
|
|
1174
|
+
// Inline function 'kotlin.collections.sortedBy' call
|
|
1175
|
+
// Inline function 'kotlin.comparisons.compareBy' call
|
|
1176
|
+
var tmp_1 = getPolymorphicDescriptors$lambda;
|
|
1177
|
+
var tmp$ret$2 = new sam$kotlin_Comparator$0(tmp_1);
|
|
1178
|
+
return sortedWith(subclassDescriptor, tmp$ret$2);
|
|
1179
|
+
}
|
|
1180
|
+
function countElements(_this__u8e3s4, value) {
|
|
1181
|
+
var tmp;
|
|
1182
|
+
if (equals(_this__u8e3s4, value)) {
|
|
1183
|
+
tmp = 1;
|
|
1184
|
+
} else {
|
|
1185
|
+
if (_this__u8e3s4 instanceof JsonObject) {
|
|
1186
|
+
// Inline function 'kotlin.collections.sumOf' call
|
|
1187
|
+
var sum = 0;
|
|
1188
|
+
var _iterator__ex2g4s = _this__u8e3s4.l2().p();
|
|
1189
|
+
while (_iterator__ex2g4s.q()) {
|
|
1190
|
+
var element = _iterator__ex2g4s.r();
|
|
1191
|
+
var tmp_0 = sum;
|
|
1192
|
+
sum = tmp_0 + countElements(element, value) | 0;
|
|
1193
|
+
}
|
|
1194
|
+
tmp = sum;
|
|
1195
|
+
} else {
|
|
1196
|
+
if (_this__u8e3s4 instanceof JsonArray) {
|
|
1197
|
+
// Inline function 'kotlin.collections.sumOf' call
|
|
1198
|
+
var sum_0 = 0;
|
|
1199
|
+
var _iterator__ex2g4s_0 = _this__u8e3s4.p();
|
|
1200
|
+
while (_iterator__ex2g4s_0.q()) {
|
|
1201
|
+
var element_0 = _iterator__ex2g4s_0.r();
|
|
1202
|
+
var tmp_1 = sum_0;
|
|
1203
|
+
sum_0 = tmp_1 + countElements(element_0, value) | 0;
|
|
1204
|
+
}
|
|
1205
|
+
tmp = sum_0;
|
|
1206
|
+
} else {
|
|
1207
|
+
tmp = 0;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
return tmp;
|
|
1212
|
+
}
|
|
1213
|
+
function sam$kotlin_Comparator$0(function_0) {
|
|
1214
|
+
this.x89_1 = function_0;
|
|
1215
|
+
}
|
|
1216
|
+
protoOf(sam$kotlin_Comparator$0).qf = function (a, b) {
|
|
1217
|
+
return this.x89_1(a, b);
|
|
1218
|
+
};
|
|
1219
|
+
protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
|
|
1220
|
+
return this.qf(a, b);
|
|
1221
|
+
};
|
|
1222
|
+
protoOf(sam$kotlin_Comparator$0).v3 = function () {
|
|
1223
|
+
return this.x89_1;
|
|
1224
|
+
};
|
|
1225
|
+
protoOf(sam$kotlin_Comparator$0).equals = function (other) {
|
|
1226
|
+
var tmp;
|
|
1227
|
+
if (!(other == null) ? isInterface(other, Comparator) : false) {
|
|
1228
|
+
var tmp_0;
|
|
1229
|
+
if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
|
|
1230
|
+
tmp_0 = equals(this.v3(), other.v3());
|
|
1231
|
+
} else {
|
|
1232
|
+
tmp_0 = false;
|
|
1233
|
+
}
|
|
1234
|
+
tmp = tmp_0;
|
|
1235
|
+
} else {
|
|
1236
|
+
tmp = false;
|
|
1237
|
+
}
|
|
1238
|
+
return tmp;
|
|
1239
|
+
};
|
|
1240
|
+
protoOf(sam$kotlin_Comparator$0).hashCode = function () {
|
|
1241
|
+
return hashCode(this.v3());
|
|
1242
|
+
};
|
|
1243
|
+
function getPolymorphicDescriptors$lambda(a, b) {
|
|
1244
|
+
// Inline function 'kotlin.comparisons.compareValuesBy' call
|
|
1245
|
+
var tmp = a.fw();
|
|
1246
|
+
var tmp$ret$1 = b.fw();
|
|
1247
|
+
return compareValues(tmp, tmp$ret$1);
|
|
1248
|
+
}
|
|
1249
|
+
function Default_0() {
|
|
1250
|
+
Default_instance_0 = this;
|
|
1251
|
+
StandardJsonSchemaGenerator.call(this);
|
|
1252
|
+
}
|
|
1253
|
+
var Default_instance_0;
|
|
1254
|
+
function Default_getInstance_0() {
|
|
1255
|
+
if (Default_instance_0 == null)
|
|
1256
|
+
new Default_0();
|
|
1257
|
+
return Default_instance_0;
|
|
1258
|
+
}
|
|
1259
|
+
function StandardJsonSchemaGenerator$generate$$inlined$groupingBy$1($this) {
|
|
1260
|
+
this.z89_1 = $this;
|
|
1261
|
+
}
|
|
1262
|
+
protoOf(StandardJsonSchemaGenerator$generate$$inlined$groupingBy$1).v4 = function () {
|
|
1263
|
+
return this.z89_1.p();
|
|
1264
|
+
};
|
|
1265
|
+
protoOf(StandardJsonSchemaGenerator$generate$$inlined$groupingBy$1).ew = function (element) {
|
|
1266
|
+
return element;
|
|
1267
|
+
};
|
|
1268
|
+
protoOf(StandardJsonSchemaGenerator$generate$$inlined$groupingBy$1).w4 = function (element) {
|
|
1269
|
+
return this.ew((element == null ? true : !(element == null)) ? element : THROW_CCE());
|
|
1270
|
+
};
|
|
1271
|
+
function StandardJsonSchemaGenerator() {
|
|
1272
|
+
Default_getInstance_0();
|
|
1273
|
+
GenericJsonSchemaGenerator.call(this);
|
|
1274
|
+
}
|
|
1275
|
+
protoOf(StandardJsonSchemaGenerator).z88 = function (json, name, serializer, descriptionOverrides, excludedProperties) {
|
|
1276
|
+
var descriptorKind = serializer.fv().uw();
|
|
1277
|
+
var tmp;
|
|
1278
|
+
if (descriptorKind instanceof PolymorphicKind) {
|
|
1279
|
+
tmp = true;
|
|
1280
|
+
} else {
|
|
1281
|
+
tmp = contains(listOf([CLASS_getInstance(), OBJECT_getInstance(), MAP_getInstance()]), descriptorKind);
|
|
1282
|
+
}
|
|
1283
|
+
// Inline function 'kotlin.require' call
|
|
1284
|
+
if (!tmp) {
|
|
1285
|
+
var message = 'Only object-like types are supported for ' + getKClassFromExpression(this).zb() + ' generator, got ' + descriptorKind.toString();
|
|
1286
|
+
throw IllegalArgumentException_init_$Create$(toString_0(message));
|
|
1287
|
+
}
|
|
1288
|
+
var tmp_0 = serializer.fv();
|
|
1289
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
1290
|
+
var tmp_1 = LinkedHashMap_init_$Create$();
|
|
1291
|
+
// Inline function 'kotlin.collections.listOf' call
|
|
1292
|
+
var tmp$ret$3 = emptyList();
|
|
1293
|
+
var context = new GenerationContext(json, tmp_0, tmp_1, tmp$ret$3, descriptionOverrides, excludedProperties, null);
|
|
1294
|
+
var generatedSchema = this.j89(context);
|
|
1295
|
+
// Inline function 'kotlin.collections.map' call
|
|
1296
|
+
var this_0 = context.o89_1.k2();
|
|
1297
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1298
|
+
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
|
|
1299
|
+
var _iterator__ex2g4s = this_0.p();
|
|
1300
|
+
while (_iterator__ex2g4s.q()) {
|
|
1301
|
+
var item = _iterator__ex2g4s.r();
|
|
1302
|
+
var tmp$ret$4 = item.fw();
|
|
1303
|
+
destination.h(tmp$ret$4);
|
|
1304
|
+
}
|
|
1305
|
+
// Inline function 'kotlin.collections.groupingBy' call
|
|
1306
|
+
var tmp$ret$7 = new StandardJsonSchemaGenerator$generate$$inlined$groupingBy$1(destination);
|
|
1307
|
+
// Inline function 'kotlin.collections.filter' call
|
|
1308
|
+
var tmp0 = eachCount(tmp$ret$7);
|
|
1309
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
1310
|
+
var destination_0 = LinkedHashMap_init_$Create$();
|
|
1311
|
+
// Inline function 'kotlin.collections.iterator' call
|
|
1312
|
+
var _iterator__ex2g4s_0 = tmp0.z().p();
|
|
1313
|
+
while (_iterator__ex2g4s_0.q()) {
|
|
1314
|
+
var element = _iterator__ex2g4s_0.r();
|
|
1315
|
+
if (element.b1() > 1) {
|
|
1316
|
+
destination_0.r2(element.a1(), element.b1());
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
var duplicatedSerialNames = destination_0;
|
|
1320
|
+
// Inline function 'kotlin.require' call
|
|
1321
|
+
if (!duplicatedSerialNames.m()) {
|
|
1322
|
+
var message_0 = trimIndent('\n Found duplicated serial type names, but for a proper type definitions processing by ' + getKClassFromExpression(this).zb() + ' generator they should be unique.\n Duplicates: ' + toString_0(duplicatedSerialNames) + '\n ');
|
|
1323
|
+
throw IllegalArgumentException_init_$Create$(toString_0(message_0));
|
|
1324
|
+
}
|
|
1325
|
+
// Inline function 'kotlin.collections.mapKeys' call
|
|
1326
|
+
var this_1 = context.o89_1;
|
|
1327
|
+
// Inline function 'kotlin.collections.mapKeysTo' call
|
|
1328
|
+
var destination_1 = LinkedHashMap_init_$Create$_0(mapCapacity(this_1.s()));
|
|
1329
|
+
// Inline function 'kotlin.collections.associateByTo' call
|
|
1330
|
+
var _iterator__ex2g4s_1 = this_1.z().p();
|
|
1331
|
+
while (_iterator__ex2g4s_1.q()) {
|
|
1332
|
+
var element_0 = _iterator__ex2g4s_1.r();
|
|
1333
|
+
// Inline function 'kotlin.collections.component1' call
|
|
1334
|
+
var descriptor = element_0.a1();
|
|
1335
|
+
var tmp_2 = descriptor.fw();
|
|
1336
|
+
var tmp$ret$16 = element_0.b1();
|
|
1337
|
+
destination_1.r2(tmp_2, tmp$ret$16);
|
|
1338
|
+
}
|
|
1339
|
+
var typeDefinitions = destination_1;
|
|
1340
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1341
|
+
var builder = new JsonObjectBuilder();
|
|
1342
|
+
put(builder, '$id', name);
|
|
1343
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1344
|
+
if (!context.o89_1.m()) {
|
|
1345
|
+
builder.g1k('$defs', new JsonObject(typeDefinitions));
|
|
1346
|
+
}
|
|
1347
|
+
// Inline function 'kotlin.collections.forEach' call
|
|
1348
|
+
var _iterator__ex2g4s_2 = generatedSchema.z().p();
|
|
1349
|
+
while (_iterator__ex2g4s_2.q()) {
|
|
1350
|
+
var element_1 = _iterator__ex2g4s_2.r();
|
|
1351
|
+
// Inline function 'kotlin.collections.component1' call
|
|
1352
|
+
var key = element_1.a1();
|
|
1353
|
+
// Inline function 'kotlin.collections.component2' call
|
|
1354
|
+
var value = element_1.b1();
|
|
1355
|
+
builder.g1k(key, value);
|
|
1356
|
+
}
|
|
1357
|
+
var schema = builder.s1i();
|
|
1358
|
+
return new Standard(name, schema);
|
|
1359
|
+
};
|
|
1360
|
+
protoOf(StandardJsonSchemaGenerator).a89 = function (_this__u8e3s4, context) {
|
|
1361
|
+
var schema = toMutableMap(_this__u8e3s4);
|
|
1362
|
+
if (context.n89_1.qw()) {
|
|
1363
|
+
// Inline function 'kotlin.collections.set' call
|
|
1364
|
+
var value = new JsonArray(listOf([getValue(schema, 'type'), JsonPrimitive_0('null')]));
|
|
1365
|
+
schema.r2('type', value);
|
|
1366
|
+
}
|
|
1367
|
+
return new JsonObject(schema);
|
|
1368
|
+
};
|
|
1369
|
+
protoOf(StandardJsonSchemaGenerator).b89 = function (context) {
|
|
1370
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).b89.call(this, context), context);
|
|
1371
|
+
};
|
|
1372
|
+
protoOf(StandardJsonSchemaGenerator).c89 = function (context) {
|
|
1373
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).c89.call(this, context), context);
|
|
1374
|
+
};
|
|
1375
|
+
protoOf(StandardJsonSchemaGenerator).d89 = function (context) {
|
|
1376
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).d89.call(this, context), context);
|
|
1377
|
+
};
|
|
1378
|
+
protoOf(StandardJsonSchemaGenerator).e89 = function (context) {
|
|
1379
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).e89.call(this, context), context);
|
|
1380
|
+
};
|
|
1381
|
+
protoOf(StandardJsonSchemaGenerator).f89 = function (context) {
|
|
1382
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).f89.call(this, context), context);
|
|
1383
|
+
};
|
|
1384
|
+
protoOf(StandardJsonSchemaGenerator).g89 = function (context) {
|
|
1385
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).g89.call(this, context), context);
|
|
1386
|
+
};
|
|
1387
|
+
protoOf(StandardJsonSchemaGenerator).h89 = function (context) {
|
|
1388
|
+
return this.a89(protoOf(GenericJsonSchemaGenerator).h89.call(this, context), context);
|
|
1389
|
+
};
|
|
1390
|
+
protoOf(StandardJsonSchemaGenerator).i89 = function (context) {
|
|
1391
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1392
|
+
var builder = new JsonObjectBuilder();
|
|
1393
|
+
if (!context.p89_1.w(context.n89_1)) {
|
|
1394
|
+
protoOf(GenericJsonSchemaGenerator).i89.call(this, context);
|
|
1395
|
+
var schema = toMutableMap(getValue(context.o89_1, context.n89_1));
|
|
1396
|
+
var tmp0_safe_receiver = context.v89();
|
|
1397
|
+
if (tmp0_safe_receiver == null)
|
|
1398
|
+
null;
|
|
1399
|
+
else {
|
|
1400
|
+
// Inline function 'kotlin.let' call
|
|
1401
|
+
var tmp2 = 'description';
|
|
1402
|
+
// Inline function 'kotlin.collections.set' call
|
|
1403
|
+
var value = JsonPrimitive_0(tmp0_safe_receiver);
|
|
1404
|
+
schema.r2(tmp2, value);
|
|
1405
|
+
}
|
|
1406
|
+
var tmp0 = context.o89_1;
|
|
1407
|
+
var tmp2_0 = context.n89_1;
|
|
1408
|
+
// Inline function 'kotlin.collections.set' call
|
|
1409
|
+
var value_0 = new JsonObject(schema);
|
|
1410
|
+
tmp0.r2(tmp2_0, value_0);
|
|
1411
|
+
}
|
|
1412
|
+
if (context.n89_1.qw()) {
|
|
1413
|
+
// Inline function 'kotlinx.serialization.json.buildJsonArray' call
|
|
1414
|
+
var builder_0 = new JsonArrayBuilder();
|
|
1415
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1416
|
+
var builder_1 = new JsonObjectBuilder();
|
|
1417
|
+
put(builder_1, '$ref', '#/$defs/' + context.n89_1.fw());
|
|
1418
|
+
var tmp$ret$5 = builder_1.s1i();
|
|
1419
|
+
builder_0.i1k(tmp$ret$5);
|
|
1420
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1421
|
+
var builder_2 = new JsonObjectBuilder();
|
|
1422
|
+
builder_2.g1k('type', JsonPrimitive_0('null'));
|
|
1423
|
+
var tmp$ret$7 = builder_2.s1i();
|
|
1424
|
+
builder_0.i1k(tmp$ret$7);
|
|
1425
|
+
var tmp$ret$9 = builder_0.s1i();
|
|
1426
|
+
builder.g1k('oneOf', tmp$ret$9);
|
|
1427
|
+
} else {
|
|
1428
|
+
put(builder, '$ref', '#/$defs/' + context.n89_1.fw());
|
|
1429
|
+
}
|
|
1430
|
+
this.k89(builder, context.s89_1);
|
|
1431
|
+
return builder.s1i();
|
|
1432
|
+
};
|
|
1433
|
+
protoOf(StandardJsonSchemaGenerator).l89 = function (context) {
|
|
1434
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1435
|
+
var builder = new JsonObjectBuilder();
|
|
1436
|
+
var classDiscriminatorMode = context.m89_1.f1h_1.j1j_1;
|
|
1437
|
+
var classDiscriminator = context.m89_1.f1h_1.c1j_1;
|
|
1438
|
+
// Inline function 'kotlinx.serialization.json.buildJsonArray' call
|
|
1439
|
+
var builder_0 = new JsonArrayBuilder();
|
|
1440
|
+
// Inline function 'kotlin.collections.forEach' call
|
|
1441
|
+
var _iterator__ex2g4s = getPolymorphicDescriptors_0(context.n89_1, context.m89_1).p();
|
|
1442
|
+
while (_iterator__ex2g4s.q()) {
|
|
1443
|
+
var element = _iterator__ex2g4s.r();
|
|
1444
|
+
this.i89(context.t89(VOID, element));
|
|
1445
|
+
var tmp0_safe_receiver = context.o89_1.j2(element);
|
|
1446
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toMutableMap(tmp0_safe_receiver);
|
|
1447
|
+
if (tmp1_safe_receiver == null)
|
|
1448
|
+
null;
|
|
1449
|
+
else {
|
|
1450
|
+
// Inline function 'kotlin.let' call
|
|
1451
|
+
if (listOf([ClassDiscriminatorMode_ALL_JSON_OBJECTS_getInstance(), ClassDiscriminatorMode_POLYMORPHIC_getInstance()]).w(classDiscriminatorMode)) {
|
|
1452
|
+
var updatedProperties = toMutableMap(get_jsonObject(getValue(tmp1_safe_receiver, 'properties')));
|
|
1453
|
+
// Inline function 'kotlin.collections.set' call
|
|
1454
|
+
var value = this.y89(context.t89(VOID, element));
|
|
1455
|
+
updatedProperties.r2(classDiscriminator, value);
|
|
1456
|
+
var tmp2 = 'properties';
|
|
1457
|
+
// Inline function 'kotlin.collections.set' call
|
|
1458
|
+
var value_0 = new JsonObject(updatedProperties);
|
|
1459
|
+
tmp1_safe_receiver.r2(tmp2, value_0);
|
|
1460
|
+
var tmp2_0 = 'required';
|
|
1461
|
+
// Inline function 'kotlin.collections.set' call
|
|
1462
|
+
var value_1 = new JsonArray(distinct(plus(toList(get_jsonArray(getValue(tmp1_safe_receiver, 'required'))), JsonPrimitive_0(classDiscriminator))));
|
|
1463
|
+
tmp1_safe_receiver.r2(tmp2_0, value_1);
|
|
1464
|
+
}
|
|
1465
|
+
var tmp0 = context.o89_1;
|
|
1466
|
+
// Inline function 'kotlin.collections.set' call
|
|
1467
|
+
var value_2 = new JsonObject(tmp1_safe_receiver);
|
|
1468
|
+
tmp0.r2(element, value_2);
|
|
1469
|
+
}
|
|
1470
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1471
|
+
var builder_1 = new JsonObjectBuilder();
|
|
1472
|
+
put(builder_1, '$ref', '#/$defs/' + element.fw());
|
|
1473
|
+
var tmp$ret$7 = builder_1.s1i();
|
|
1474
|
+
builder_0.i1k(tmp$ret$7);
|
|
1475
|
+
}
|
|
1476
|
+
if (context.n89_1.qw()) {
|
|
1477
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1478
|
+
var builder_2 = new JsonObjectBuilder();
|
|
1479
|
+
builder_2.g1k('type', JsonPrimitive_0('null'));
|
|
1480
|
+
var tmp$ret$11 = builder_2.s1i();
|
|
1481
|
+
builder_0.i1k(tmp$ret$11);
|
|
1482
|
+
}
|
|
1483
|
+
var tmp$ret$13 = builder_0.s1i();
|
|
1484
|
+
builder.g1k('oneOf', tmp$ret$13);
|
|
1485
|
+
this.k89(builder, context.s89_1);
|
|
1486
|
+
return builder.s1i();
|
|
1487
|
+
};
|
|
1488
|
+
protoOf(StandardJsonSchemaGenerator).y89 = function (context) {
|
|
1489
|
+
// Inline function 'kotlinx.serialization.json.buildJsonObject' call
|
|
1490
|
+
var builder = new JsonObjectBuilder();
|
|
1491
|
+
put(builder, 'const', context.n89_1.fw());
|
|
1492
|
+
return builder.s1i();
|
|
1493
|
+
};
|
|
1494
|
+
//region block: init
|
|
1495
|
+
StructuredOutputPrompts_instance = new StructuredOutputPrompts();
|
|
1496
|
+
//endregion
|
|
1497
|
+
//region block: exports
|
|
1498
|
+
_.$_$ = _.$_$ || {};
|
|
1499
|
+
_.$_$.a = BasicJsonSchemaGenerator;
|
|
1500
|
+
_.$_$.b = StandardJsonSchemaGenerator;
|
|
1501
|
+
_.$_$.c = countElements;
|
|
1502
|
+
_.$_$.d = get_RegisteredBasicJsonSchemaGenerators;
|
|
1503
|
+
_.$_$.e = get_RegisteredStandardJsonSchemaGenerators;
|
|
1504
|
+
_.$_$.f = Manual;
|
|
1505
|
+
_.$_$.g = StructuredOutputConfig;
|
|
1506
|
+
_.$_$.h = executeStructured;
|
|
1507
|
+
_.$_$.i = Default_getInstance_0;
|
|
1508
|
+
_.$_$.j = Companion_getInstance_0;
|
|
1509
|
+
//endregion
|
|
1510
|
+
return _;
|
|
1511
|
+
}));
|
|
1512
|
+
|
|
1513
|
+
//# sourceMappingURL=koog-prompt-prompt-structure.js.map
|