priyanshuverma-dev / bard-chatbot

A Python-based chatbot project that integrates the Bard API for natural language processing and voice interaction. This chatbot can listen to voice input, process user queries, and respond with audio output.
MIT License
3 stars 2 forks source link
ai aiassistant artificial-intelligence assistant bard chatbot hacktoberfest hacktoberfest2023 python

Bard Chatbot with Voice Input and Audio Playback

Bard Chatbot

A Python-based chatbot project that integrates the Bard API for natural language processing and voice interaction. This chatbot can listen to voice input, process user queries, and respond with audio output.

Prerequisites

Before getting started, make sure you have the following dependencies installed:

You can install the required Python libraries using pip:

pip install -r requirements.txt

Configuration

  1. Create a .env file in the project directory and add your Bard API tokens:

    Secure_1PSID=your_secure_1PSID_token
    Secure_1PSIDCC=your_secure_1PSIDCC_token
    Secure_1PSIDTS=your_secure_1PSIDTS_token
  2. Make sure you have an active microphone connected to your system.

  3. (Optional) Make changes in .venv\Lib\site-packages\bardapi\core.py if gives any error like requests not found.

add at top:

import requests
  1. (Optional) Make changes in ..venv\Lib\site-packages\bardapi\models\tools\map.py if gives any error like Tuple not found.

add at top:

from typing import Optional, Tuple, List

Usage

Run the bard.py script to start the chatbot with voice input and audio playback:

python bard.py

The chatbot will listen for your voice input, process your queries using Bard API, and respond with audio output. You can speak your queries and receive spoken responses from the chatbot.

To exit the chatbot, simply say "exit" or type "/exit" in the text input. To stop audio, simply say "stop" or type "/stop" in the text input.

Features

Contributing

Contributions are welcome! If you'd like to improve this project or add new features, please fork the repository and submit a pull request. Feel free to open issues for bug reports or feature requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Replace your_secure_1PSID_token, your_secure_1PSIDCC_token, and your_secure_1PSIDTS_token in the .env section with your actual Bard API tokens.