Skip to content

Commit

Permalink
Before ask callback. v1.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
metaskills committed Aug 25, 2024
1 parent 9ff0b54 commit bcf6f35
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

See this http://keepachangelog.com link for information on how we want this document formatted.

## v1.5.4

### Added

New `beforeAsk(message)` callback for assistant.

## v1.5.1, v1.5.2, v1.5.3

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "1.5.3",
"version": "1.5.4",
"description": "An opinionated panel of experts implementation using OpenAI's Assistants API",
"type": "module",
"main": "./dist/index.cjs",
Expand Down
5 changes: 5 additions & 0 deletions src/experts/assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ class Assistant {
// Interface

async ask(message, threadID, options = {}) {
message = await this.beforeAsk(message);
try {
return await this.#askAssistant(message, threadID, options);
} finally {
await this.#askCleanup();
}
}

async beforeAsk(message) {
return message;
}

async answered(output) {
return output;
}
Expand Down

0 comments on commit bcf6f35

Please sign in to comment.