This project provides a FastAPI wrapper for interacting with Google Bard, a conversational AI by Google. It allows users to send messages to Google Bard and receive responses through a simple API.
These instructions will help you set up and run the project on your local machine for development and testing purposes.
- Python 3.9 or higher
- Docker
- Clone the repository:
git clone https://github.com/ra83205/google-bard-api.git
cd google-bard-api
- Create a virtual environment and install the required packages:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Run the application using Uvicorn:
uvicorn main:app --reload
The application should now be running at http://localhost:8000
.
You can send POST requests to the /ask
endpoint with a JSON payload containing a session_id
(your __Secure-1PSID
cookie) and a message
.
Example request:
curl -X POST "http://localhost:8000/ask" -H "accept: application/json" -H "Content-Type: application/json" -d '{"session_id":"your-session-id","message":"What is the meaning of life?"}'
You should receive a JSON response from Google Bard containing the response message.
To deploy this application using Docker, follow these steps:
- Build the Docker image:
docker build -t your-image-name .
- Run the Docker container:
docker run -p 4000:80 your-image-name
The application should now be running at http://localhost:4000
.
pp21§1 If you would like to contribute to this project, please feel free to submit a pull request or open an issue.
This project is licensed under the MIT License - see the LICENSE file for details.
- Google for creating Google Bard
- FastAPI for providing a simple and efficient web framework