key ); $this->SetHeader($header); } public function generate( $promt, $context = '' ){ $url = $this->host.self::$urlgen; $cmd = array( "model" => $this->model, "messages" =>array(array("role"=>"user", "content"=>$promt)), "stream" => false, "temperature" => 0.2, "top_p" => 0.7, "max_tokens" => 1024, ); if( $context ){ // $cmd['context'] = $context; } // echo json_encode($cmd); exit; $r = $this->Send( $url, $cmd ); $this->res = $r; return $r; } public function Getres(){ $r = $this->res; $robj = json_decode($r); return nl2br($robj->choices[0]->message->content); } }