@agentica/core 0.28.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants/index.d.ts +2 -0
- package/lib/constants/index.js +19 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +6 -355
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/call.js +2 -2
- package/lib/orchestrate/call.js.map +1 -1
- package/lib/orchestrate/cancel.js +1 -1
- package/lib/orchestrate/cancel.js.map +1 -1
- package/lib/orchestrate/initialize.js +1 -1
- package/lib/orchestrate/initialize.js.map +1 -1
- package/lib/orchestrate/select.js +1 -1
- package/lib/orchestrate/select.js.map +1 -1
- package/lib/utils/ChatGptCompletionMessageUtil.js +5 -353
- package/lib/utils/ChatGptCompletionMessageUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/index.ts +2 -0
- package/src/index.ts +1 -0
- package/src/orchestrate/call.ts +2 -2
- package/src/orchestrate/cancel.ts +1 -1
- package/src/orchestrate/initialize.ts +1 -1
- package/src/orchestrate/select.ts +1 -1
- package/src/utils/ChatGptCompletionMessageUtil.ts +5 -6
|
@@ -0,0 +1,19 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AgenticaDefaultPrompt"), exports);
|
|
18
|
+
__exportStar(require("./AgenticaSystemPrompt"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,yDAAuC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -38,6 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.utils = exports.orchestrate = exports.factory = void 0;
|
|
40
40
|
__exportStar(require("./Agentica"), exports);
|
|
41
|
+
__exportStar(require("./constants"), exports);
|
|
41
42
|
__exportStar(require("./context"), exports);
|
|
42
43
|
__exportStar(require("./events"), exports);
|
|
43
44
|
exports.factory = __importStar(require("./factory"));
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAE3B,4CAA0B;AAC1B,2CAAyB;AACzB,qDAAqC;AACrC,+CAA6B;AAC7B,8CAA4B;AAC5B,yCAAuB;AACvB,kDAAgC;AAChC,6DAA6C;AAC7C,+CAA6B;AAE7B;;GAEG;AACH,iDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAE3B,8CAA4B;AAC5B,4CAA0B;AAC1B,2CAAyB;AACzB,qDAAqC;AACrC,+CAA6B;AAC7B,8CAA4B;AAC5B,yCAAuB;AACvB,kDAAgC;AAChC,6DAA6C;AAC7C,+CAA6B;AAE7B;;GAEG;AACH,iDAAiC"}
|
package/lib/index.mjs
CHANGED
|
@@ -846,350 +846,6 @@ const ChatGptTokenUsageAggregator = {
|
|
|
846
846
|
function transformCompletionChunk(source) {
|
|
847
847
|
const str = source instanceof Uint8Array ? ByteArrayUtil.toUtf8(source) : source;
|
|
848
848
|
const result = JSON.parse(str);
|
|
849
|
-
const valid = (() => {
|
|
850
|
-
const _io0 = input => "string" === typeof input.id && (Array.isArray(input.choices) && input.choices.every((elem => "object" === typeof elem && null !== elem && _io1(elem)))) && "number" === typeof input.created && "string" === typeof input.model && "chat.completion.chunk" === input.object && (null === input.service_tier || undefined === input.service_tier || "auto" === input.service_tier || "default" === input.service_tier || "flex" === input.service_tier) && (undefined === input.system_fingerprint || "string" === typeof input.system_fingerprint) && (null === input.usage || undefined === input.usage || "object" === typeof input.usage && null !== input.usage && _io9(input.usage));
|
|
851
|
-
const _io1 = input => "object" === typeof input.delta && null !== input.delta && false === Array.isArray(input.delta) && _io2(input.delta) && (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) && "number" === typeof input.index && (null === input.logprobs || undefined === input.logprobs || "object" === typeof input.logprobs && null !== input.logprobs && _io6(input.logprobs));
|
|
852
|
-
const _io2 = input => (null === input.content || undefined === input.content || "string" === typeof input.content) && (undefined === input.function_call || "object" === typeof input.function_call && null !== input.function_call && false === Array.isArray(input.function_call) && _io3(input.function_call)) && (null === input.refusal || undefined === input.refusal || "string" === typeof input.refusal) && (undefined === input.role || "user" === input.role || "developer" === input.role || "system" === input.role || "assistant" === input.role || "tool" === input.role) && (undefined === input.tool_calls || Array.isArray(input.tool_calls) && input.tool_calls.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
853
|
-
const _io3 = input => (undefined === input.arguments || "string" === typeof input.arguments) && (undefined === input.name || "string" === typeof input.name);
|
|
854
|
-
const _io4 = input => "number" === typeof input.index && (undefined === input.id || "string" === typeof input.id) && (undefined === input["function"] || "object" === typeof input["function"] && null !== input["function"] && false === Array.isArray(input["function"]) && _io5(input["function"])) && (undefined === input.type || "function" === input.type);
|
|
855
|
-
const _io5 = input => (undefined === input.arguments || "string" === typeof input.arguments) && (undefined === input.name || "string" === typeof input.name);
|
|
856
|
-
const _io6 = input => (null === input.content || Array.isArray(input.content) && input.content.every((elem => "object" === typeof elem && null !== elem && _io7(elem)))) && (null === input.refusal || Array.isArray(input.refusal) && input.refusal.every((elem => "object" === typeof elem && null !== elem && _io7(elem))));
|
|
857
|
-
const _io7 = input => "string" === typeof input.token && (null === input.bytes || Array.isArray(input.bytes) && input.bytes.every((elem => "number" === typeof elem))) && "number" === typeof input.logprob && (Array.isArray(input.top_logprobs) && input.top_logprobs.every((elem => "object" === typeof elem && null !== elem && _io8(elem))));
|
|
858
|
-
const _io8 = input => "string" === typeof input.token && (null === input.bytes || Array.isArray(input.bytes) && input.bytes.every((elem => "number" === typeof elem))) && "number" === typeof input.logprob;
|
|
859
|
-
const _io9 = input => "number" === typeof input.completion_tokens && "number" === typeof input.prompt_tokens && "number" === typeof input.total_tokens && (undefined === input.completion_tokens_details || "object" === typeof input.completion_tokens_details && null !== input.completion_tokens_details && false === Array.isArray(input.completion_tokens_details) && _io10(input.completion_tokens_details)) && (undefined === input.prompt_tokens_details || "object" === typeof input.prompt_tokens_details && null !== input.prompt_tokens_details && false === Array.isArray(input.prompt_tokens_details) && _io11(input.prompt_tokens_details));
|
|
860
|
-
const _io10 = input => (undefined === input.accepted_prediction_tokens || "number" === typeof input.accepted_prediction_tokens) && (undefined === input.audio_tokens || "number" === typeof input.audio_tokens) && (undefined === input.reasoning_tokens || "number" === typeof input.reasoning_tokens) && (undefined === input.rejected_prediction_tokens || "number" === typeof input.rejected_prediction_tokens);
|
|
861
|
-
const _io11 = input => (undefined === input.audio_tokens || "number" === typeof input.audio_tokens) && (undefined === input.cached_tokens || "number" === typeof input.cached_tokens);
|
|
862
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.id || _report(_exceptionable, {
|
|
863
|
-
path: _path + ".id",
|
|
864
|
-
expected: "string",
|
|
865
|
-
value: input.id
|
|
866
|
-
}), (Array.isArray(input.choices) || _report(_exceptionable, {
|
|
867
|
-
path: _path + ".choices",
|
|
868
|
-
expected: "Array<ChatCompletionChunk.Choice>",
|
|
869
|
-
value: input.choices
|
|
870
|
-
})) && input.choices.map(((elem, _index8) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
871
|
-
path: _path + ".choices[" + _index8 + "]",
|
|
872
|
-
expected: "ChatCompletionChunk.Choice",
|
|
873
|
-
value: elem
|
|
874
|
-
})) && _vo1(elem, _path + ".choices[" + _index8 + "]", _exceptionable) || _report(_exceptionable, {
|
|
875
|
-
path: _path + ".choices[" + _index8 + "]",
|
|
876
|
-
expected: "ChatCompletionChunk.Choice",
|
|
877
|
-
value: elem
|
|
878
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
879
|
-
path: _path + ".choices",
|
|
880
|
-
expected: "Array<ChatCompletionChunk.Choice>",
|
|
881
|
-
value: input.choices
|
|
882
|
-
}), "number" === typeof input.created || _report(_exceptionable, {
|
|
883
|
-
path: _path + ".created",
|
|
884
|
-
expected: "number",
|
|
885
|
-
value: input.created
|
|
886
|
-
}), "string" === typeof input.model || _report(_exceptionable, {
|
|
887
|
-
path: _path + ".model",
|
|
888
|
-
expected: "string",
|
|
889
|
-
value: input.model
|
|
890
|
-
}), "chat.completion.chunk" === input.object || _report(_exceptionable, {
|
|
891
|
-
path: _path + ".object",
|
|
892
|
-
expected: '"chat.completion.chunk"',
|
|
893
|
-
value: input.object
|
|
894
|
-
}), null === input.service_tier || undefined === input.service_tier || "auto" === input.service_tier || "default" === input.service_tier || "flex" === input.service_tier || _report(_exceptionable, {
|
|
895
|
-
path: _path + ".service_tier",
|
|
896
|
-
expected: '("auto" | "default" | "flex" | null | undefined)',
|
|
897
|
-
value: input.service_tier
|
|
898
|
-
}), undefined === input.system_fingerprint || "string" === typeof input.system_fingerprint || _report(_exceptionable, {
|
|
899
|
-
path: _path + ".system_fingerprint",
|
|
900
|
-
expected: "(string | undefined)",
|
|
901
|
-
value: input.system_fingerprint
|
|
902
|
-
}), null === input.usage || undefined === input.usage || ("object" === typeof input.usage && null !== input.usage || _report(_exceptionable, {
|
|
903
|
-
path: _path + ".usage",
|
|
904
|
-
expected: "(CompletionUsage | null | undefined)",
|
|
905
|
-
value: input.usage
|
|
906
|
-
})) && _vo9(input.usage, _path + ".usage", _exceptionable) || _report(_exceptionable, {
|
|
907
|
-
path: _path + ".usage",
|
|
908
|
-
expected: "(CompletionUsage | null | undefined)",
|
|
909
|
-
value: input.usage
|
|
910
|
-
}) ].every((flag => flag));
|
|
911
|
-
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.delta && null !== input.delta && false === Array.isArray(input.delta) || _report(_exceptionable, {
|
|
912
|
-
path: _path + ".delta",
|
|
913
|
-
expected: "ChatCompletionChunk.Choice.Delta",
|
|
914
|
-
value: input.delta
|
|
915
|
-
})) && _vo2(input.delta, _path + ".delta", _exceptionable) || _report(_exceptionable, {
|
|
916
|
-
path: _path + ".delta",
|
|
917
|
-
expected: "ChatCompletionChunk.Choice.Delta",
|
|
918
|
-
value: input.delta
|
|
919
|
-
}), 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, {
|
|
920
|
-
path: _path + ".finish_reason",
|
|
921
|
-
expected: '("content_filter" | "function_call" | "length" | "stop" | "tool_calls" | null)',
|
|
922
|
-
value: input.finish_reason
|
|
923
|
-
}), "number" === typeof input.index || _report(_exceptionable, {
|
|
924
|
-
path: _path + ".index",
|
|
925
|
-
expected: "number",
|
|
926
|
-
value: input.index
|
|
927
|
-
}), null === input.logprobs || undefined === input.logprobs || ("object" === typeof input.logprobs && null !== input.logprobs || _report(_exceptionable, {
|
|
928
|
-
path: _path + ".logprobs",
|
|
929
|
-
expected: "(ChatCompletionChunk.Choice.Logprobs | null | undefined)",
|
|
930
|
-
value: input.logprobs
|
|
931
|
-
})) && _vo6(input.logprobs, _path + ".logprobs", _exceptionable) || _report(_exceptionable, {
|
|
932
|
-
path: _path + ".logprobs",
|
|
933
|
-
expected: "(ChatCompletionChunk.Choice.Logprobs | null | undefined)",
|
|
934
|
-
value: input.logprobs
|
|
935
|
-
}) ].every((flag => flag));
|
|
936
|
-
const _vo2 = (input, _path, _exceptionable = true) => [ null === input.content || undefined === input.content || "string" === typeof input.content || _report(_exceptionable, {
|
|
937
|
-
path: _path + ".content",
|
|
938
|
-
expected: "(null | string | undefined)",
|
|
939
|
-
value: input.content
|
|
940
|
-
}), undefined === input.function_call || ("object" === typeof input.function_call && null !== input.function_call && false === Array.isArray(input.function_call) || _report(_exceptionable, {
|
|
941
|
-
path: _path + ".function_call",
|
|
942
|
-
expected: "(ChatCompletionChunk.Choice.Delta.FunctionCall | undefined)",
|
|
943
|
-
value: input.function_call
|
|
944
|
-
})) && _vo3(input.function_call, _path + ".function_call", _exceptionable) || _report(_exceptionable, {
|
|
945
|
-
path: _path + ".function_call",
|
|
946
|
-
expected: "(ChatCompletionChunk.Choice.Delta.FunctionCall | undefined)",
|
|
947
|
-
value: input.function_call
|
|
948
|
-
}), null === input.refusal || undefined === input.refusal || "string" === typeof input.refusal || _report(_exceptionable, {
|
|
949
|
-
path: _path + ".refusal",
|
|
950
|
-
expected: "(null | string | undefined)",
|
|
951
|
-
value: input.refusal
|
|
952
|
-
}), undefined === input.role || "user" === input.role || "developer" === input.role || "system" === input.role || "assistant" === input.role || "tool" === input.role || _report(_exceptionable, {
|
|
953
|
-
path: _path + ".role",
|
|
954
|
-
expected: '("assistant" | "developer" | "system" | "tool" | "user" | undefined)',
|
|
955
|
-
value: input.role
|
|
956
|
-
}), undefined === input.tool_calls || (Array.isArray(input.tool_calls) || _report(_exceptionable, {
|
|
957
|
-
path: _path + ".tool_calls",
|
|
958
|
-
expected: "(Array<ChatCompletionChunk.Choice.Delta.ToolCall> | undefined)",
|
|
959
|
-
value: input.tool_calls
|
|
960
|
-
})) && input.tool_calls.map(((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
961
|
-
path: _path + ".tool_calls[" + _index9 + "]",
|
|
962
|
-
expected: "ChatCompletionChunk.Choice.Delta.ToolCall",
|
|
963
|
-
value: elem
|
|
964
|
-
})) && _vo4(elem, _path + ".tool_calls[" + _index9 + "]", _exceptionable) || _report(_exceptionable, {
|
|
965
|
-
path: _path + ".tool_calls[" + _index9 + "]",
|
|
966
|
-
expected: "ChatCompletionChunk.Choice.Delta.ToolCall",
|
|
967
|
-
value: elem
|
|
968
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
969
|
-
path: _path + ".tool_calls",
|
|
970
|
-
expected: "(Array<ChatCompletionChunk.Choice.Delta.ToolCall> | undefined)",
|
|
971
|
-
value: input.tool_calls
|
|
972
|
-
}) ].every((flag => flag));
|
|
973
|
-
const _vo3 = (input, _path, _exceptionable = true) => [ undefined === input.arguments || "string" === typeof input.arguments || _report(_exceptionable, {
|
|
974
|
-
path: _path + ".arguments",
|
|
975
|
-
expected: "(string | undefined)",
|
|
976
|
-
value: input.arguments
|
|
977
|
-
}), undefined === input.name || "string" === typeof input.name || _report(_exceptionable, {
|
|
978
|
-
path: _path + ".name",
|
|
979
|
-
expected: "(string | undefined)",
|
|
980
|
-
value: input.name
|
|
981
|
-
}) ].every((flag => flag));
|
|
982
|
-
const _vo4 = (input, _path, _exceptionable = true) => [ "number" === typeof input.index || _report(_exceptionable, {
|
|
983
|
-
path: _path + ".index",
|
|
984
|
-
expected: "number",
|
|
985
|
-
value: input.index
|
|
986
|
-
}), undefined === input.id || "string" === typeof input.id || _report(_exceptionable, {
|
|
987
|
-
path: _path + ".id",
|
|
988
|
-
expected: "(string | undefined)",
|
|
989
|
-
value: input.id
|
|
990
|
-
}), undefined === input["function"] || ("object" === typeof input["function"] && null !== input["function"] && false === Array.isArray(input["function"]) || _report(_exceptionable, {
|
|
991
|
-
path: _path + '["function"]',
|
|
992
|
-
expected: "(ChatCompletionChunk.Choice.Delta.ToolCall.Function | undefined)",
|
|
993
|
-
value: input["function"]
|
|
994
|
-
})) && _vo5(input["function"], _path + '["function"]', _exceptionable) || _report(_exceptionable, {
|
|
995
|
-
path: _path + '["function"]',
|
|
996
|
-
expected: "(ChatCompletionChunk.Choice.Delta.ToolCall.Function | undefined)",
|
|
997
|
-
value: input["function"]
|
|
998
|
-
}), undefined === input.type || "function" === input.type || _report(_exceptionable, {
|
|
999
|
-
path: _path + ".type",
|
|
1000
|
-
expected: '("function" | undefined)',
|
|
1001
|
-
value: input.type
|
|
1002
|
-
}) ].every((flag => flag));
|
|
1003
|
-
const _vo5 = (input, _path, _exceptionable = true) => [ undefined === input.arguments || "string" === typeof input.arguments || _report(_exceptionable, {
|
|
1004
|
-
path: _path + ".arguments",
|
|
1005
|
-
expected: "(string | undefined)",
|
|
1006
|
-
value: input.arguments
|
|
1007
|
-
}), undefined === input.name || "string" === typeof input.name || _report(_exceptionable, {
|
|
1008
|
-
path: _path + ".name",
|
|
1009
|
-
expected: "(string | undefined)",
|
|
1010
|
-
value: input.name
|
|
1011
|
-
}) ].every((flag => flag));
|
|
1012
|
-
const _vo6 = (input, _path, _exceptionable = true) => [ null === input.content || (Array.isArray(input.content) || _report(_exceptionable, {
|
|
1013
|
-
path: _path + ".content",
|
|
1014
|
-
expected: "(Array<ChatCompletionTokenLogprob> | null)",
|
|
1015
|
-
value: input.content
|
|
1016
|
-
})) && input.content.map(((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1017
|
-
path: _path + ".content[" + _index10 + "]",
|
|
1018
|
-
expected: "ChatCompletionTokenLogprob",
|
|
1019
|
-
value: elem
|
|
1020
|
-
})) && _vo7(elem, _path + ".content[" + _index10 + "]", _exceptionable) || _report(_exceptionable, {
|
|
1021
|
-
path: _path + ".content[" + _index10 + "]",
|
|
1022
|
-
expected: "ChatCompletionTokenLogprob",
|
|
1023
|
-
value: elem
|
|
1024
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
1025
|
-
path: _path + ".content",
|
|
1026
|
-
expected: "(Array<ChatCompletionTokenLogprob> | null)",
|
|
1027
|
-
value: input.content
|
|
1028
|
-
}), null === input.refusal || (Array.isArray(input.refusal) || _report(_exceptionable, {
|
|
1029
|
-
path: _path + ".refusal",
|
|
1030
|
-
expected: "(Array<ChatCompletionTokenLogprob> | null)",
|
|
1031
|
-
value: input.refusal
|
|
1032
|
-
})) && input.refusal.map(((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1033
|
-
path: _path + ".refusal[" + _index11 + "]",
|
|
1034
|
-
expected: "ChatCompletionTokenLogprob",
|
|
1035
|
-
value: elem
|
|
1036
|
-
})) && _vo7(elem, _path + ".refusal[" + _index11 + "]", _exceptionable) || _report(_exceptionable, {
|
|
1037
|
-
path: _path + ".refusal[" + _index11 + "]",
|
|
1038
|
-
expected: "ChatCompletionTokenLogprob",
|
|
1039
|
-
value: elem
|
|
1040
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
1041
|
-
path: _path + ".refusal",
|
|
1042
|
-
expected: "(Array<ChatCompletionTokenLogprob> | null)",
|
|
1043
|
-
value: input.refusal
|
|
1044
|
-
}) ].every((flag => flag));
|
|
1045
|
-
const _vo7 = (input, _path, _exceptionable = true) => [ "string" === typeof input.token || _report(_exceptionable, {
|
|
1046
|
-
path: _path + ".token",
|
|
1047
|
-
expected: "string",
|
|
1048
|
-
value: input.token
|
|
1049
|
-
}), null === input.bytes || (Array.isArray(input.bytes) || _report(_exceptionable, {
|
|
1050
|
-
path: _path + ".bytes",
|
|
1051
|
-
expected: "(Array<number> | null)",
|
|
1052
|
-
value: input.bytes
|
|
1053
|
-
})) && input.bytes.map(((elem, _index12) => "number" === typeof elem || _report(_exceptionable, {
|
|
1054
|
-
path: _path + ".bytes[" + _index12 + "]",
|
|
1055
|
-
expected: "number",
|
|
1056
|
-
value: elem
|
|
1057
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
1058
|
-
path: _path + ".bytes",
|
|
1059
|
-
expected: "(Array<number> | null)",
|
|
1060
|
-
value: input.bytes
|
|
1061
|
-
}), "number" === typeof input.logprob || _report(_exceptionable, {
|
|
1062
|
-
path: _path + ".logprob",
|
|
1063
|
-
expected: "number",
|
|
1064
|
-
value: input.logprob
|
|
1065
|
-
}), (Array.isArray(input.top_logprobs) || _report(_exceptionable, {
|
|
1066
|
-
path: _path + ".top_logprobs",
|
|
1067
|
-
expected: "Array<ChatCompletionTokenLogprob.TopLogprob>",
|
|
1068
|
-
value: input.top_logprobs
|
|
1069
|
-
})) && input.top_logprobs.map(((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1070
|
-
path: _path + ".top_logprobs[" + _index13 + "]",
|
|
1071
|
-
expected: "ChatCompletionTokenLogprob.TopLogprob",
|
|
1072
|
-
value: elem
|
|
1073
|
-
})) && _vo8(elem, _path + ".top_logprobs[" + _index13 + "]", _exceptionable) || _report(_exceptionable, {
|
|
1074
|
-
path: _path + ".top_logprobs[" + _index13 + "]",
|
|
1075
|
-
expected: "ChatCompletionTokenLogprob.TopLogprob",
|
|
1076
|
-
value: elem
|
|
1077
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
1078
|
-
path: _path + ".top_logprobs",
|
|
1079
|
-
expected: "Array<ChatCompletionTokenLogprob.TopLogprob>",
|
|
1080
|
-
value: input.top_logprobs
|
|
1081
|
-
}) ].every((flag => flag));
|
|
1082
|
-
const _vo8 = (input, _path, _exceptionable = true) => [ "string" === typeof input.token || _report(_exceptionable, {
|
|
1083
|
-
path: _path + ".token",
|
|
1084
|
-
expected: "string",
|
|
1085
|
-
value: input.token
|
|
1086
|
-
}), null === input.bytes || (Array.isArray(input.bytes) || _report(_exceptionable, {
|
|
1087
|
-
path: _path + ".bytes",
|
|
1088
|
-
expected: "(Array<number> | null)",
|
|
1089
|
-
value: input.bytes
|
|
1090
|
-
})) && input.bytes.map(((elem, _index14) => "number" === typeof elem || _report(_exceptionable, {
|
|
1091
|
-
path: _path + ".bytes[" + _index14 + "]",
|
|
1092
|
-
expected: "number",
|
|
1093
|
-
value: elem
|
|
1094
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
1095
|
-
path: _path + ".bytes",
|
|
1096
|
-
expected: "(Array<number> | null)",
|
|
1097
|
-
value: input.bytes
|
|
1098
|
-
}), "number" === typeof input.logprob || _report(_exceptionable, {
|
|
1099
|
-
path: _path + ".logprob",
|
|
1100
|
-
expected: "number",
|
|
1101
|
-
value: input.logprob
|
|
1102
|
-
}) ].every((flag => flag));
|
|
1103
|
-
const _vo9 = (input, _path, _exceptionable = true) => [ "number" === typeof input.completion_tokens || _report(_exceptionable, {
|
|
1104
|
-
path: _path + ".completion_tokens",
|
|
1105
|
-
expected: "number",
|
|
1106
|
-
value: input.completion_tokens
|
|
1107
|
-
}), "number" === typeof input.prompt_tokens || _report(_exceptionable, {
|
|
1108
|
-
path: _path + ".prompt_tokens",
|
|
1109
|
-
expected: "number",
|
|
1110
|
-
value: input.prompt_tokens
|
|
1111
|
-
}), "number" === typeof input.total_tokens || _report(_exceptionable, {
|
|
1112
|
-
path: _path + ".total_tokens",
|
|
1113
|
-
expected: "number",
|
|
1114
|
-
value: input.total_tokens
|
|
1115
|
-
}), 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, {
|
|
1116
|
-
path: _path + ".completion_tokens_details",
|
|
1117
|
-
expected: "(CompletionUsage.CompletionTokensDetails | undefined)",
|
|
1118
|
-
value: input.completion_tokens_details
|
|
1119
|
-
})) && _vo10(input.completion_tokens_details, _path + ".completion_tokens_details", _exceptionable) || _report(_exceptionable, {
|
|
1120
|
-
path: _path + ".completion_tokens_details",
|
|
1121
|
-
expected: "(CompletionUsage.CompletionTokensDetails | undefined)",
|
|
1122
|
-
value: input.completion_tokens_details
|
|
1123
|
-
}), 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, {
|
|
1124
|
-
path: _path + ".prompt_tokens_details",
|
|
1125
|
-
expected: "(CompletionUsage.PromptTokensDetails | undefined)",
|
|
1126
|
-
value: input.prompt_tokens_details
|
|
1127
|
-
})) && _vo11(input.prompt_tokens_details, _path + ".prompt_tokens_details", _exceptionable) || _report(_exceptionable, {
|
|
1128
|
-
path: _path + ".prompt_tokens_details",
|
|
1129
|
-
expected: "(CompletionUsage.PromptTokensDetails | undefined)",
|
|
1130
|
-
value: input.prompt_tokens_details
|
|
1131
|
-
}) ].every((flag => flag));
|
|
1132
|
-
const _vo10 = (input, _path, _exceptionable = true) => [ undefined === input.accepted_prediction_tokens || "number" === typeof input.accepted_prediction_tokens || _report(_exceptionable, {
|
|
1133
|
-
path: _path + ".accepted_prediction_tokens",
|
|
1134
|
-
expected: "(number | undefined)",
|
|
1135
|
-
value: input.accepted_prediction_tokens
|
|
1136
|
-
}), undefined === input.audio_tokens || "number" === typeof input.audio_tokens || _report(_exceptionable, {
|
|
1137
|
-
path: _path + ".audio_tokens",
|
|
1138
|
-
expected: "(number | undefined)",
|
|
1139
|
-
value: input.audio_tokens
|
|
1140
|
-
}), undefined === input.reasoning_tokens || "number" === typeof input.reasoning_tokens || _report(_exceptionable, {
|
|
1141
|
-
path: _path + ".reasoning_tokens",
|
|
1142
|
-
expected: "(number | undefined)",
|
|
1143
|
-
value: input.reasoning_tokens
|
|
1144
|
-
}), undefined === input.rejected_prediction_tokens || "number" === typeof input.rejected_prediction_tokens || _report(_exceptionable, {
|
|
1145
|
-
path: _path + ".rejected_prediction_tokens",
|
|
1146
|
-
expected: "(number | undefined)",
|
|
1147
|
-
value: input.rejected_prediction_tokens
|
|
1148
|
-
}) ].every((flag => flag));
|
|
1149
|
-
const _vo11 = (input, _path, _exceptionable = true) => [ undefined === input.audio_tokens || "number" === typeof input.audio_tokens || _report(_exceptionable, {
|
|
1150
|
-
path: _path + ".audio_tokens",
|
|
1151
|
-
expected: "(number | undefined)",
|
|
1152
|
-
value: input.audio_tokens
|
|
1153
|
-
}), undefined === input.cached_tokens || "number" === typeof input.cached_tokens || _report(_exceptionable, {
|
|
1154
|
-
path: _path + ".cached_tokens",
|
|
1155
|
-
expected: "(number | undefined)",
|
|
1156
|
-
value: input.cached_tokens
|
|
1157
|
-
}) ].every((flag => flag));
|
|
1158
|
-
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
1159
|
-
let errors;
|
|
1160
|
-
let _report;
|
|
1161
|
-
return input => {
|
|
1162
|
-
if (false === __is(input)) {
|
|
1163
|
-
errors = [];
|
|
1164
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
1165
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
1166
|
-
path: _path + "",
|
|
1167
|
-
expected: "ChatCompletionChunk",
|
|
1168
|
-
value: input
|
|
1169
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
1170
|
-
path: _path + "",
|
|
1171
|
-
expected: "ChatCompletionChunk",
|
|
1172
|
-
value: input
|
|
1173
|
-
}))(input, "$input", true);
|
|
1174
|
-
const success = 0 === errors.length;
|
|
1175
|
-
return success ? {
|
|
1176
|
-
success,
|
|
1177
|
-
data: input
|
|
1178
|
-
} : {
|
|
1179
|
-
success,
|
|
1180
|
-
errors,
|
|
1181
|
-
data: input
|
|
1182
|
-
};
|
|
1183
|
-
}
|
|
1184
|
-
return {
|
|
1185
|
-
success: true,
|
|
1186
|
-
data: input
|
|
1187
|
-
};
|
|
1188
|
-
};
|
|
1189
|
-
})()(result);
|
|
1190
|
-
if (valid.success === false) {
|
|
1191
|
-
console.error("Invalid ChatCompletionChunk", valid.errors);
|
|
1192
|
-
}
|
|
1193
849
|
return result;
|
|
1194
850
|
}
|
|
1195
851
|
|
|
@@ -1442,8 +1098,7 @@ async function call(ctx, operations) {
|
|
|
1442
1098
|
} : s.function.parameters
|
|
1443
1099
|
}
|
|
1444
1100
|
}))),
|
|
1445
|
-
tool_choice: "auto"
|
|
1446
|
-
parallel_tool_calls: false
|
|
1101
|
+
tool_choice: "auto"
|
|
1447
1102
|
});
|
|
1448
1103
|
const chunks = await StreamUtil.readAll(completionStream);
|
|
1449
1104
|
const completion = ChatGptCompletionMessageUtil.merge(chunks);
|
|
@@ -1714,8 +1369,7 @@ async function correct(ctx, call, retry, error) {
|
|
|
1714
1369
|
function: {
|
|
1715
1370
|
name: call.operation.name
|
|
1716
1371
|
}
|
|
1717
|
-
}
|
|
1718
|
-
parallel_tool_calls: false
|
|
1372
|
+
}
|
|
1719
1373
|
});
|
|
1720
1374
|
const chunks = await StreamUtil.readAll(completionStream);
|
|
1721
1375
|
const completion = ChatGptCompletionMessageUtil.merge(chunks);
|
|
@@ -1915,8 +1569,7 @@ async function step$1(ctx, operations, retry, failures) {
|
|
|
1915
1569
|
function: {
|
|
1916
1570
|
name: CONTAINER$1.functions[0].name
|
|
1917
1571
|
}
|
|
1918
|
-
}
|
|
1919
|
-
parallel_tool_calls: true
|
|
1572
|
+
}
|
|
1920
1573
|
});
|
|
1921
1574
|
const chunks = await StreamUtil.readAll(completionStream);
|
|
1922
1575
|
const completion = ChatGptCompletionMessageUtil.merge(chunks);
|
|
@@ -3892,8 +3545,7 @@ async function initialize(ctx) {
|
|
|
3892
3545
|
parameters: FUNCTION.parameters
|
|
3893
3546
|
}
|
|
3894
3547
|
} ],
|
|
3895
|
-
tool_choice: "auto"
|
|
3896
|
-
parallel_tool_calls: false
|
|
3548
|
+
tool_choice: "auto"
|
|
3897
3549
|
});
|
|
3898
3550
|
const textContext = [];
|
|
3899
3551
|
const completion = await StreamUtil.reduce(completionStream, (async (accPromise, chunk) => {
|
|
@@ -4129,8 +3781,7 @@ async function step(ctx, operations, retry, failures) {
|
|
|
4129
3781
|
function: {
|
|
4130
3782
|
name: CONTAINER.functions[0].name
|
|
4131
3783
|
}
|
|
4132
|
-
}
|
|
4133
|
-
parallel_tool_calls: false
|
|
3784
|
+
}
|
|
4134
3785
|
});
|
|
4135
3786
|
const chunks = await StreamUtil.readAll(completionStream);
|
|
4136
3787
|
const completion = ChatGptCompletionMessageUtil.merge(chunks);
|
|
@@ -43454,5 +43105,5 @@ var index = Object.freeze({
|
|
|
43454
43105
|
toAsyncGenerator
|
|
43455
43106
|
});
|
|
43456
43107
|
|
|
43457
|
-
export { Agentica, AgenticaTokenUsage, MicroAgentica, assertHttpController, assertHttpLlmApplication, assertMcpController, index$2 as factory, index$1 as orchestrate, index as utils, validateHttpController, validateHttpLlmApplication, validateMcpController };
|
|
43108
|
+
export { Agentica, AgenticaDefaultPrompt, AgenticaSystemPrompt, AgenticaTokenUsage, MicroAgentica, assertHttpController, assertHttpLlmApplication, assertMcpController, index$2 as factory, index$1 as orchestrate, index as utils, validateHttpController, validateHttpLlmApplication, validateMcpController, write };
|
|
43458
43109
|
//# sourceMappingURL=index.mjs.map
|