Closed D0nVitalio closed 1 day ago
And when used php chatbot_with_assistants_api.php
What is the weather in California? -> got this:
Attempt to read property "type" on array in C:\xampp82\htdocs\pgf\library\ChatGPT.php on line 368
Solved so:
function($tool_call) {
if(is_array($tool_call)){
return $tool_call['type'] === "function";
}else{
return $tool_call->type === "function";
}
}
Please correct if needed
It should work now :)
Hi, Have asked about weather and then wrote "California" and got Cannot use object of type stdClass as array in C:\xampp82\htdocs\pgf\library\ChatGPT.php:379 Quick solved it with
if(!is_array($tool_call)){$tool_call = json_decode(json_encode($tool_call), true);}
but I think you can solve it better:)Also right after start, get
Undefined array key 1 in C:\xampp82\htdocs\pgf\library\ChatGPT.php on line 582
Solved:if(isset($matches[1])){ $description .= " ".$matches[1]; } else { $description .= " "; }