承接 khaledalam/bard-sdk-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

khaledalam/bard-sdk-php

最新稳定版本:v1.0.0

Composer 安装命令:

composer require khaledalam/bard-sdk-php

包简介

Google Bard SDK for PHP (unofficial).

README 文档

README

Downloads Latest Stable Version PHP Version Require License composer.lock available workflows CI

Reverse engineering of Google's Bard chatbot.

Disclamer

  • ApiKeyCookie.php implemented only for easing the access to Google Bard, any legal responsibilities lie with the user.
  • Don't expose your __Secure-1PSID cookie value on the internet.

Install

$ composer require khaledalam/bard-sdk-php

Test

$ composer run test

Auth

  1. Navigate to https://bard.google.com/
  2. Open "Developer Tools" from browser settings or click [F12] shortcut for console.
  3. Go to Application tab => open "Cookies" from left tab => click "https://accounts.google.com" => Copy the value of __Secure-1PSID cookie.

Simple Usage

Change _YOUR_COOKIE_VALUE_

<?php

require_once('./vendor/autoload.php');

use Khaledalam\BardSdkPhp\ApiKey\ApiKeyCookie;
use Khaledalam\BardSdkPhp\Bard;

try {
    // __Secure-1PSID value
    $apiKey = '_YOUR_COOKIE_VALUE_';

    $question = "What is the recent stable version LTS of Ubuntu?";

    $bard = new Bard(new ApiKeyCookie($apiKey));

    $answer = $bard->ask($question);

    print_r($answer['content']);
    /*
    Output (May-2023):
    
    The most recent stable version of Ubuntu LTS is Ubuntu 22.04 LTS, codenamed "Jammy Jellyfish." It was released on April 21, 2022, and will be supported with free security and maintenance updates for five years, until April 2027.

    Ubuntu LTS releases are designed for use in enterprise and server environments, where reliability and stability are critical. They are also a good choice for home users who want a reliable and long-lasting operating system.
    */

} catch (Exception $e)
{
    die("Error: " . $e->getMessage());
}

Output (May-2023):

The most recent stable version of Ubuntu LTS is Ubuntu 22.04 LTS, codenamed "Jammy Jellyfish." It was released on April 21, 2022, and will be supported with free security and maintenance updates for five years, until April 2027.

Ubuntu LTS releases are designed for use in enterprise and server environments, where reliability and stability are critical. They are also a good choice for home users who want a reliable and long-lasting operating system.

Examples

Example1(world_datatime_ai):

php examples/world_datetime_ai/main.php

Example2(docker)

Technical

Diagram

TODOs:

  • Cookie
  • Api key
  • codecov
  • Testing
  • CI GitHub actions

License

统计信息

  • 总下载量: 268
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固