@recombine-ai/engine 0.11.1-beta → 0.11.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/build/lib/ai.js +5 -5
- package/changelog.md +17 -0
- package/package.json +1 -1
package/build/lib/ai.js
CHANGED
|
@@ -84,7 +84,7 @@ function createAIEngine(cfg = {}) {
|
|
|
84
84
|
run: async (messages, contextProvider, beforeEach) => {
|
|
85
85
|
const state = new WorkflowState(logger, steps);
|
|
86
86
|
let beforeHookExecuted = false;
|
|
87
|
-
let
|
|
87
|
+
let didExecute = false;
|
|
88
88
|
do {
|
|
89
89
|
const ctx = await contextProvider();
|
|
90
90
|
await beforeEach?.(messages, ctx, state);
|
|
@@ -97,6 +97,7 @@ function createAIEngine(cfg = {}) {
|
|
|
97
97
|
// TODO: drop actions, they are replaced by traces
|
|
98
98
|
const action = (0, action_1.makeAction)(cfg.sendAction, 'AI', step.name);
|
|
99
99
|
await action('started');
|
|
100
|
+
didExecute = true;
|
|
100
101
|
if (beforeExecute && !beforeHookExecuted) {
|
|
101
102
|
await beforeExecute(ctx);
|
|
102
103
|
beforeHookExecuted = true;
|
|
@@ -107,13 +108,12 @@ function createAIEngine(cfg = {}) {
|
|
|
107
108
|
else {
|
|
108
109
|
await runProgrammaticStep(step, messages, ctx, state);
|
|
109
110
|
}
|
|
110
|
-
if (afterExecute && !afterHookExecuted) {
|
|
111
|
-
await afterExecute(ctx);
|
|
112
|
-
afterHookExecuted = true;
|
|
113
|
-
}
|
|
114
111
|
await action('completed');
|
|
115
112
|
}
|
|
116
113
|
} while (state.next());
|
|
114
|
+
if (afterExecute && didExecute) {
|
|
115
|
+
await afterExecute(await contextProvider());
|
|
116
|
+
}
|
|
117
117
|
await stepTracer.flush();
|
|
118
118
|
return state.isTerminated() ? null : messages.getProposedReply();
|
|
119
119
|
},
|
package/changelog.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
### 0.11.0 → 0.11.1 (unstable)
|
|
4
|
+
|
|
5
|
+
- Added `beforeExecute` and `afterExecute` hooks to Workflow configuration.
|
|
6
|
+
|
|
7
|
+
### 0.10.4 → 0.11.0 (unstable)
|
|
8
|
+
|
|
9
|
+
- Breaking change: second argument in `workflow.run(conversation, contextProvider)` now must be a
|
|
10
|
+
function.
|
|
11
|
+
|
|
12
|
+
### 0.10.3 → 0.10.4 (unstable)
|
|
13
|
+
|
|
14
|
+
- Added LLM usage to `StepTrace` interface
|
|
15
|
+
|
|
16
|
+
### 0.10.2 → 0.10.3 (unstable)
|
|
17
|
+
|
|
18
|
+
- Enhanced error handling for AI-generated responses in `runStep`.
|
|
19
|
+
|
|
3
20
|
### 0.10.2 → 0.10.3 (unstable)
|
|
4
21
|
|
|
5
22
|
- Enhanced error handling for AI-generated responses in `runStep`.
|
package/package.json
CHANGED