adityadees / laravel-google-bard Goto Github PK
View Code? Open in Web Editor NEWA Laravel Package for Google Bard AI Chatbot
Home Page: https://packagist.org/packages/adityadees/laravel-google-bard
License: MIT License
A Laravel Package for Google Bard AI Chatbot
Home Page: https://packagist.org/packages/adityadees/laravel-google-bard
License: MIT License
Hi thanks for the package, I tried: use AdityaDees\LaravelBard; and a few others but can't get it to work, maybe it would be cool to put it in the readme
Thanks
Hi
I tried setting up your Bard package but it fails with the eror "Class "LaravelBard" not found"
i've tried importing it via
use LaravelBard;
or
use Bard;
but those aren't right :)
Here's my controller
*<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
//use LaravelBard;
class testController extends Controller
{
public function __invoke()
{
dump('test');
$bard = (new LaravelBard())->get_answer('hoe laat is het');
dd($bard);
# to get the reply just access this array
$bard["content"];
# you can access others array like this
$bard["conversation_id"];
$bard["response_id"];
$bard["factualityQueries"];
$bard["textQuery"];
$bard["choices"];
}
}`**
Please advice
Hi @adityadees
I tried using this package, the results shown are quite good.
but sometimes an error like this appears:
explode(): Argument #2 ($string) must be of type string, bool given
in this line: $bard = (new LaravelBard())->get_answer('what is linux');
when testing do get_answer several times
thanks
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] ?? "",
Got this error on my View
"""
Response Error: )]}'
38
[["wrb.fr",null,null,null,null,[9]]]
56
[["di",122],["af.httprm",122,"6907126464418719828",0]]
25
[["e",4,null,null,131]]
.
""" // app/Http/Controllers/BardController.php:14
.env
BARD_TOKEN=My __Secure-1PSID
Controller
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use AdityaDees\LaravelBard\LaravelBard; // Corrected Namespace
class BardController extends Controller
{
public function index()
{
$bard = (new LaravelBard())->get_answer('what is your name');
dd($bard["content"]);
// $response = $bard["content"];
// return view('bard', ['response' => $response]);
}
}```
Hello.
First of all, it is a very interesting project.
I have taken the bard's cockie I can do it as in your explanation but I get this. I am in local development.
And I don't understand why it fails me. Also I have created BARD_TOKEN in env.
thank you
'bard_token' => env('BARD_TOKEN', 'YQi-AJS0hL5mzOyzUgoCodbqRIIQlzUq2J5jdEMO4TgDkoFJktYhVYt_NOTREALTOKEN.'),
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.