Skip to content

Commit 555df7f

Browse files
authored
Merge pull request #252 from FellouAI/develop
v3.1.0
2 parents a823775 + 2a19aa2 commit 555df7f

File tree

8 files changed

+58
-39
lines changed

8 files changed

+58
-39
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eko-ai/eko",
3-
"version": "3.0.9-alpha.5",
3+
"version": "3.1.0",
44
"description": "Empowering language to transform human words into action.",
55
"workspaces": [
66
"packages/eko-core",

packages/eko-core/package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eko-ai/eko",
3-
"version": "3.0.9-alpha.5",
3+
"version": "3.1.0",
44
"description": "Empowering language to transform human words into action.",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.esm.js",
@@ -43,23 +43,22 @@
4343
},
4444
"dependencies": {
4545
"@ai-sdk/provider": "^2.0.0",
46-
"@ai-sdk/amazon-bedrock": "^3.0.12",
47-
"@ai-sdk/anthropic": "^2.0.8",
48-
"@ai-sdk/google": "^2.0.11",
49-
"@ai-sdk/openai": "^2.0.22",
50-
"@ai-sdk/openai-compatible": "^1.0.13",
51-
"@openrouter/ai-sdk-provider": "^1.1.2",
46+
"@ai-sdk/amazon-bedrock": "^3.0.43",
47+
"@ai-sdk/anthropic": "^2.0.33",
48+
"@ai-sdk/google": "^2.0.23",
49+
"@ai-sdk/openai": "^2.0.52",
50+
"@ai-sdk/openai-compatible": "^1.0.22",
51+
"@openrouter/ai-sdk-provider": "^1.2.0",
5252
"secure-json-parse": "^4.0.0",
53-
"xmldom": "^0.6.0",
54-
"zod": "^4.0.14"
53+
"@xmldom/xmldom": "^0.8.11",
54+
"zod": "^4.1.12"
5555
},
5656
"devDependencies": {
5757
"@rollup/plugin-commonjs": "^28.0.3",
5858
"@rollup/plugin-node-resolve": "^16.0.1",
5959
"@rollup/plugin-typescript": "^12.1.2",
6060
"@types/jest": "^29.5.14",
6161
"@types/json-schema": "^7.0.15",
62-
"@types/xmldom": "^0.1.34",
6362
"dotenv": "^16.5.0",
6463
"jest": "^29.7.0",
6564
"rollup": "^4.40.0",

packages/eko-core/src/agent/llm.ts

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,32 @@ export async function callAgentLLM(
451451
agentContext
452452
);
453453
}
454+
if (chunk.finishReason === "content-filter") {
455+
throw new Error("LLM error: trigger content filtering violation");
456+
} else if (chunk.finishReason === "other") {
457+
throw new Error("LLM error: terminated due to other reasons");
458+
} else if (
459+
chunk.finishReason === "length" &&
460+
messages.length >= 3 &&
461+
!noCompress &&
462+
retryNum < config.maxRetryNum
463+
) {
464+
await memory.compressAgentMessages(
465+
agentContext,
466+
messages,
467+
tools
468+
);
469+
return callAgentLLM(
470+
agentContext,
471+
rlm,
472+
messages,
473+
tools,
474+
noCompress,
475+
toolChoice,
476+
++retryNum,
477+
streamCallback
478+
);
479+
}
454480
if (toolPart) {
455481
await streamCallback.onMessage(
456482
{
@@ -484,28 +510,6 @@ export async function callAgentLLM(
484510
},
485511
agentContext
486512
);
487-
if (
488-
chunk.finishReason === "length" &&
489-
messages.length >= 5 &&
490-
!noCompress &&
491-
retryNum < config.maxRetryNum
492-
) {
493-
await memory.compressAgentMessages(
494-
agentContext,
495-
messages,
496-
tools
497-
);
498-
return callAgentLLM(
499-
agentContext,
500-
rlm,
501-
messages,
502-
tools,
503-
noCompress,
504-
toolChoice,
505-
++retryNum,
506-
streamCallback
507-
);
508-
}
509513
break;
510514
}
511515
}

packages/eko-core/src/common/xml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { fixXmlTag } from "./utils";
2-
import { DOMParser, XMLSerializer } from "xmldom";
2+
import { DOMParser, XMLSerializer } from "@xmldom/xmldom";
33
import {
44
Workflow,
55
WorkflowAgent,

packages/eko-core/src/core/plan.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Log from "../common/log";
22
import Context from "./context";
3+
import { sleep } from "../common/utils";
34
import { RetryLanguageModel } from "../llm";
45
import { parseWorkflow } from "../common/xml";
56
import { LLMRequest } from "../types/llm.types";
@@ -81,13 +82,14 @@ export class Planner {
8182
async doPlan(
8283
taskPrompt: string,
8384
messages: LanguageModelV2Prompt,
84-
saveHistory: boolean
85+
saveHistory: boolean,
86+
retryNum: number = 0
8587
): Promise<Workflow> {
8688
const config = this.context.config;
8789
const rlm = new RetryLanguageModel(config.llms, config.planLlms);
8890
rlm.setContext(this.context);
8991
const request: LLMRequest = {
90-
maxTokens: 4096,
92+
maxTokens: 8192,
9193
temperature: 0.7,
9294
messages: messages,
9395
abortSignal: this.context.controller.signal,
@@ -114,6 +116,14 @@ export class Planner {
114116
if (chunk.type == "text-delta") {
115117
streamText += chunk.delta || "";
116118
}
119+
if (chunk.type == "finish") {
120+
if (chunk.finishReason == "content-filter") {
121+
throw new Error("LLM error: trigger content filtering violation");
122+
}
123+
if (chunk.finishReason == "other") {
124+
throw new Error("LLM error: terminated due to other reasons");
125+
}
126+
}
117127
if (this.callback) {
118128
let workflow = parseWorkflow(
119129
this.taskId,
@@ -132,6 +142,12 @@ export class Planner {
132142
}
133143
}
134144
}
145+
} catch (e: any) {
146+
if (retryNum < 3) {
147+
await sleep(1000);
148+
return await this.doPlan(taskPrompt, messages, saveHistory, ++retryNum);
149+
}
150+
throw e;
135151
} finally {
136152
reader.releaseLock();
137153
if (Log.isEnableInfo()) {

packages/eko-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eko-ai/eko-extension",
3-
"version": "3.0.9-alpha.5",
3+
"version": "3.1.0",
44
"description": "Empowering language to transform human words into action.",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.esm.js",

packages/eko-nodejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eko-ai/eko-nodejs",
3-
"version": "3.0.9-alpha.5",
3+
"version": "3.1.0",
44
"description": "Empowering language to transform human words into action.",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.esm.js",

packages/eko-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eko-ai/eko-web",
3-
"version": "3.0.9-alpha.5",
3+
"version": "3.1.0",
44
"description": "Empowering language to transform human words into action.",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.esm.js",

0 commit comments

Comments
 (0)