Skip to content

rashiaggarwal06/AI_powered_chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Chatbot with Python Tutorial

This repository contains the code for a chatbot built using the Gemini API and Python. It's accompanied by a YouTube video tutorial that guides you through the creation process.

YouTube Tutorial

Watch the full tutorial on YouTube:

Watch the video

Dependencies

This project requires the following Python libraries:

  • google-generativeai
  • python-dotenv

You can install them using pip:

pip install google-generativeai python-dotenv

Usage

  1. Set up your GEMINI_API_KEY:

Create a file named .env in the root directory of this project. Add the following line to the .env file, replacing YOUR_API_KEY with your actual Gemini API key:

GEMINI_API_KEY=YOUR_API_KEY
  1. Run the Script:
python chat.py

This will start the chatbot. You can then interact with it by typing your questions or prompts.

Note: You'll need to replace chatbot.py with the actual filename of your Python script if it's named differently.

Code Structure

  • The code consists of a single Python script (chatbot.py) that performs the following:
  • Imports necessary libraries and loads the API key from the .env file.
  • Configures the GenerativeModel with safety settings, generation configurations, and system instructions.
  • Creates a chat history list.
  • Starts a loop that continuously prompts the user for input and sends it to the model.
  • Receives the model's response and prints it to the console.
  • Updates the chat history with both user input and model responses.

License

The MIT License is used for this project. You can find the full license text here: https://opensource.org/license/mit.

Output

Project Screenshot

About

This project is a terminal-based AI chatbot developed using Python and API integrations. It leverages Python libraries to handle user input, API communication, and response generation, providing an interactive chatbot experience directly in the command line.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages