@eko-ai/eko 4.1.1 → 4.1.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/dist/index.cjs +24 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +22 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/llm/rlm.d.ts.map +1 -1
- package/dist/memory/index.d.ts +2 -1
- package/dist/memory/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37133,15 +37133,15 @@ async function doCompressAgentMessages(agentContext, messages, tools) {
|
|
|
37133
37133
|
content: toolResult.content.filter((s) => s.type == "text"),
|
|
37134
37134
|
});
|
|
37135
37135
|
}
|
|
37136
|
-
function compressLargeContextMessages(messages) {
|
|
37136
|
+
function compressLargeContextMessages(messages, largeTextLength = config$1.largeTextLength) {
|
|
37137
37137
|
for (let r = 2; r < messages.length; r++) {
|
|
37138
37138
|
const message = messages[r];
|
|
37139
37139
|
if (message.role == "assistant") {
|
|
37140
37140
|
message.content = message.content.map((c) => {
|
|
37141
|
-
if (c.type == "text" && c.text.length >
|
|
37141
|
+
if (c.type == "text" && c.text.length > largeTextLength) {
|
|
37142
37142
|
return {
|
|
37143
37143
|
...c,
|
|
37144
|
-
text: sub(c.text,
|
|
37144
|
+
text: sub(c.text, largeTextLength, true),
|
|
37145
37145
|
};
|
|
37146
37146
|
}
|
|
37147
37147
|
return c;
|
|
@@ -37149,10 +37149,10 @@ function compressLargeContextMessages(messages) {
|
|
|
37149
37149
|
}
|
|
37150
37150
|
else if (message.role == "user") {
|
|
37151
37151
|
message.content = message.content.map((c) => {
|
|
37152
|
-
if (c.type == "text" && c.text.length >
|
|
37152
|
+
if (c.type == "text" && c.text.length > largeTextLength) {
|
|
37153
37153
|
return {
|
|
37154
37154
|
...c,
|
|
37155
|
-
text: sub(c.text,
|
|
37155
|
+
text: sub(c.text, largeTextLength, true),
|
|
37156
37156
|
};
|
|
37157
37157
|
}
|
|
37158
37158
|
return c;
|
|
@@ -37163,18 +37163,18 @@ function compressLargeContextMessages(messages) {
|
|
|
37163
37163
|
if (c.type == "tool-result" && c.output) {
|
|
37164
37164
|
const output = c.output;
|
|
37165
37165
|
if ((output.type == "text" || output.type == "error-text") &&
|
|
37166
|
-
output.value.length >
|
|
37166
|
+
output.value.length > largeTextLength) {
|
|
37167
37167
|
return {
|
|
37168
37168
|
...c,
|
|
37169
37169
|
output: {
|
|
37170
37170
|
...output,
|
|
37171
|
-
value: sub(output.value,
|
|
37171
|
+
value: sub(output.value, largeTextLength, true),
|
|
37172
37172
|
},
|
|
37173
37173
|
};
|
|
37174
37174
|
}
|
|
37175
37175
|
else if ((output.type == "json" || output.type == "error-json") &&
|
|
37176
|
-
JSON.stringify(output.value).length >
|
|
37177
|
-
const json_str = sub(JSON.stringify(output.value),
|
|
37176
|
+
JSON.stringify(output.value).length > largeTextLength) {
|
|
37177
|
+
const json_str = sub(JSON.stringify(output.value), largeTextLength, false);
|
|
37178
37178
|
const json_obj = fixJson(json_str);
|
|
37179
37179
|
if (JSON.stringify(json_obj).length < 10) {
|
|
37180
37180
|
return {
|
|
@@ -37200,8 +37200,8 @@ function compressLargeContextMessages(messages) {
|
|
|
37200
37200
|
for (let i = 0; i < output.value.length; i++) {
|
|
37201
37201
|
const content = output.value[i];
|
|
37202
37202
|
if (content.type == "text" &&
|
|
37203
|
-
content.text.length >
|
|
37204
|
-
content.text = sub(content.text,
|
|
37203
|
+
content.text.length > largeTextLength) {
|
|
37204
|
+
content.text = sub(content.text, largeTextLength, true);
|
|
37205
37205
|
}
|
|
37206
37206
|
}
|
|
37207
37207
|
}
|
|
@@ -37211,7 +37211,7 @@ function compressLargeContextMessages(messages) {
|
|
|
37211
37211
|
}
|
|
37212
37212
|
}
|
|
37213
37213
|
}
|
|
37214
|
-
function handleLargeContextMessages(messages) {
|
|
37214
|
+
function handleLargeContextMessages(messages, largeTextLength = config$1.largeTextLength) {
|
|
37215
37215
|
let imageNum = 0;
|
|
37216
37216
|
let fileNum = 0;
|
|
37217
37217
|
let maxNum = config$1.maxDialogueImgFileNum;
|
|
@@ -37267,7 +37267,7 @@ function handleLargeContextMessages(messages) {
|
|
|
37267
37267
|
for (let r = 0; r < toolContent.value.length; r++) {
|
|
37268
37268
|
let _content = toolContent.value[r];
|
|
37269
37269
|
if (_content.type == "text" &&
|
|
37270
|
-
_content.text?.length >
|
|
37270
|
+
_content.text?.length > largeTextLength) {
|
|
37271
37271
|
if (!longTextTools[toolResult.toolName]) {
|
|
37272
37272
|
longTextTools[toolResult.toolName] = 1;
|
|
37273
37273
|
break;
|
|
@@ -37277,7 +37277,7 @@ function handleLargeContextMessages(messages) {
|
|
|
37277
37277
|
}
|
|
37278
37278
|
_content = {
|
|
37279
37279
|
type: "text",
|
|
37280
|
-
text: sub(_content.text,
|
|
37280
|
+
text: sub(_content.text, largeTextLength, true),
|
|
37281
37281
|
};
|
|
37282
37282
|
toolContent.value[r] = _content;
|
|
37283
37283
|
}
|
|
@@ -37755,7 +37755,13 @@ class RetryLanguageModel {
|
|
|
37755
37755
|
if (!providerOptions) {
|
|
37756
37756
|
options.providerOptions = defaultLLMProviderOptions();
|
|
37757
37757
|
if (llmConfig.options && Object.keys(llmConfig.options).length > 0) {
|
|
37758
|
-
|
|
37758
|
+
// Filter out keys that start with 'stream_'
|
|
37759
|
+
options.providerOptions[llm.provider] = Object.entries(llmConfig.options).reduce((acc, [key, value]) => {
|
|
37760
|
+
if (!key.startsWith("stream_")) {
|
|
37761
|
+
acc[key] = value;
|
|
37762
|
+
}
|
|
37763
|
+
return acc;
|
|
37764
|
+
}, {});
|
|
37759
37765
|
}
|
|
37760
37766
|
}
|
|
37761
37767
|
let _options = options;
|
|
@@ -44985,11 +44991,14 @@ exports.callLLM = callLLM;
|
|
|
44985
44991
|
exports.callWithReAct = callWithReAct;
|
|
44986
44992
|
exports.call_timeout = call_timeout;
|
|
44987
44993
|
exports.compressImageData = compressImageData;
|
|
44994
|
+
exports.compressLargeContextMessages = compressLargeContextMessages;
|
|
44988
44995
|
exports.config = config$1;
|
|
44989
44996
|
exports.convertToolSchema = convertToolSchema;
|
|
44990
44997
|
exports.default = Eko;
|
|
44991
44998
|
exports.extract_page_content = extract_page_content;
|
|
44999
|
+
exports.fixJson = fixJson;
|
|
44992
45000
|
exports.global = global;
|
|
45001
|
+
exports.handleLargeContextMessages = handleLargeContextMessages;
|
|
44993
45002
|
exports.mergeTools = mergeTools;
|
|
44994
45003
|
exports.parseWorkflow = parseWorkflow;
|
|
44995
45004
|
exports.resetWorkflowXml = resetWorkflowXml;
|