Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Content Microservice

Microservicio profesional de generación de contenido con IA utilizando FastAPI y Google Gemini.

Características

  • API REST con FastAPI
  • Integración con Google Gemini AI
  • Frontend web interactivo
  • Arquitectura modular y escalable
  • CORS habilitado
  • Documentación automática (Swagger)

Estructura del Proyecto

ai-microservice/
├── app/
│   ├── config/          # Configuración
│   ├── routes/          # Endpoints de la API
│   ├── schemas/         # Modelos Pydantic
│   └── services/        # Lógica de negocio
├── static/              # Frontend
├── main.py              # Punto de entrada
└── requirements.txt     # Dependencias

Instalación

  1. Clonar el repositorio

  2. Crear entorno virtual:

python -m venv venv
source venv/bin/activate  # En Windows: venv\Scripts\activate
  1. Instalar dependencias:
pip install -r requirements.txt
  1. Configurar variables de entorno:
cp .env.example .env
# Edita .env y agrega tu GEMINI_API_KEY

Obtén tu API key en: https://makersuite.google.com/app/apikey

Uso

Iniciar el servidor:

uvicorn main:app --reload

El servicio estará disponible en:

API Endpoints

GET /health

Health check endpoint.

Response:

{
  "status": "healthy",
  "service": "AI Content Microservice"
}

POST /api/v1/content/stream

Genera contenido con streaming (recomendado).

Request:

{
  "topic": "Inteligencia Artificial",
  "tone": "profesional",
  "max_length": 300
}

Response: Streaming de texto en tiempo real

POST /api/v1/content/

Genera contenido sin streaming (para comparación).

Request:

{
  "topic": "Inteligencia Artificial",
  "tone": "profesional",
  "max_length": 300
}

Response:

{
  "generated_text": "Contenido generado por Gemini...",
  "latency": 5.23
}

Tecnologías

  • FastAPI - Framework web moderno y rápido
  • Google Gemini - Modelo de IA generativa
  • Pydantic - Validación de datos
  • Uvicorn - Servidor ASGI

Licencia

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages