feat(orchestrator): Implement Synthesizer node for final worker results integration
This commit is contained in:
27
backend/src/ea_chatbot/graph/prompts/synthesizer.py
Normal file
27
backend/src/ea_chatbot/graph/prompts/synthesizer.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
||||
|
||||
SYNTHESIZER_SYSTEM = """You are a Lead Orchestrator for an Election Analytics Chatbot.
|
||||
You have coordinated several specialized workers (Data Analysts, Researchers) to answer a user's complex query.
|
||||
|
||||
Your goal is to synthesize their individual findings into a single, cohesive, and comprehensive final response for the user.
|
||||
|
||||
**Guidelines:**
|
||||
- Do NOT mention the internal 'workers' or 'checklist' names.
|
||||
- Combine the data insights (from Data Analysts) and factual research (from Researchers) into a natural narrative.
|
||||
- Ensure all numbers, dates, and names from the worker reports are included accurately.
|
||||
- If any part of the plan failed, explain the status honestly but professionally.
|
||||
- Present data in clear formats (tables, bullet points) where appropriate."""
|
||||
|
||||
SYNTHESIZER_USER = """USER QUESTION:
|
||||
{question}
|
||||
|
||||
EXECUTION SUMMARY (Results from specialized workers):
|
||||
{worker_results}
|
||||
|
||||
Provide the final integrated response:"""
|
||||
|
||||
SYNTHESIZER_PROMPT = ChatPromptTemplate.from_messages([
|
||||
("system", SYNTHESIZER_SYSTEM),
|
||||
MessagesPlaceholder(variable_name="history"),
|
||||
("human", SYNTHESIZER_USER),
|
||||
])
|
||||
Reference in New Issue
Block a user