this is an sample example
from agents.base_agent import BaseAgent
class ConsumerHealthAgent(BaseAgent):
prompt_sys = "Consumer health and macroeconomic analyst for Macy's, tasked with analyzing provided documents regarding consumer financial health and macro environment."
# Universal formatting enforcement line (adapted and extended where necessary)
formatting_directive = """Please strictly follow these formatting guidelines for all numerical mentions and sentence structures:
- No Combined Elements: Always space-separate numbers, words, and units (e.g., "3.3 billion" not "3.3billion").
- Time Formatting: Use formats like "Q4 2024" (never "Q42024" or "4th quarter").
- Number Rules:
- 3.3B → 3.3 billion
- 150.2M → 150.2 million
- 0.33 → keep exact decimal
- Text Integrity:
- "net income" never "netincome"
- "year-over-year" never "YOY" or "yearoveryear"
- "YOY " never "year-over-year" or "yearoveryear"
- "vs." never "versus" or "vs"
- "XB"never"X billion"
- "XM"never"X million"
- Style Prohibition: Do not italicize or alter text formatting; maintain a single plain format throughout.
- Bad Example:
3.3billioninQ42024,withanadjustednetincomeof,106million,withadjustedearningsperdilutedshareat0.95 → REJECTED
- ALWAYS Required Format:
3.3 billion in Q4 2024, with an adjusted net income of → ACCEPTED
APPLY THESE RULES TO ALL NUMERICAL MENTIONS AND SENTENCE STRUCTURES."""
prompt_analyze = (
"You are a senior business analyst working directly for Macy's CEO. Analyze the provided earnings call transcript and summarize mentions "
"of consumer financial health and the macroeconomic environment.\n\n"
"Identify key topics including but not limited to:\n"
"- US consumer\n"
"- The company’s customer\n"
"- Change in demand\n"
"- Change in spend\n\n"
"For each topic, provide:\n"
"- A clear topic name (e.g., \"E-commerce Growth\", \"Supply Chain Digitization\")\n"
"- Concise 100-word summary providing key numbers and operational impacts\n"
"- Strictly preserve original numerical and textual formatting: maintain exact decimals (0.33), required spacing (0.11 → '0.11'), and verbatim terminology without concatenation or rephrasing.\n"
"- For every topic, ALWAYS provide excerpts mentioned under the heading \"Ground Truth\" as follows:\n"
" - For each document where the topic appears, extract the exact, unmodified sentence(s) or paragraph(s) from the original document.\n"
" - Format each excerpt as: **Ground Truth:** \"Exact text from the document...\" (Document Name)\n"
" - If a topic is present in multiple documents, include a separate \"Ground Truth\" excerpt for each document.\n"
" - Do NOT paraphrase, summarize, or alter the original text in any way. The excerpt must match the document data exactly, including all formatting, punctuation, and special characters.\n"
" - If the LLM cannot find an exact match in the document, do NOT fabricate or modify the excerpt—only include what is present in the documents.\n\n"
"Format each topic as:\n"
"- Topic Name: Summary [Relevance Score]\n\n"
"Example:\n"
"- Holiday Sales Performance: Q4 comparable sales up 4.2% driven by 18% digital growth [8]\n"
"- Inventory Optimization: Implementing AI demand forecasting to reduce carrying costs by $150M [7]\n\n"
"Document Text: " + formatting_directive
)
prompt_summary = (
"You are a senior analyst preparing a summary of transcript commentary from all documents provided.\n"
"Identify and describe all mentions of consumer financial health and the macroeconomic environment in the provided documents, "
"focusing on what the company says about the US consumer, their customer, a change in demand, or a change in spend. Combine and synthesize topics that appear in multiple documents.\n\n"
"1. **Overview**: Identify and describe all mentions of consumer financial health and the macroeconomic environment in the provided documents.\n\n"
"2. For each topic:\n"
" * Provide a concise summary by combining information from all relevant documents.\n"
" * Include relevant examples, numerical data, or timelines from the documents.\n"
" * For every topic, ALWAYS provide each excerpt mentioned under the heading \"Ground Truth\" as follows:\n"
" - For each document where the topic appears, extract the exact, unmodified sentence(s) or paragraph(s) from the original document.\n"
" - Format each excerpt as: **Ground Truth:** \"Exact text from the document...\" (Document Name)\n"
" - If the same topic is present in multiple documents, always include a separate \"Ground Truth\" excerpt for each document with proper line breaks.\n"
" - Do NOT paraphrase, summarize, or alter the original text in any way. The excerpt must match the documents data exactly, including all formatting, punctuation, and special characters.\n"
" - If the LLM cannot find an exact match in the document, do NOT fabricate or modify the excerpt—only include what is present in the document.\n\n"
"3. Format with clear sections in plain black text with proper headings:\n"
" * Consumer Health Summary\n\n"
"Use the following Documents Analysis Data to combine similar topics from different documents and provide a comprehensive summary:\n"
"{topics_block}\n\n"
"Provide a comprehensive yet concise summary. STRICTLY ENFORCE PLAIN TEXT FORMATTING:\n"
+ formatting_directive
)
prompt_detail = (
"You are preparing a detailed briefing for Macy's CEO on the consumer health topic '{topic}', based on the external company document.\n\n"
"Provide:\n"
"1. Overview of the topic.\n"
"2. Key insights and relevant excerpts.\n"
"3. Important figures, timelines, or operational metrics.\n"
"4. Detailed analysis of the impact on Macy's consumer health outlook and macroeconomic environment.\n"
"5. For every topic, ALWAYS provide verbatim source excerpts under the heading \"Ground Truth\" as follows:\n"
" - For each document where the topic appears, extract the exact, unmodified sentence(s) or paragraph(s) from the original document.\n"
" - Format each excerpt as: **Ground Truth:** \"Exact text from the document...\" (Document Name)\n"
" - If a topic is present in multiple documents, include a separate \"Ground Truth\" excerpt for each document.\n"
" - Do NOT paraphrase, summarize, or alter the original text in any way. The excerpt must match the source exactly, including all formatting, punctuation, and special characters.\n"
" - If the LLM cannot find an exact match in the document, do NOT fabricate or modify the excerpt—only include what is present in the source.\n\n"
"Document:\n"
"{text}\n\n"
"Topic: {topic}\n\n"
"Please provide a structured briefing with proper paragraphs and bold topics.\n"
+ formatting_directive
)
def analyze_document(self, text, custom_prompt=None):
prompt_analyze = custom_prompt if custom_prompt else self.prompt_analyze
return super().analyze_document(self.prompt_sys, prompt_analyze, text)
def generate_consolidated_summary_from_topics(self, processed_files, custom_prompt=None):
prompt_summary = custom_prompt if custom_prompt else self.prompt_summary
return super().generate_consolidated_summary_from_topics(self.prompt_sys, prompt_summary, processed_files)
def generate_topic_detail(self, text, topic, custom_prompt=None):
prompt_detail = custom_prompt if custom_prompt else self.prompt_detail
return super().generate_topic_detail(self.prompt_sys, prompt_detail, text, topic)
as per this same file we need to create for the CategoryPerformanceAgent and the prompts inside it is like below
Category Performance
Prompt: Summarize merchandise categories that performed positively or negatively during the reported quarter. Separately, provide any specific merchandise brands that performed positively or negatively. If no detail is provided, say “N/A”.
Categories include apparel, footwear, accessories, beauty and home.