feat(pipeline): Add Stage 5 Synthesis for AI-generated narratives

- Add Stage5Synthesizer class that generates AI narratives and action plans
- Add generate() method to LLMClient for synthesis generation
- Integrate Stage 5 into pipeline runner after route stage
- Add synthesis JSONB column to pipeline.executions table
- Update reviewiq_analytics API to return synthesis data
- Synthesis includes: executive narrative, sentiment/category/timeline insights,
  action plan, marketing angles, and priority recommendations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-01-29 03:12:53 +00:00
parent c8ecb4b98f
commit 9b667e69a7
5 changed files with 3129 additions and 67 deletions

View File

@@ -0,0 +1,12 @@
-- Migration: Add synthesis column to pipeline.executions
-- This stores the AI-generated synthesis from Stage 4
ALTER TABLE pipeline.executions
ADD COLUMN IF NOT EXISTS synthesis JSONB DEFAULT NULL;
-- Add index for querying executions with synthesis
CREATE INDEX IF NOT EXISTS idx_executions_has_synthesis
ON pipeline.executions ((synthesis IS NOT NULL));
-- Comment
COMMENT ON COLUMN pipeline.executions.synthesis IS 'AI-generated synthesis containing narratives, action plan, and insights from Stage 4';