@agentica/core 0.27.3 → 0.29.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 +17 -2
- package/lib/Agentica.d.ts +2 -1
- package/lib/Agentica.js +92 -60
- package/lib/Agentica.js.map +1 -1
- package/lib/MicroAgentica.d.ts +1 -0
- package/lib/MicroAgentica.js +88 -60
- package/lib/MicroAgentica.js.map +1 -1
- package/lib/constants/AgenticaDefaultPrompt.js +2 -18
- package/lib/constants/AgenticaDefaultPrompt.js.map +1 -1
- package/lib/context/AgenticaContext.d.ts +1 -1
- package/lib/context/MicroAgenticaContext.d.ts +2 -2
- package/lib/context/internal/AgenticaOperationComposer.spec.js +0 -2
- package/lib/context/internal/AgenticaOperationComposer.spec.js.map +1 -1
- package/lib/events/AgenticaEventBase.d.ts +9 -0
- package/lib/factory/events.d.ts +1 -2
- package/lib/factory/events.js +71 -7
- package/lib/factory/events.js.map +1 -1
- package/lib/factory/histories.js +27 -9
- package/lib/factory/histories.js.map +1 -1
- package/lib/histories/AgenticaCancelHistory.d.ts +1 -2
- package/lib/histories/AgenticaExecuteHistory.d.ts +0 -4
- package/lib/histories/AgenticaHistoryBase.d.ts +9 -0
- package/lib/histories/AgenticaSelectHistory.d.ts +1 -2
- package/lib/index.mjs +415 -731
- package/lib/index.mjs.map +1 -1
- package/lib/json/IAgenticaEventJson.d.ts +9 -1
- package/lib/json/IAgenticaHistoryJson.d.ts +11 -14
- package/lib/orchestrate/call.d.ts +2 -2
- package/lib/orchestrate/call.js +43 -72
- package/lib/orchestrate/call.js.map +1 -1
- package/lib/orchestrate/cancel.d.ts +1 -2
- package/lib/orchestrate/cancel.js +14 -39
- package/lib/orchestrate/cancel.js.map +1 -1
- package/lib/orchestrate/describe.d.ts +1 -2
- package/lib/orchestrate/describe.js +5 -17
- package/lib/orchestrate/describe.js.map +1 -1
- package/lib/orchestrate/execute.d.ts +1 -2
- package/lib/orchestrate/execute.js +9 -13
- package/lib/orchestrate/execute.js.map +1 -1
- package/lib/orchestrate/initialize.d.ts +1 -2
- package/lib/orchestrate/initialize.js +4 -12
- package/lib/orchestrate/initialize.js.map +1 -1
- package/lib/orchestrate/internal/{cancelFunction.js → cancelFunctionFromContext.js} +7 -7
- package/lib/orchestrate/internal/cancelFunctionFromContext.js.map +1 -0
- package/lib/orchestrate/internal/selectFunctionFromContext.js +24 -0
- package/lib/orchestrate/internal/selectFunctionFromContext.js.map +1 -0
- package/lib/orchestrate/select.d.ts +1 -2
- package/lib/orchestrate/select.js +21 -52
- package/lib/orchestrate/select.js.map +1 -1
- package/lib/structures/IAgenticaConfig.d.ts +1 -3
- package/lib/structures/IAgenticaExecutor.d.ts +6 -7
- package/lib/structures/IAgenticaVendor.d.ts +14 -0
- package/lib/structures/IMicroAgenticaExecutor.d.ts +2 -3
- package/lib/transformers/transformHistory.js +13 -8
- package/lib/transformers/transformHistory.js.map +1 -1
- package/lib/utils/ChatGptCompletionMessageUtil.js +5 -353
- package/lib/utils/ChatGptCompletionMessageUtil.js.map +1 -1
- package/package.json +9 -7
- package/src/Agentica.ts +127 -87
- package/src/MicroAgentica.ts +118 -81
- package/src/constants/AgenticaDefaultPrompt.ts +3 -20
- package/src/context/AgenticaContext.ts +1 -1
- package/src/context/MicroAgenticaContext.ts +2 -2
- package/src/context/internal/AgenticaOperationComposer.spec.ts +1 -2
- package/src/events/AgenticaEventBase.ts +12 -0
- package/src/factory/events.ts +78 -8
- package/src/factory/histories.ts +41 -11
- package/src/histories/AgenticaCancelHistory.ts +1 -2
- package/src/histories/AgenticaExecuteHistory.ts +0 -5
- package/src/histories/AgenticaHistoryBase.ts +12 -0
- package/src/histories/AgenticaSelectHistory.ts +1 -2
- package/src/json/IAgenticaEventJson.ts +11 -1
- package/src/json/IAgenticaHistoryJson.ts +14 -17
- package/src/orchestrate/call.ts +59 -109
- package/src/orchestrate/cancel.ts +77 -100
- package/src/orchestrate/describe.ts +16 -36
- package/src/orchestrate/execute.ts +17 -37
- package/src/orchestrate/initialize.ts +37 -50
- package/src/orchestrate/internal/{cancelFunction.ts → cancelFunctionFromContext.ts} +11 -11
- package/src/orchestrate/internal/{selectFunction.ts → selectFunctionFromContext.ts} +18 -13
- package/src/orchestrate/select.ts +113 -152
- package/src/structures/IAgenticaConfig.ts +1 -3
- package/src/structures/IAgenticaExecutor.ts +10 -8
- package/src/structures/IAgenticaVendor.ts +15 -0
- package/src/structures/IMicroAgenticaExecutor.ts +2 -3
- package/src/transformers/transformHistory.ts +19 -20
- package/src/utils/ChatGptCompletionMessageUtil.ts +5 -6
- package/lib/orchestrate/internal/cancelFunction.js.map +0 -1
- package/lib/orchestrate/internal/selectFunction.js +0 -35
- package/lib/orchestrate/internal/selectFunction.js.map +0 -1
- /package/lib/orchestrate/internal/{cancelFunction.d.ts → cancelFunctionFromContext.d.ts} +0 -0
- /package/lib/orchestrate/internal/{selectFunction.d.ts → selectFunctionFromContext.d.ts} +0 -0
|
@@ -1,364 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.ChatGptCompletionMessageUtil = void 0;
|
|
40
|
-
|
|
41
|
-
const typia_1 = __importDefault(require("typia"));
|
|
4
|
+
// import typia from "typia";
|
|
42
5
|
const ByteArrayUtil_1 = require("./ByteArrayUtil");
|
|
43
6
|
const ChatGptTokenUsageAggregator_1 = require("./ChatGptTokenUsageAggregator");
|
|
44
7
|
function transformCompletionChunk(source) {
|
|
45
8
|
const str = source instanceof Uint8Array ? ByteArrayUtil_1.ByteArrayUtil.toUtf8(source) : source;
|
|
46
9
|
const result = JSON.parse(str);
|
|
47
|
-
const valid =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}), (Array.isArray(input.choices) || _report(_exceptionable, {
|
|
52
|
-
path: _path + ".choices",
|
|
53
|
-
expected: "Array<ChatCompletionChunk.Choice>",
|
|
54
|
-
value: input.choices
|
|
55
|
-
})) && input.choices.map((elem, _index8) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
56
|
-
path: _path + ".choices[" + _index8 + "]",
|
|
57
|
-
expected: "ChatCompletionChunk.Choice",
|
|
58
|
-
value: elem
|
|
59
|
-
})) && _vo1(elem, _path + ".choices[" + _index8 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
60
|
-
path: _path + ".choices[" + _index8 + "]",
|
|
61
|
-
expected: "ChatCompletionChunk.Choice",
|
|
62
|
-
value: elem
|
|
63
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
64
|
-
path: _path + ".choices",
|
|
65
|
-
expected: "Array<ChatCompletionChunk.Choice>",
|
|
66
|
-
value: input.choices
|
|
67
|
-
}), "number" === typeof input.created || _report(_exceptionable, {
|
|
68
|
-
path: _path + ".created",
|
|
69
|
-
expected: "number",
|
|
70
|
-
value: input.created
|
|
71
|
-
}), "string" === typeof input.model || _report(_exceptionable, {
|
|
72
|
-
path: _path + ".model",
|
|
73
|
-
expected: "string",
|
|
74
|
-
value: input.model
|
|
75
|
-
}), "chat.completion.chunk" === input.object || _report(_exceptionable, {
|
|
76
|
-
path: _path + ".object",
|
|
77
|
-
expected: "\"chat.completion.chunk\"",
|
|
78
|
-
value: input.object
|
|
79
|
-
}), null === input.service_tier || undefined === input.service_tier || "scale" === input.service_tier || "default" === input.service_tier || _report(_exceptionable, {
|
|
80
|
-
path: _path + ".service_tier",
|
|
81
|
-
expected: "(\"default\" | \"scale\" | null | undefined)",
|
|
82
|
-
value: input.service_tier
|
|
83
|
-
}), undefined === input.system_fingerprint || "string" === typeof input.system_fingerprint || _report(_exceptionable, {
|
|
84
|
-
path: _path + ".system_fingerprint",
|
|
85
|
-
expected: "(string | undefined)",
|
|
86
|
-
value: input.system_fingerprint
|
|
87
|
-
}), null === input.usage || undefined === input.usage || ("object" === typeof input.usage && null !== input.usage || _report(_exceptionable, {
|
|
88
|
-
path: _path + ".usage",
|
|
89
|
-
expected: "(CompletionUsage | null | undefined)",
|
|
90
|
-
value: input.usage
|
|
91
|
-
})) && _vo9(input.usage, _path + ".usage", true && _exceptionable) || _report(_exceptionable, {
|
|
92
|
-
path: _path + ".usage",
|
|
93
|
-
expected: "(CompletionUsage | null | undefined)",
|
|
94
|
-
value: input.usage
|
|
95
|
-
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [("object" === typeof input.delta && null !== input.delta && false === Array.isArray(input.delta) || _report(_exceptionable, {
|
|
96
|
-
path: _path + ".delta",
|
|
97
|
-
expected: "ChatCompletionChunk.Choice.Delta",
|
|
98
|
-
value: input.delta
|
|
99
|
-
})) && _vo2(input.delta, _path + ".delta", true && _exceptionable) || _report(_exceptionable, {
|
|
100
|
-
path: _path + ".delta",
|
|
101
|
-
expected: "ChatCompletionChunk.Choice.Delta",
|
|
102
|
-
value: input.delta
|
|
103
|
-
}), null === input.finish_reason || "length" === input.finish_reason || "function_call" === input.finish_reason || "stop" === input.finish_reason || "tool_calls" === input.finish_reason || "content_filter" === input.finish_reason || _report(_exceptionable, {
|
|
104
|
-
path: _path + ".finish_reason",
|
|
105
|
-
expected: "(\"content_filter\" | \"function_call\" | \"length\" | \"stop\" | \"tool_calls\" | null)",
|
|
106
|
-
value: input.finish_reason
|
|
107
|
-
}), "number" === typeof input.index || _report(_exceptionable, {
|
|
108
|
-
path: _path + ".index",
|
|
109
|
-
expected: "number",
|
|
110
|
-
value: input.index
|
|
111
|
-
}), null === input.logprobs || undefined === input.logprobs || ("object" === typeof input.logprobs && null !== input.logprobs || _report(_exceptionable, {
|
|
112
|
-
path: _path + ".logprobs",
|
|
113
|
-
expected: "(ChatCompletionChunk.Choice.Logprobs | null | undefined)",
|
|
114
|
-
value: input.logprobs
|
|
115
|
-
})) && _vo6(input.logprobs, _path + ".logprobs", true && _exceptionable) || _report(_exceptionable, {
|
|
116
|
-
path: _path + ".logprobs",
|
|
117
|
-
expected: "(ChatCompletionChunk.Choice.Logprobs | null | undefined)",
|
|
118
|
-
value: input.logprobs
|
|
119
|
-
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => [null === input.content || undefined === input.content || "string" === typeof input.content || _report(_exceptionable, {
|
|
120
|
-
path: _path + ".content",
|
|
121
|
-
expected: "(null | string | undefined)",
|
|
122
|
-
value: input.content
|
|
123
|
-
}), undefined === input.function_call || ("object" === typeof input.function_call && null !== input.function_call && false === Array.isArray(input.function_call) || _report(_exceptionable, {
|
|
124
|
-
path: _path + ".function_call",
|
|
125
|
-
expected: "(ChatCompletionChunk.Choice.Delta.FunctionCall | undefined)",
|
|
126
|
-
value: input.function_call
|
|
127
|
-
})) && _vo3(input.function_call, _path + ".function_call", true && _exceptionable) || _report(_exceptionable, {
|
|
128
|
-
path: _path + ".function_call",
|
|
129
|
-
expected: "(ChatCompletionChunk.Choice.Delta.FunctionCall | undefined)",
|
|
130
|
-
value: input.function_call
|
|
131
|
-
}), null === input.refusal || undefined === input.refusal || "string" === typeof input.refusal || _report(_exceptionable, {
|
|
132
|
-
path: _path + ".refusal",
|
|
133
|
-
expected: "(null | string | undefined)",
|
|
134
|
-
value: input.refusal
|
|
135
|
-
}), undefined === input.role || "user" === input.role || "developer" === input.role || "system" === input.role || "assistant" === input.role || "tool" === input.role || _report(_exceptionable, {
|
|
136
|
-
path: _path + ".role",
|
|
137
|
-
expected: "(\"assistant\" | \"developer\" | \"system\" | \"tool\" | \"user\" | undefined)",
|
|
138
|
-
value: input.role
|
|
139
|
-
}), undefined === input.tool_calls || (Array.isArray(input.tool_calls) || _report(_exceptionable, {
|
|
140
|
-
path: _path + ".tool_calls",
|
|
141
|
-
expected: "(Array<ChatCompletionChunk.Choice.Delta.ToolCall> | undefined)",
|
|
142
|
-
value: input.tool_calls
|
|
143
|
-
})) && input.tool_calls.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
144
|
-
path: _path + ".tool_calls[" + _index9 + "]",
|
|
145
|
-
expected: "ChatCompletionChunk.Choice.Delta.ToolCall",
|
|
146
|
-
value: elem
|
|
147
|
-
})) && _vo4(elem, _path + ".tool_calls[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
148
|
-
path: _path + ".tool_calls[" + _index9 + "]",
|
|
149
|
-
expected: "ChatCompletionChunk.Choice.Delta.ToolCall",
|
|
150
|
-
value: elem
|
|
151
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
152
|
-
path: _path + ".tool_calls",
|
|
153
|
-
expected: "(Array<ChatCompletionChunk.Choice.Delta.ToolCall> | undefined)",
|
|
154
|
-
value: input.tool_calls
|
|
155
|
-
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => [undefined === input.arguments || "string" === typeof input.arguments || _report(_exceptionable, {
|
|
156
|
-
path: _path + ".arguments",
|
|
157
|
-
expected: "(string | undefined)",
|
|
158
|
-
value: input.arguments
|
|
159
|
-
}), undefined === input.name || "string" === typeof input.name || _report(_exceptionable, {
|
|
160
|
-
path: _path + ".name",
|
|
161
|
-
expected: "(string | undefined)",
|
|
162
|
-
value: input.name
|
|
163
|
-
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["number" === typeof input.index || _report(_exceptionable, {
|
|
164
|
-
path: _path + ".index",
|
|
165
|
-
expected: "number",
|
|
166
|
-
value: input.index
|
|
167
|
-
}), undefined === input.id || "string" === typeof input.id || _report(_exceptionable, {
|
|
168
|
-
path: _path + ".id",
|
|
169
|
-
expected: "(string | undefined)",
|
|
170
|
-
value: input.id
|
|
171
|
-
}), undefined === input["function"] || ("object" === typeof input["function"] && null !== input["function"] && false === Array.isArray(input["function"]) || _report(_exceptionable, {
|
|
172
|
-
path: _path + "[\"function\"]",
|
|
173
|
-
expected: "(ChatCompletionChunk.Choice.Delta.ToolCall.Function | undefined)",
|
|
174
|
-
value: input["function"]
|
|
175
|
-
})) && _vo5(input["function"], _path + "[\"function\"]", true && _exceptionable) || _report(_exceptionable, {
|
|
176
|
-
path: _path + "[\"function\"]",
|
|
177
|
-
expected: "(ChatCompletionChunk.Choice.Delta.ToolCall.Function | undefined)",
|
|
178
|
-
value: input["function"]
|
|
179
|
-
}), undefined === input.type || "function" === input.type || _report(_exceptionable, {
|
|
180
|
-
path: _path + ".type",
|
|
181
|
-
expected: "(\"function\" | undefined)",
|
|
182
|
-
value: input.type
|
|
183
|
-
})].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => [undefined === input.arguments || "string" === typeof input.arguments || _report(_exceptionable, {
|
|
184
|
-
path: _path + ".arguments",
|
|
185
|
-
expected: "(string | undefined)",
|
|
186
|
-
value: input.arguments
|
|
187
|
-
}), undefined === input.name || "string" === typeof input.name || _report(_exceptionable, {
|
|
188
|
-
path: _path + ".name",
|
|
189
|
-
expected: "(string | undefined)",
|
|
190
|
-
value: input.name
|
|
191
|
-
})].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => [null === input.content || (Array.isArray(input.content) || _report(_exceptionable, {
|
|
192
|
-
path: _path + ".content",
|
|
193
|
-
expected: "(Array<ChatCompletionTokenLogprob> | null)",
|
|
194
|
-
value: input.content
|
|
195
|
-
})) && input.content.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
196
|
-
path: _path + ".content[" + _index10 + "]",
|
|
197
|
-
expected: "ChatCompletionTokenLogprob",
|
|
198
|
-
value: elem
|
|
199
|
-
})) && _vo7(elem, _path + ".content[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
200
|
-
path: _path + ".content[" + _index10 + "]",
|
|
201
|
-
expected: "ChatCompletionTokenLogprob",
|
|
202
|
-
value: elem
|
|
203
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
204
|
-
path: _path + ".content",
|
|
205
|
-
expected: "(Array<ChatCompletionTokenLogprob> | null)",
|
|
206
|
-
value: input.content
|
|
207
|
-
}), null === input.refusal || (Array.isArray(input.refusal) || _report(_exceptionable, {
|
|
208
|
-
path: _path + ".refusal",
|
|
209
|
-
expected: "(Array<ChatCompletionTokenLogprob> | null)",
|
|
210
|
-
value: input.refusal
|
|
211
|
-
})) && input.refusal.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
212
|
-
path: _path + ".refusal[" + _index11 + "]",
|
|
213
|
-
expected: "ChatCompletionTokenLogprob",
|
|
214
|
-
value: elem
|
|
215
|
-
})) && _vo7(elem, _path + ".refusal[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
216
|
-
path: _path + ".refusal[" + _index11 + "]",
|
|
217
|
-
expected: "ChatCompletionTokenLogprob",
|
|
218
|
-
value: elem
|
|
219
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
220
|
-
path: _path + ".refusal",
|
|
221
|
-
expected: "(Array<ChatCompletionTokenLogprob> | null)",
|
|
222
|
-
value: input.refusal
|
|
223
|
-
})].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => ["string" === typeof input.token || _report(_exceptionable, {
|
|
224
|
-
path: _path + ".token",
|
|
225
|
-
expected: "string",
|
|
226
|
-
value: input.token
|
|
227
|
-
}), null === input.bytes || (Array.isArray(input.bytes) || _report(_exceptionable, {
|
|
228
|
-
path: _path + ".bytes",
|
|
229
|
-
expected: "(Array<number> | null)",
|
|
230
|
-
value: input.bytes
|
|
231
|
-
})) && input.bytes.map((elem, _index12) => "number" === typeof elem || _report(_exceptionable, {
|
|
232
|
-
path: _path + ".bytes[" + _index12 + "]",
|
|
233
|
-
expected: "number",
|
|
234
|
-
value: elem
|
|
235
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
236
|
-
path: _path + ".bytes",
|
|
237
|
-
expected: "(Array<number> | null)",
|
|
238
|
-
value: input.bytes
|
|
239
|
-
}), "number" === typeof input.logprob || _report(_exceptionable, {
|
|
240
|
-
path: _path + ".logprob",
|
|
241
|
-
expected: "number",
|
|
242
|
-
value: input.logprob
|
|
243
|
-
}), (Array.isArray(input.top_logprobs) || _report(_exceptionable, {
|
|
244
|
-
path: _path + ".top_logprobs",
|
|
245
|
-
expected: "Array<ChatCompletionTokenLogprob.TopLogprob>",
|
|
246
|
-
value: input.top_logprobs
|
|
247
|
-
})) && input.top_logprobs.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
248
|
-
path: _path + ".top_logprobs[" + _index13 + "]",
|
|
249
|
-
expected: "ChatCompletionTokenLogprob.TopLogprob",
|
|
250
|
-
value: elem
|
|
251
|
-
})) && _vo8(elem, _path + ".top_logprobs[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
252
|
-
path: _path + ".top_logprobs[" + _index13 + "]",
|
|
253
|
-
expected: "ChatCompletionTokenLogprob.TopLogprob",
|
|
254
|
-
value: elem
|
|
255
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
256
|
-
path: _path + ".top_logprobs",
|
|
257
|
-
expected: "Array<ChatCompletionTokenLogprob.TopLogprob>",
|
|
258
|
-
value: input.top_logprobs
|
|
259
|
-
})].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => ["string" === typeof input.token || _report(_exceptionable, {
|
|
260
|
-
path: _path + ".token",
|
|
261
|
-
expected: "string",
|
|
262
|
-
value: input.token
|
|
263
|
-
}), null === input.bytes || (Array.isArray(input.bytes) || _report(_exceptionable, {
|
|
264
|
-
path: _path + ".bytes",
|
|
265
|
-
expected: "(Array<number> | null)",
|
|
266
|
-
value: input.bytes
|
|
267
|
-
})) && input.bytes.map((elem, _index14) => "number" === typeof elem || _report(_exceptionable, {
|
|
268
|
-
path: _path + ".bytes[" + _index14 + "]",
|
|
269
|
-
expected: "number",
|
|
270
|
-
value: elem
|
|
271
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
272
|
-
path: _path + ".bytes",
|
|
273
|
-
expected: "(Array<number> | null)",
|
|
274
|
-
value: input.bytes
|
|
275
|
-
}), "number" === typeof input.logprob || _report(_exceptionable, {
|
|
276
|
-
path: _path + ".logprob",
|
|
277
|
-
expected: "number",
|
|
278
|
-
value: input.logprob
|
|
279
|
-
})].every(flag => flag); const _vo9 = (input, _path, _exceptionable = true) => ["number" === typeof input.completion_tokens || _report(_exceptionable, {
|
|
280
|
-
path: _path + ".completion_tokens",
|
|
281
|
-
expected: "number",
|
|
282
|
-
value: input.completion_tokens
|
|
283
|
-
}), "number" === typeof input.prompt_tokens || _report(_exceptionable, {
|
|
284
|
-
path: _path + ".prompt_tokens",
|
|
285
|
-
expected: "number",
|
|
286
|
-
value: input.prompt_tokens
|
|
287
|
-
}), "number" === typeof input.total_tokens || _report(_exceptionable, {
|
|
288
|
-
path: _path + ".total_tokens",
|
|
289
|
-
expected: "number",
|
|
290
|
-
value: input.total_tokens
|
|
291
|
-
}), undefined === input.completion_tokens_details || ("object" === typeof input.completion_tokens_details && null !== input.completion_tokens_details && false === Array.isArray(input.completion_tokens_details) || _report(_exceptionable, {
|
|
292
|
-
path: _path + ".completion_tokens_details",
|
|
293
|
-
expected: "(CompletionUsage.CompletionTokensDetails | undefined)",
|
|
294
|
-
value: input.completion_tokens_details
|
|
295
|
-
})) && _vo10(input.completion_tokens_details, _path + ".completion_tokens_details", true && _exceptionable) || _report(_exceptionable, {
|
|
296
|
-
path: _path + ".completion_tokens_details",
|
|
297
|
-
expected: "(CompletionUsage.CompletionTokensDetails | undefined)",
|
|
298
|
-
value: input.completion_tokens_details
|
|
299
|
-
}), undefined === input.prompt_tokens_details || ("object" === typeof input.prompt_tokens_details && null !== input.prompt_tokens_details && false === Array.isArray(input.prompt_tokens_details) || _report(_exceptionable, {
|
|
300
|
-
path: _path + ".prompt_tokens_details",
|
|
301
|
-
expected: "(CompletionUsage.PromptTokensDetails | undefined)",
|
|
302
|
-
value: input.prompt_tokens_details
|
|
303
|
-
})) && _vo11(input.prompt_tokens_details, _path + ".prompt_tokens_details", true && _exceptionable) || _report(_exceptionable, {
|
|
304
|
-
path: _path + ".prompt_tokens_details",
|
|
305
|
-
expected: "(CompletionUsage.PromptTokensDetails | undefined)",
|
|
306
|
-
value: input.prompt_tokens_details
|
|
307
|
-
})].every(flag => flag); const _vo10 = (input, _path, _exceptionable = true) => [undefined === input.accepted_prediction_tokens || "number" === typeof input.accepted_prediction_tokens || _report(_exceptionable, {
|
|
308
|
-
path: _path + ".accepted_prediction_tokens",
|
|
309
|
-
expected: "(number | undefined)",
|
|
310
|
-
value: input.accepted_prediction_tokens
|
|
311
|
-
}), undefined === input.audio_tokens || "number" === typeof input.audio_tokens || _report(_exceptionable, {
|
|
312
|
-
path: _path + ".audio_tokens",
|
|
313
|
-
expected: "(number | undefined)",
|
|
314
|
-
value: input.audio_tokens
|
|
315
|
-
}), undefined === input.reasoning_tokens || "number" === typeof input.reasoning_tokens || _report(_exceptionable, {
|
|
316
|
-
path: _path + ".reasoning_tokens",
|
|
317
|
-
expected: "(number | undefined)",
|
|
318
|
-
value: input.reasoning_tokens
|
|
319
|
-
}), undefined === input.rejected_prediction_tokens || "number" === typeof input.rejected_prediction_tokens || _report(_exceptionable, {
|
|
320
|
-
path: _path + ".rejected_prediction_tokens",
|
|
321
|
-
expected: "(number | undefined)",
|
|
322
|
-
value: input.rejected_prediction_tokens
|
|
323
|
-
})].every(flag => flag); const _vo11 = (input, _path, _exceptionable = true) => [undefined === input.audio_tokens || "number" === typeof input.audio_tokens || _report(_exceptionable, {
|
|
324
|
-
path: _path + ".audio_tokens",
|
|
325
|
-
expected: "(number | undefined)",
|
|
326
|
-
value: input.audio_tokens
|
|
327
|
-
}), undefined === input.cached_tokens || "number" === typeof input.cached_tokens || _report(_exceptionable, {
|
|
328
|
-
path: _path + ".cached_tokens",
|
|
329
|
-
expected: "(number | undefined)",
|
|
330
|
-
value: input.cached_tokens
|
|
331
|
-
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
332
|
-
if (false === __is(input)) {
|
|
333
|
-
errors = [];
|
|
334
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
335
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
336
|
-
path: _path + "",
|
|
337
|
-
expected: "ChatCompletionChunk",
|
|
338
|
-
value: input
|
|
339
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
340
|
-
path: _path + "",
|
|
341
|
-
expected: "ChatCompletionChunk",
|
|
342
|
-
value: input
|
|
343
|
-
}))(input, "$input", true);
|
|
344
|
-
const success = 0 === errors.length;
|
|
345
|
-
return success ? {
|
|
346
|
-
success,
|
|
347
|
-
data: input
|
|
348
|
-
} : {
|
|
349
|
-
success,
|
|
350
|
-
errors,
|
|
351
|
-
data: input
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
return {
|
|
355
|
-
success: true,
|
|
356
|
-
data: input
|
|
357
|
-
};
|
|
358
|
-
}; })()(result);
|
|
359
|
-
if (valid.success === false) {
|
|
360
|
-
console.error("Invalid ChatCompletionChunk", valid.errors);
|
|
361
|
-
}
|
|
10
|
+
// const valid = typia.validate<ChatCompletionChunk>(result);
|
|
11
|
+
// if (valid.success === false) {
|
|
12
|
+
// console.error("Invalid ChatCompletionChunk", valid.errors);
|
|
13
|
+
// }
|
|
362
14
|
return result;
|
|
363
15
|
}
|
|
364
16
|
function accumulate(origin, chunk) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatGptCompletionMessageUtil.js","sourceRoot":"","sources":["../../src/utils/ChatGptCompletionMessageUtil.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatGptCompletionMessageUtil.js","sourceRoot":"","sources":["../../src/utils/ChatGptCompletionMessageUtil.ts"],"names":[],"mappings":";;;AAOA,6BAA6B;AAC7B,mDAAgD;AAChD,+EAA4E;AAE5E,SAAS,wBAAwB,CAAC,MAA2B;IAC3D,MAAM,GAAG,GACH,MAAM,YAAY,UAAU,CAAC,CAAC,CAAC,6BAAa,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC3E,MAAM,MAAM,GAAwB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAwB,CAAC;IAC3E,6DAA6D;IAC7D,iCAAiC;IACjC,gEAAgE;IAChE,IAAI;IACJ,OAAO,MAAM,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+
"version": "0.29.0",
|
|
4
4
|
"description": "Agentic AI Library specialized in LLM Function Calling",
|
|
5
5
|
"author": "Wrtn Technologies",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,29 +36,31 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@samchon/openapi": "^4.3.
|
|
40
|
-
"openai": "^
|
|
39
|
+
"@samchon/openapi": "^4.3.3",
|
|
40
|
+
"openai": "^5.2.0",
|
|
41
41
|
"typia": "^9.3.1"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@samchon/openapi": "^4.3.
|
|
44
|
+
"@samchon/openapi": "^4.3.3",
|
|
45
|
+
"tstl": "^3.0.0",
|
|
45
46
|
"typia": "^9.3.1",
|
|
46
47
|
"uuid": "^11.0.4"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
50
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
50
51
|
"@nestia/e2e": "^6.0.1",
|
|
51
52
|
"@rollup/plugin-terser": "^0.4.4",
|
|
52
53
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
53
|
-
"@ryoppippi/unplugin-typia": "^2.6.
|
|
54
|
+
"@ryoppippi/unplugin-typia": "^2.6.4",
|
|
54
55
|
"@types/node": "^22.13.9",
|
|
55
56
|
"@types/uuid": "^10.0.0",
|
|
56
57
|
"@wrtnlabs/calculator-mcp": "^0.2.1",
|
|
57
|
-
"openai": "^
|
|
58
|
+
"openai": "^5.2.0",
|
|
58
59
|
"rimraf": "^6.0.1",
|
|
59
60
|
"rollup": "^4.34.8",
|
|
60
61
|
"ts-node": "^10.9.2",
|
|
61
62
|
"ts-patch": "^3.3.0",
|
|
63
|
+
"tstl": "^3.0.0",
|
|
62
64
|
"typedoc": "^0.27.7",
|
|
63
65
|
"typescript": "~5.8.3",
|
|
64
66
|
"vitest": "^3.0.9"
|