-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
Hello, thank you for this library and I'm new to this ChatGPT API.
I'm trying to create a class for defining funtions like this
class myFunctionsClass {
protected ChatGPT $chatGPT; // This is your class
/**
- This function do something very cool
- @param $test : string having the result from chatgpt
*/
public function doSomething(string $test) {
// do something with $test
}
}
In that same class I'm defining a constructor to add the defined functions like this
public function __construct()
{
$api_key = env('OPENAI_API_KEY');
$this->chatGPT = new ChatGPT($api_key);
$this->chatGPT->add_function('doSomething');
}
The line that assigns a function throws an error
App\Libraries\ChatGPT::add_function(): Argument #1 ($function) must be of type callable|array, string given,
What am I doing wrong here?
Thank you and hopefully you can check this.
Regards
Ernesto Pareja
Metadata
Metadata
Assignees
Labels
No labels