This project is a simple terminal-based chat application that interacts with Google's Gemini generative AI model using the google-generativeai Python package. Users can have a conversation with the Gemini model directly from the command line.
-
Clone the repository:
git clone https://github.com/Sujaz/gen_ai_terminal_chat.git cd gen_ai_terminal_chat/my-python-project -
Install the required dependencies:
pip install google-generativeai
-
Set your Google Generative AI API key as an environment variable
- On Windows Command Prompt:
set API_KEY=your_api_key_here - On Windows PowerShell:
$env:API_KEY="your_api_key_here" - On Git Bash or Linux/macOS terminal:
export API_KEY=your_api_key_here
- On Windows Command Prompt:
-
Run the chat application:
python app.py
-
Build the Docker image:
docker build -t genai-app . -
Run the chat application using Docker:
docker run -ti -e API_KEY=your_api_key_here genai-app -
Start chatting!
Type your messages and press Enter. Typeexitto end the chat.
Chat started with model: gemini-2.5-flash Type 'exit' to end the chat.
You: Hello!
Gemini: Hello! How can I assist you today?
You: exit
Ending chat.
This project is licensed under the MIT License. See the LICENSE file for more details.