Archive: System v4 - Estado al 2024-12-24

This commit is contained in:
ARCHITECT
2025-12-24 17:28:34 +00:00
parent a92d41c846
commit 1b392803fd
81 changed files with 24560 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
# GRACE - Despliegue en RunPod
## Estado Actual
| Componente | Estado |
|------------|--------|
| Endpoint ID | `r00x4g3rrwkbyh` |
| Template ID | `16zimxx2xj` |
| Nombre | grace-gpu |
| GPU | RTX 4090 |
| Balance | $73+ |
| Imagen | PENDIENTE |
## Problema
El template usa la imagen base `runpod/pytorch:2.1.0-py3.10-cuda11.8.0-devel-ubuntu22.04` sin el handler de GRACE. Necesita imagen custom.
## Solucion: Build y Push Docker Image
### Opcion 1: Build Local
```bash
# En maquina con Docker
cd grace/runpod
# Build
docker build -t tzzrsystems/grace:latest .
# Login a DockerHub
docker login
# Push
docker push tzzrsystems/grace:latest
```
### Opcion 2: GitHub Actions (Recomendado)
Crear `.github/workflows/build-grace.yml`:
```yaml
name: Build GRACE Docker
on:
push:
branches: [main]
paths: ['runpod/**']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: ./runpod
push: true
tags: tzzrsystems/grace:latest
```
## Actualizar Template en RunPod
Una vez la imagen este en DockerHub:
```bash
curl -X POST "https://api.runpod.io/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"query": "mutation { saveTemplate(input: { id: \"16zimxx2xj\", imageName: \"tzzrsystems/grace:latest\" }) { id imageName } }"
}'
```
## Verificar Funcionamiento
```bash
# Test EMBEDDINGS (mas rapido)
curl -X POST "https://api.runpod.ai/v2/r00x4g3rrwkbyh/runsync" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"contract_version": "2.1",
"routing": {"module": "EMBEDDINGS"},
"payload": {"type": "text", "encoding": "utf-8", "content": "Test"},
"context": {}
}
}'
```
## Modulos Disponibles
| Modulo | Uso | Modelo |
|--------|-----|--------|
| ASR_ENGINE | Audio -> Texto | Whisper Large V3 |
| OCR_CORE | Imagen -> Texto | GOT-OCR 2.0 |
| TTS | Texto -> Audio | XTTS-v2 |
| EMBEDDINGS | Texto -> Vector | BGE-Large |
| FACE_VECTOR | Imagen -> Vector facial | InsightFace |
| AVATAR_GEN | Prompt -> Imagen | SDXL |
## Estimacion de Costos
RTX 4090: ~$0.44/hora
- Cold start: 2-4 min
- Idle timeout: 10 seg
Con minWorkers=0 solo pagas por uso real.
---
*Documentacion generada 2025-12-24*

View File

@@ -0,0 +1,51 @@
# GRACE - GPU Real-time Audio Conversion Engine
## Descripción
Servicio de conversión de audio en tiempo real usando GPU.
## Módulos
- **ASR_ENGINE**: Speech-to-Text (Whisper)
- **TTS_ENGINE**: Text-to-Speech (XTTS)
## Endpoint RunPod
- ID: `r00x4g3rrwkbyh`
- URL: `https://api.runpod.ai/v2/r00x4g3rrwkbyh/runsync`
- Workers: 2
- GPU: NVIDIA L4
## Código
Ubicación: `s3://architect/gpu-services/grace/code/handler.py`
## Uso
### ASR (Speech-to-Text)
```json
{
"input": {
"module": "ASR_ENGINE",
"data": {
"audio_base64": "...",
"language": "es"
}
}
}
```
### TTS (Text-to-Speech)
```json
{
"input": {
"module": "TTS_ENGINE",
"data": {
"text": "Hola mundo",
"language": "es",
"voice_id": "default"
}
}
}
```
## Arquitectura
```
Cliente → RunPod → GRACE Handler → Whisper/XTTS → Response
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,139 @@
# ✨ GRACE
**Capa Cognitiva Determinista - Sistema SFE/HST Enterprise v5.0**
> "GRACE transforma, Alfred decide."
---
## ¿Qué es GRACE?
GRACE es la capa cognitiva del sistema: 18 microservicios de IA desacoplados.
- NO es chatbot
- NO guarda estado
- NO toma decisiones de flujo
- Transforma datos según request
- Intercambiable: sustituir modelo sin romper sistema
```
┌──────────────────┐
│ ALFRED (n8n) │
│ Orquestador │
└────────┬─────────┘
┌──────────────┼──────────────┐
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ LOCAL │ │ LOCAL │ │ REMOTO │
│ Ligero │ │ Medio │ │ Pesado │
│ (CPU) │ │ (CPU+) │ │ (GPU) │
└──────────┘ └──────────┘ └──────────┘
Whisper-tiny Embeddings GPT-4o Vision
Regex/Rules OCR-Local Claude Sonnet
Hashing Whisper Large
```
---
## Los 18 Módulos
### Familia VISIÓN
| Módulo | Función |
|--------|---------|
| `IMAGE_PROCESSOR` | Limpieza, resize, crop, denoise |
| `PDF_SCANNER` | Recorte automático, deskew, contraste |
| `OCR_CORE` | Lectura de texto |
### Familia VOZ
| Módulo | Función |
|--------|---------|
| `ASR` | Audio → Texto |
| `TTS` | Texto → Audio |
### Familia IDENTIDAD
| Módulo | Función | PII |
|--------|---------|-----|
| `FACE_VECTOR` | Extrae vector facial 512D | ✓ |
| `ID_CONSOLIDATION` | Fusiona múltiples vectores | ✓ |
| `AVATAR_GEN` | Genera avatar desde vector | - |
### Familia NLP
| Módulo | Función |
|--------|---------|
| `SUMMARIZER` | Resume texto |
| `CLASSIFIER` | Clasifica documentos |
| `TASK_DETECTOR` | Extrae tareas de texto |
### Familia SEMÁNTICA
| Módulo | Función |
|--------|---------|
| `EMBEDDINGS` | Texto → vectores |
| `SIMILARITY` | Compara vectores |
### Familia ESTRUCTURA
| Módulo | Función |
|--------|---------|
| `FIELD_EXTRACTOR` | Extrae campos de documentos |
| `HASH_SIGNER` | SHA256/512/BLAKE2B |
| `LANG_NORMALIZER` | Detecta idioma |
| `INPUT_TRANSLATOR` | Normaliza entrada |
| `OUTPUT_TRANSLATOR` | Formato legacy |
---
## Arquitectura Híbrida
| Tier | Tipo | Proveedores |
|------|------|-------------|
| **TIER 1** | GPU Serverless | RunPod, Modal, Replicate |
| **TIER 2** | APIs Premium | OpenAI, Anthropic, Google |
**Routing por módulo**: Cada módulo define su cadena de fallback.
---
## Inicio Rápido
```bash
# Instalar
pip install -r requirements.txt
# Configurar
cp .env.example .env
# Ejecutar
uvicorn app.main:app --reload
# Verificar
curl http://localhost:8000/health
```
---
## Contrato Común v1.2
Todos los módulos usan la misma interfaz:
```json
{
"envelope": {
"trace_id": "uuid",
"step_id": "uuid"
},
"routing": {
"module": "OCR_CORE",
"version": "1.0"
},
"payload": {
"type": "image",
"content": "base64..."
}
}
```
---
**Sistema SFE/HST Enterprise v5.0**