feat: Add Content Generation Engine v2 with quality scoring
Major improvements to AI content generation: ## New Components (app/services/ai/) - PromptLibrary: YAML-based prompt templates with inheritance - ContextEngine: Anti-repetition and best performers tracking - ContentGeneratorV2: Enhanced generation with dynamic parameters - PlatformAdapter: Platform-specific content adaptation - ContentValidator: AI-powered quality scoring (0-100) ## Prompt Library (app/prompts/) - 3 personalities: default, educational, promotional - 5 templates: tip_tech, product_post, service_post, thread, response - 4 platform configs: x, threads, instagram, facebook - Few-shot examples by category: ia, productividad, seguridad ## Database Changes - New table: content_memory (tracks generated content) - New columns in posts: quality_score, score_breakdown, generation_attempts ## New API Endpoints (/api/v2/generate/) - POST /generate - Generation with quality check - POST /generate/batch - Batch generation - POST /quality/evaluate - Evaluate content quality - GET /templates, /personalities, /platforms - List configs ## Celery Tasks - update_engagement_scores (every 6h) - cleanup_old_memory (monthly) - refresh_best_posts_yaml (weekly) ## Tests - Comprehensive tests for all AI engine components Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
97
app/prompts/templates/response.yaml
Normal file
97
app/prompts/templates/response.yaml
Normal file
@@ -0,0 +1,97 @@
|
||||
name: response
|
||||
description: Respuestas a interacciones de usuarios
|
||||
personality: default
|
||||
|
||||
purpose: |
|
||||
Generar respuestas apropiadas a comentarios, menciones y mensajes,
|
||||
manteniendo la voz de marca y fomentando la relación con el usuario.
|
||||
|
||||
requirements:
|
||||
- Responder al contexto específico del usuario
|
||||
- Mantener tono de marca
|
||||
- Fomentar continuación de conversación cuando apropiado
|
||||
- Ser útil sin ser condescendiente
|
||||
|
||||
response_types:
|
||||
question:
|
||||
priority: high
|
||||
goal: answer_helpfully
|
||||
follow_up: offer_more_help
|
||||
compliment:
|
||||
priority: medium
|
||||
goal: thank_genuinely
|
||||
follow_up: invite_engagement
|
||||
complaint:
|
||||
priority: critical
|
||||
goal: acknowledge_and_solve
|
||||
follow_up: take_to_dm_if_complex
|
||||
mention:
|
||||
priority: medium
|
||||
goal: engage_positively
|
||||
follow_up: depends_on_context
|
||||
|
||||
variables:
|
||||
- name: interaction_content
|
||||
type: string
|
||||
required: true
|
||||
- name: interaction_type
|
||||
type: string
|
||||
required: true
|
||||
options: ["comment", "mention", "reply", "dm"]
|
||||
- name: sentiment
|
||||
type: string
|
||||
required: false
|
||||
options: ["positive", "neutral", "negative", "question"]
|
||||
- name: context
|
||||
type: string
|
||||
required: false
|
||||
description: "Contexto adicional (post original, historial, etc.)"
|
||||
|
||||
parameters:
|
||||
temperature: 0.8
|
||||
max_tokens: 500
|
||||
|
||||
template: |
|
||||
Un usuario escribió esto en redes sociales:
|
||||
|
||||
"{interaction_content}"
|
||||
|
||||
TIPO DE INTERACCIÓN: {interaction_type}
|
||||
SENTIMIENTO DETECTADO: {sentiment}
|
||||
CONTEXTO: {context}
|
||||
|
||||
Genera 3 opciones de respuesta diferentes:
|
||||
|
||||
1. RESPUESTA CORTA: Directa y amigable (máx 100 caracteres)
|
||||
2. RESPUESTA CONVERSACIONAL: Invita a continuar el diálogo (máx 200 caracteres)
|
||||
3. RESPUESTA CON CTA: Dirige a más info o contacto (máx 200 caracteres)
|
||||
|
||||
REGLAS SEGÚN TIPO:
|
||||
|
||||
Si es PREGUNTA:
|
||||
- Responde de forma útil y específica
|
||||
- Si no sabes algo, admítelo honestamente
|
||||
- Ofrece investigar más si es necesario
|
||||
|
||||
Si es QUEJA:
|
||||
- Empatiza primero, no te defiendas
|
||||
- Ofrece solución o escalación
|
||||
- Sugiere continuar por DM si es complejo
|
||||
|
||||
Si es CUMPLIDO:
|
||||
- Agradece genuinamente (no genérico)
|
||||
- Comparte crédito si aplica
|
||||
- Invita a más engagement
|
||||
|
||||
Si es MENCIÓN:
|
||||
- Reconoce la mención
|
||||
- Aporta valor si es posible
|
||||
- Sé natural, no forzado
|
||||
|
||||
TONO:
|
||||
- Humano, no robótico
|
||||
- Amigable pero profesional
|
||||
- Útil sin ser condescendiente
|
||||
- Nunca defensivo o pasivo-agresivo
|
||||
|
||||
Responde con las 3 opciones numeradas, una por línea.
|
||||
Reference in New Issue
Block a user