Skip to content

Commit

Permalink
fix: openai helper doesnt work (#3755)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Jul 11, 2023
1 parent 0c682de commit 0e4a536
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/helper/OpenAI.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class OpenAI extends Helper {
chunkSize: 80000,
};
this.options = { ...this.options, ...config };
}

_beforeSuite() {
const helpers = Container.helpers();

for (const helperName of standardActingHelpers) {
Expand All @@ -37,16 +39,16 @@ class OpenAI extends Helper {
}

/**
* Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
*
* ```js
* I.askGptOnPage('what does this page do?');
* ```
*
* @async
* @param {string} prompt - The question or prompt to ask the GPT model.
* @returns {Promise<string>} - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
*/
* Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
*
* ```js
* I.askGptOnPage('what does this page do?');
* ```
*
* @async
* @param {string} prompt - The question or prompt to ask the GPT model.
* @returns {Promise<string>} - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
*/
async askGptOnPage(prompt) {
const html = await this.helper.grabSource();

Expand Down Expand Up @@ -120,3 +122,5 @@ class OpenAI extends Helper {
return response;
}
}

module.exports = OpenAI;

0 comments on commit 0e4a536

Please sign in to comment.