diff --git a/gemini chatbot/Gemini-Chatbot b/gemini chatbot/Gemini-Chatbot new file mode 160000 index 00000000..9d3c59a9 --- /dev/null +++ b/gemini chatbot/Gemini-Chatbot @@ -0,0 +1 @@ +Subproject commit 9d3c59a9e3b949733d4fb3361e3abfc061d70271 diff --git a/gemini chatbot/chatbot.py b/gemini chatbot/chatbot.py new file mode 100644 index 00000000..1f8fe269 --- /dev/null +++ b/gemini chatbot/chatbot.py @@ -0,0 +1,24 @@ +import google.generativeai as genai + +genai.configure(api_key="GOOGLE_GEMINI_API_KEY") + +model = genai.GenerativeModel("gemini-1.5-flash") + +chat = model.start_chat(history=[]) + +def chat_with_gemini(): + print("🤖 Gemini ChatBot (type 'exit' to quit)") + while True: + user_input = input("You: ") + if user_input.lower() in ["exit", "quit"]: + print("Bot: Goodbye 👋") + break + + try: + response = chat.send_message(user_input) + print("Bot:", response.text) + except Exception as e: + print("⚠️ Error:", e) + +if __name__ == "__main__": + chat_with_gemini() \ No newline at end of file diff --git a/gemini chatbot/readme.txt b/gemini chatbot/readme.txt new file mode 100644 index 00000000..9022c64f --- /dev/null +++ b/gemini chatbot/readme.txt @@ -0,0 +1,19 @@ +---------------------------------------------- Gemini ChatBot 🤖 ---------------------------------------------- + +Welcome to the Gemini ChatBot Project — an intelligent, Python-based chatbot powered by Google’s Gemini 1.5 Flash model. This project allows you to have smart, interactive conversations directly in the terminal. It’s ideal for developers, students, or hobbyists exploring Generative AI and conversational interfaces. Whether you're curious about large language models or looking to contribute to open-source AI tools, this chatbot is a perfect place to start. + +The Gemini ChatBot maintains conversation history, enabling more context-aware and meaningful interactions. It uses Google’s official Generative AI Python SDK to communicate with the Gemini API. The code is written for clarity and modularity, making it easy to customize, extend, and learn from. + +To get started, you’ll need Python 3.8 to 3.10 installed on your machine (Python 3.13 may not be fully compatible yet) and an API key from Google AI Studio, which you can obtain for free. The chatbot is designed to run in a command-line environment and responds to your input in real-time, simulating a natural conversation. You can modify the script to integrate it into other platforms later, such as a web app or a GUI interface. + +To ensure clean package management and avoid conflicts with other Python projects, it’s recommended to set up a Conda environment. Start by opening Anaconda Prompt or your terminal, then create a new environment with Python 3.10. Once the environment is created and activated, you can install the required google-generativeai package using pip. After that, you're ready to run the chatbot. + +To launch the chatbot, navigate to the project folder in your terminal and run the Python script. The chatbot will start with a greeting and wait for your input. Simply type anything you’d like to ask or discuss. You can chat freely, and the model will respond with AI-generated replies. To end the session at any time, just type “exit” or “quit,” and the chatbot will close the conversation with a goodbye message. + +The project folder is organized for simplicity and ease of use. The main script is chatbot.py, where all the chatbot logic is implemented. The requirements.txt file contains a list of dependencies, so others can easily replicate your environment using pip. A .gitignore file is included to exclude virtual environment folders and temporary files from version control. + +Looking ahead, there are many exciting directions this project could take. You can add a web interface using Streamlit or Flask, implement support for file or image inputs using Gemini Pro Vision, enable chat logging to save previous conversations, or even integrate secure key storage using environment variables. These enhancements are perfect opportunities for open-source contributions. + +If you’d like to contribute, you’re welcome to fork the repository, create your own feature branch, and submit a pull request. Feedback, improvements, and new ideas are encouraged — collaboration is at the heart of open-source. + +Thank you for checking out the Gemini ChatBot! Whether you’re here to learn, experiment, or build, we hope this project helps you get one step closer to the future of AI-powered applications. Let’s build something incredible together. 🚀 diff --git a/gemini chatbot/requirements.txt b/gemini chatbot/requirements.txt new file mode 100644 index 00000000..ac4a68a3 --- /dev/null +++ b/gemini chatbot/requirements.txt @@ -0,0 +1 @@ +google-generativeai>=0.3.2