Bard  by acheong08

Python SDK for accessing the Bard chatbot via reverse engineering

created 2 years ago
1,412 stars

Top 29.4% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a Python SDK and API for interacting with Google Bard, a large language model chatbot. It is designed for developers and researchers who want to integrate Bard's capabilities into their applications or explore its functionality programmatically. The SDK allows for both synchronous and asynchronous interactions, offering flexibility for various use cases.

How It Works

The project reverse-engineers the Google Bard API, enabling programmatic access without an official SDK. It relies on obtaining authentication cookies (__Secure-1PSID and __Secure-1PSIDTS) from a user's browser session on bard.google.com. These cookies are then used to authenticate requests to the Bard backend, allowing the SDK to send prompts and receive responses.

Quick Start & Requirements

  • Primary install / run command: pip3 install --upgrade GoogleBard
  • Prerequisites: Requires authentication cookies (__Secure-1PSID, __Secure-1PSIDTS) obtained from a browser session.
  • Setup: Obtain cookies from https://bard.google.com/ via browser developer tools (F12 -> Application -> Cookies).
  • Usage: Can be used via command-line interface (python3 -m Bard) or directly within Python scripts using Chatbot or AsyncChatbot classes. Environment variables (BARD__Secure_1PSID, BARD__Secure_1PSIDTS) can be set for convenience.

Highlighted Details

  • Supports both synchronous and asynchronous API interactions.
  • Provides command-line interface for quick testing and scripting.
  • Includes example Python code for direct integration.
  • Authentication relies on reverse-engineered cookie-based methods.

Maintenance & Community

  • Credits discordtehe for original reverse engineering work.
  • No explicit links to community channels or roadmaps are provided in the README.

Licensing & Compatibility

  • The README does not specify a license.

Limitations & Caveats

This project is based on reverse-engineered APIs, which are subject to change or deprecation by Google without notice. The reliance on browser cookies for authentication may also pose security considerations and potential instability if Google modifies its authentication mechanisms.

Health Check
Last commit

2 years ago

Responsiveness

1+ week

Pull Requests (30d)
0
Issues (30d)
0
Star History
2 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.