Skip to content

boulat-ashimov/Gemini-Python-Tutorial

 
 

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 88.3%
  • HTML 10.2%
  • C 1.2%
  • JavaScript 0.1%
  • CSS 0.1%
  • PowerShell 0.1%