Skip to content

Commit

Permalink
More events
Browse files Browse the repository at this point in the history
  • Loading branch information
metaskills committed May 1, 2024
1 parent 6325103 commit 81837e9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "experts",
"version": "0.3.0",
"version": "0.3.1",
"description": "An opinionated panel of experts implementation using OpenAI's Assistants API",
"type": "module",
"main": "./src/index.js",
Expand Down
8 changes: 8 additions & 0 deletions src/experts/assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ class Assistant {
this.eventEmitter.emit("toolCallDelta", delta, snapshot);
}

onRunStepDone(runStep) {
this.eventEmitter.emit("runStepDone", runStep);
}

onToolCallDone(toolCall) {
this.eventEmitter.emit("toolCallDone", toolCall);
}

// Tool Assistant

addAssistantTool(toolClass) {
Expand Down
10 changes: 10 additions & 0 deletions src/experts/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Run {
stream.on("event", (e) => this.onEvent(e));
stream.on("textDelta", (td, s) => this.onTextDelta(td, s));
stream.on("toolCallDelta", (tcd, s) => this.onToolCallDelta(tcd, s));
stream.on("runStepDone", (rs) => this.onRunStepDone(rs));
stream.on("toolCallDone", (tc) => this.onToolCallDone(tc));
this.toolOutputs = [];
this.isToolOuputs = false;
}
Expand Down Expand Up @@ -84,6 +86,14 @@ class Run {
this.assistant.onToolCallDelta(delta, snapshot);
}

onRunStepDone(runStep) {
this.assistant.onRunStepDone(runStep);
}

onToolCallDone(toolCall) {
this.assistant.onToolCallDone(toolCall);
}

// Private (Tools)

async callTools() {
Expand Down

0 comments on commit 81837e9

Please sign in to comment.