laravel-google-bard icon indicating copy to clipboard operation
laravel-google-bard copied to clipboard

Trying to access array offset on value of type null

Open cschalenborgh opened this issue 2 years ago • 3 comments

Hi,

I get the following error when I run a very simple get_answer() function:

ErrorException

 Trying to access array offset on value of type null

 at vendor/adityadees/laravel-google-bard/src/LaravelBard.php:135
   131▕             return ["content" => "Response Error: " . $resp . "."];
   132▕         }
   133▕         $parsed_answer = json_decode($resp_dict, true);
   134▕         $bard_answer = [
 ➜ 135▕             "content" => $parsed_answer[0][0],
   136▕             "conversation_id" => $parsed_answer[1][0],
   137▕             "response_id" => $parsed_answer[1][1],
   138▕             "factualityQueries" => $parsed_answer[3],
   139▕             "textQuery" => $parsed_answer[2][0] ?? "",

cschalenborgh avatar Jul 14 '23 13:07 cschalenborgh

hi, are you still get the error?

adityadees avatar Aug 12 '23 06:08 adityadees

I get the same error after installation and running the example.

MasterOfWeb avatar Oct 11 '23 09:10 MasterOfWeb

Same here.

ldydak avatar Dec 19 '23 14:12 ldydak