php-bard-api
A package that returns Response of Google Bard through API
Prerequisites
- PHP 8.1
- composer
Install
composer require pj8912/php-bard-api
Usage
<?php
require_once 'vendor/autoload.php';
use Pj8912\PhpBardApi\Bard;
$_ENV['_BARD_API_KEY'] = "Your Key";
$bard = new Bard();
$input_text = "Hello, Bard!"; // Input text for the conversation
$result = $bard->get_answer($input_text);
// Access the result data
$conversation_id = $result["conversation_id"];
$response_id = $result["response_id"];
$factualityQueries = $result["factualityQueries"];
$textQuery = $result["textQuery"];
$choices = $result["choices"];
// reply for query
$content = $result["content"];
print($content);
?>
Top comments (0)