Chatbot CLI para Google Gemini con gestión de API Keys, historial y selección de modelos.
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
PyGemAi: Chatbot CLI para Modelos Google Gemini
PyGemAi es una aplicación de línea de comandos (CLI) que te permite interactuar de forma sencilla y eficiente con los modelos de Inteligencia Artificial de Google Gemini directamente desde tu terminal.
Características Principales
- Interfaz de Chat Intuitiva: Conversa con los modelos Gemini de forma fluida.
- Gestión Segura de Clave API:
- Soporte para carga desde variable de entorno (
GOOGLE_API_KEY). - Opción para guardar la clave API localmente de forma encriptada con contraseña.
- Opción para guardar sin encriptar (no recomendado) o no guardar localmente.
- Manejo de intentos de contraseña y eliminación segura de archivos de clave corruptos.
- Soporte para carga desde variable de entorno (
- Selección Dinámica de Modelos:
- Lista y permite seleccionar entre los modelos Gemini disponibles para generación de contenido.
- Ordena los modelos por relevancia (priorizando "latest", "pro", "flash").
- Recuerda y sugiere el último modelo utilizado.
- Historial de Conversaciones:
- Opción para cargar el historial de chat previo para un modelo específico.
- Opción para guardar la sesión de chat actual al finalizar.
- Los historiales se guardan en archivos
.jsonseparados por modelo.
- Personalización:
- Guarda las preferencias del último modelo usado.
- Uso de colores ANSI para una mejor legibilidad en la terminal.
- Empaquetado y Listo para Usar: Configurado con
setup.pyypyproject.tomlpara una fácil instalación y uso del comandopygemai.
Requisitos Previos
- Python 3.8 o superior.
pip(el gestor de paquetes de Python).- Una Clave API de Google Gemini válida (puedes obtenerla en Google AI Studio).
Instalación
-
Clona el Repositorio:
git clone [https://github.com/TU_USUARIO_GITHUB/PyGemAi.git](https://github.com/TU_USUARIO_GITHUB/PyGemAi.git) cd PyGemAi
-
Crea y Activa un Entorno Virtual (Recomendado):
python3 -m venv .venv
Activación (ejemplos):
- Linux/macOS (bash/zsh):
source .venv/bin/activate - Linux/macOS (fish):
source .venv/bin/activate.fish - Windows (cmd):
.venv\Scripts\activate.bat - Windows (PowerShell):
.venv\Scripts\Activate.ps1
- Linux/macOS (bash/zsh):
-
Instala PyGemAi y sus Dependencias: Desde el directorio raíz del proyecto (donde está
setup.py), ejecuta:pip install -e .
Esto instalará el paquete
PyGemAien modo editable y el comandopygemaiestará disponible mientras tu entorno virtual esté activado. Las dependencias principales songoogle-generativeaiycryptography.
Configuración de la Clave API
Al ejecutar pygemai por primera vez, o si no se detecta una clave API, se te guiará para configurarla. Tienes varias opciones:
- Usar la variable de entorno
GOOGLE_API_KEY. - Ingresarla manualmente y elegir guardarla de forma encriptada (recomendado), sin encriptar, o no guardarla.
Para más detalles sobre la configuración y gestión de la clave API, consulta la Guía de Uso detallada (GUIDE_OF_USE.md).
Uso Básico
Una vez instalado y configurada la clave API:
-
Ejecuta el Chatbot: Abre tu terminal (con el entorno virtual activado) y escribe:
pygemai
-
Selecciona un Modelo: Sigue las instrucciones en pantalla para elegir un modelo de IA.
-
Chatea: Escribe tus mensajes y presiona Enter.
-
Sal del Chat: Escribe
salir,exit,quit, o presionaCtrl+C. -
Guarda el Historial: Se te preguntará si deseas guardar el historial de la sesión.
Para una explicación completa de todas las características, opciones de línea de comandos (si las hubiera en el futuro), y solución de problemas, por favor consulta la Guía de Uso (GUIDE_OF_USE.md).
Estructura del Proyecto (para Desarrolladores)
Este proyecto utiliza una estructura src/ donde el paquete principal pygemai_cli contiene la lógica de la aplicación (main.py).
Contribuciones
Las contribuciones son bienvenidas. Por favor, abre un issue para discutir cambios importantes o reportar errores. Si deseas contribuir con código, considera hacer un fork del repositorio y enviar un pull request.
Licencia
Este proyecto está licenciado bajo los términos de la GNU General Public License v3.0 o posterior. Consulta el archivo LICENSE para más detalles.
Copyright (C) <Julio César Martínez> julioglez@gmail.com
Este programa es software libre: usted puede redistribuirlo y/o modificarlo bajo los términos de la Licencia Pública General GNU publicada por la Fundación para el Software Libre, ya sea la versión 3 de la Licencia, o (a su opción) cualquier versión posterior.
Este programa se distribuye con la esperanza de que sea útil, pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la Licencia Pública General GNU para más detalles.
Usted debería haber recibido una copia de la Licencia Pública General GNU junto con este programa. Si no, consulte https://www.gnu.org/licenses/.
Contacto
Julio César Martínez - julioglez@gmail.com
Desarrollado con ❤️ y Python.
English Version
PyGemAi: CLI Chatbot for Google Gemini Models
PyGemAi is a command-line interface (CLI) application that allows you to easily and efficiently interact with Google Gemini Artificial Intelligence models directly from your terminal.
Main Features
- Intuitive Chat Interface: Converse fluently with Gemini models.
- Secure API Key Management:
- Support for loading from environment variable (
GOOGLE_API_KEY). - Option to save the API key locally encrypted with a password.
- Option to save unencrypted (not recommended) or not save locally.
- Password attempt handling and secure deletion of corrupted key files.
- Support for loading from environment variable (
- Dynamic Model Selection:
- Lists and allows selection from available Gemini models for content generation.
- Sorts models by relevance (prioritizing "latest", "pro", "flash").
- Remembers and suggests the last used model.
- Conversation History:
- Option to load previous chat history for a specific model.
- Option to save the current chat session upon exiting.
- Histories are saved in separate
.jsonfiles per model.
- Customization:
- Saves preferences for the last used model.
- Use of ANSI colors for better readability in the terminal.
- Packaged and Ready to Use: Configured with
setup.pyandpyproject.tomlfor easy installation and use of thepygemaicommand.
Prerequisites
- Python 3.8 or higher.
pip(the Python package manager).- A valid Google Gemini API Key (you can get one at Google AI Studio).
Installation
-
Clone the Repository:
git clone https://github.com/YOUR_GITHUB_USERNAME/PyGemAi.git # Replace YOUR_GITHUB_USERNAME/PyGemAi with the actual URL of your repository cd PyGemAi
-
Create and Activate a Virtual Environment (Recommended):
python3 -m venv .venv
Activation (examples):
- Linux/macOS (bash/zsh):
source .venv/bin/activate - Linux/macOS (fish):
source .venv/bin/activate.fish - Windows (cmd):
.venv\Scripts\activate.bat - Windows (PowerShell):
.venv\Scripts\Activate.ps1
- Linux/macOS (bash/zsh):
-
Install PyGemAi and its Dependencies: From the project's root directory (where
setup.pyis located), run:pip install -e .
This will install the
PyGemAipackage in editable mode, and thepygemaicommand will be available as long as your virtual environment is activated. The main dependencies aregoogle-generativeaiandcryptography.
API Key Configuration
When running pygemai for the first time, or if no API key is detected, you will be guided to configure it. You have several options:
- Use the
GOOGLE_API_KEYenvironment variable. - Enter it manually and choose to save it encrypted (recommended), unencrypted, or not save it.
For more details on API key configuration and management, refer to the detailed User Guide (GUIDE_OF_USE.md).
Basic Usage
Once installed and the API key is configured:
-
Run the Chatbot: Open your terminal (with the virtual environment activated) and type:
pygemai
-
Select a Model: Follow the on-screen instructions to choose an AI model.
-
Chat: Type your messages and press Enter.
-
Exit the Chat: Type
salir,exit,quit, or pressCtrl+C. -
Save History: You will be asked if you want to save the session history.
For a complete explanation of all features, command-line options (if any in the future), and troubleshooting, please refer to the User Guide (GUIDE_OF_USE.md).
Project Structure (for Developers)
This project uses an src/ structure where the main pygemai_cli package contains the application logic (main.py).
Contributions
Contributions are welcome. Please open an issue to discuss important changes or report bugs. If you wish to contribute code, consider forking the repository and submitting a pull request.
License
This project is licensed under the terms of the GNU General Public License v3.0 or later. See the LICENSE file for more details.
Copyright (C) <Julio César Martínez> julioglez@gmail.com
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Contact
Julio César Martínez - julioglez@gmail.com
Developed with ❤️ and Python.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygemai-1.1.2.tar.gz.
File metadata
- Download URL: pygemai-1.1.2.tar.gz
- Upload date:
- Size: 54.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c0a9dc44bf6a20f11c04b7f7d5f193ee4532dc247500dc59f28de3fe81e5bb9
|
|
| MD5 |
0e450d00563519bfa7e9f5ae04aaec59
|
|
| BLAKE2b-256 |
dd15e419068e79d19a00a4c48d90fc9230bc3c567aa8c5c5afcea528bcae5068
|
File details
Details for the file pygemai-1.1.2-py3-none-any.whl.
File metadata
- Download URL: pygemai-1.1.2-py3-none-any.whl
- Upload date:
- Size: 38.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52d7c58d915c2f4c1f8fc0c284156f07146500bdc1a3c52ce074c5f3d0561fa0
|
|
| MD5 |
d9ed4286f57eb97fc43f8a64f9a045cb
|
|
| BLAKE2b-256 |
a9ca5a53cf2d328f64d1bfb7658bb3cd7131027649ef53ff1c9fe6a14a6d394f
|