I have seen the emails floating around. I don't think I've joined any of the customer calls, but happy to provide inputs.
I think I got a sense Rahul right and I've put down certain things in the chat, right.
What Macy's would be looking for when I as Macy's, I'm listening to an earnings call of whoever. What am I looking for? I am thinking how will this impact retail right and in retail, how will this impact US retail, US fashion, women's fashion? How would it impact tech in retail? How will it impact my entire supply chain?
Is there a procurement impact tomorrow if you say Vietnam is getting shut down, what are the materials I'm getting from Vietnam? What is the impact to me? Right. If India something is happening this Indo Pak war is happening, right? What would be the impact for me? My it is based out of Bangalore, right? What will happen tomorrow? Let's say if India is in a state of war and everything gets shut down, our network gets blocked. What would be the impact to Macy's, right, so that that is on the supply chain procurement again, same thing, right?
What I mentioned about Vietnam where we are producing goods, China policy, whatever Trump is doing on tariffs.
Then the government policy changes in terms of tax, in terms of interest rates, in terms of subsidies being given, like for instance during COVID, right? There were a lot of handouts given, so then there was a lot of money in the hands of the people who are not even working. But then for me as a retailer, I'm thinking how do I bring them to my store so that they shop here and that money comes to me, right?
So at a very high level and then, I mean Abhiram can say contact Center for instance, right? How does it impact my agent? So like this they are. They are multiple areas in retail. Whenever I'm looking for in a certain earnings call because all of these is very intuitive to me. These are some keywords I'm thinking about.
Sure, makes sense. However, Ekta. When we had this call with Pamela, she said tariffs is a big thing, which we have kind of addressed by, you know, figuring out what tariff means and otherwise, right.
I got a sense Rahul right and I've put down certain things in the chat, right.
What Macy's would be looking for when I as Macy's, I'm listening to an earnings call of whoever. What am I looking for? I am thinking how will this impact retail right and in retail, how will this impact US retail, US fashion, women's fashion? How would it impact tech in retail? How will it impact my entire supply chain?
How will it impact my entire supply chain?
Is there a procurement impact tomorrow if you say Vietnam is getting shut down, what are the materials I'm getting from Vietnam? What is the impact to me? Right.
If India something is happening this Indo Pak war is happening, right? What would be the impact for me? My it is based out of Bangalore, right? What will happen tomorrow? Let's say if India is in a state of war and everything gets shut down, our network gets blocked. What would be the impact to Macy's, right?
Procurement again, same thing, right? What I mentioned about Vietnam where we are producing goods, China policy, whatever Trump is doing on tariffs.
Then the government policy changes in terms of tax, in terms of interest rates, in terms of subsidies being given, like for instance during COVID, right? There were
give me after 17 

Here are the sentences spoken by Ekta Agarwal after sentence 17:

18. Then the government policy changes in terms of tax, in terms of interest rates, in terms of subsidies being given, like for instance during COVID, right? There were a lot of handouts given, so then there was a lot of money in the hands of the people who are not even working. But then for me as a retailer, I'm thinking how do I bring them to my store so that they shop here and that money comes to me, right?
19. So at a very high level and then, I mean Abhiram can say contact Center for instance, right? How does it impact my agent? So like this they are. They are multiple areas in retail. Whenever I'm looking for in a certain earnings call because all of these is very intuitive to me. These are some keywords I'm thinking about.
20. Sure, makes sense. However, Ekta. When we had this call with Pamela, she said tariffs is a big thing, which we have kind of addressed by, you know, figuring out what tariff means and otherwise, right.
21. I think I got a sense Rahul right and I've put down certain things in the chat, right.
22. What Macy's would be looking for when I as Macy's, I'm listening to an earnings call of whoever. What am I looking for? I am thinking how will this impact retail right and in retail, how will this impact US retail, US fashion, women's fashion? How would it impact tech in retail? How will it impact my entire supply chain?
23. Is there a procurement impact tomorrow if you say Vietnam is getting shut down, what are the materials I'm getting from Vietnam? What is the impact to me? Right. If India something is happening this Indo Pak war is happening, right? What would be the impact for me? My it is based out of Bangalore, right? What will happen tomorrow? Let's say if India is in a state of war and everything gets shut down, our network gets blocked. What would be the impact to Macy's, right, so that that is on the supply chain procurement again, same thing, right?
24. What I mentioned about Vietnam where we are producing goods, China policy, whatever Trump is doing on tariffs.
25. Then the government policy changes in terms of tax, in terms of interest rates, in terms of subsidies being given, like for instance during COVID, right? There were a lot of handouts given, so then there was a lot of money in the hands of the people who are not even working. But then for me as a retailer, I'm thinking how do I bring them to my store so that they shop here and that money comes to me, right?

as for these important points we need to make our prompts that can fetch out the details can you correct my prompts give below do not use spesiffic question types search in prompt above are only example  give me fulll code


# ===== TariffTradeAgent =====
class TariffTradeAgent:
    def __init__(self, client, deployment_id):
        self.client = client
        self.deployment_id = deployment_id

    def analyze_document(self, text):  
        prompt = """You are a senior tariff and international trade policy analyst assisting a research team working for the CEO of Macy's. Identify all significant tariff and trade policy topics mentioned in the text that could impact Macy's business operations, supply chain, or market opportunities.  
    For each topic, provide:  
    - A clear topic name  
    - Concise 1-sentence summary describing its impact  
    - Relevance score (1-10)  
    - Specific examples of how it may affect US retail, particularly in areas like consumer behavior, supply chain logistics, and procurement strategies.  
    
    Output format:  
    - Topic Name: Summary [Relevance Score]  
    Example:  
    - USMCA Trade Agreement: Expected tariff reductions improve apparel import costs [8]  
    - Chinese Tariffs Impact: Increased tariffs lead to higher electronic goods prices [7]  
    Text:"""  
        response = self.client.chat.completions.create(  
            model=self.deployment_id,  
            messages=[  
                {"role": "system", "content": "Tariff analyst for Macy's CEO"},  
                {"role": "user", "content": prompt + "\n\n" + text}  
            ],  
            temperature=0  
        )  
        return self._parse_topics(response.choices[0].message.content.strip())  
    
    def _parse_topics(self, text):  
        topics = []  
        pattern = r'^- (.*?): (.*?) \[(\d+)\]$'  
        for line in text.split('\n'):  
            line = line.strip()  
            match = re.match(pattern, line)  
            if match:  
                topics.append({  
                    'name': match.group(1).strip(),  
                    'summary': match.group(2).strip(),  
                    'score': int(match.group(3).strip())  
                })  
        return topics  
    
    def stream_generate_detail(self, text, topic):  
        prompt = f"""You are drafting a detailed briefing for Macy's CEO on the tariff topic '{topic}' extracted from the document.  
    Provide:  
    1. An overview.  
    2. Key insights and direct excerpts.  
    3. Relevant figures or timelines.  
    4. Potential impact on Macy's retail operations, supply chain, and overall business, including specifics on consumer behavior and procurement strategies.  
    5. 3-5 strategic recommendations relevant to Macy's context.  
    
    Document:{text}  
    Topic: {topic}  
    Deliver as structured markdown suitable for executives."""  
        messages = [  
            {"role": "system", "content": "Senior tariff analyst briefing to CEO"},  
            {"role": "user", "content": prompt}  
        ]  
        response = self.client.chat.completions.create(  
            model=self.deployment_id,  
            messages=messages,  
            temperature=0,  
            stream=True,  
        )  
        return response  
  


    def generate_consolidated_summary_from_topics(self, processed_files):  
        topic_map = {}  
        all_files = set(processed_files.keys())  
        files_with_topics = set()  
    
        # Process each file and collect topics  
        for filename, filedata in processed_files.items():  
            for topic in filedata['topics']:  
                name = topic['name']  
                if name not in topic_map:  
                    topic_map[name] = {  
                        'files': set(),  
                        'summaries': [],  
                        'max_score': 0  
                    }  
                topic_map[name]['files'].add(filename)  
                topic_map[name]['summaries'].append(topic['summary'])  
                topic_map[name]['max_score'] = max(topic_map[name]['max_score'], topic['score'])  
                files_with_topics.add(filename)  
    
        files_without_topics = all_files - files_with_topics  
        content_note = (  
            f"\n\n**Note:** The following documents contained content not captured in topics: {', '.join(files_without_topics)}. "  
            "Please review separately for additional insights." if files_without_topics else ""  
        )  
    
        # Sort topics by maximum relevance score  
        sorted_topics = sorted(topic_map.items(), key=lambda x: x[1]['max_score'], reverse=True)  
        topics_text = []  
    
        for name, info in sorted_topics:  
            files = sorted(info['files'])  
            summaries = list(set(info['summaries']))  # Remove duplicate summaries  
            score = info['max_score']  
            topics_text.append(  
                f"**{name}** (Relevance: {score}/10)\n"  
                f"- Source Documents: {', '.join(files)}\n"  
                f"- Key Points:\n" + '\n'.join([f'  - {s}' for s in summaries])  
            )  
    
        topics_block = '\n\n'.join(topics_text)  
        prompt = f"""Create a consolidated tariff analysis report for Macy's executive team using these extracted topics:  
    {topics_block}  
    Guidelines:  
    1. Start with an executive summary highlighting the top 3 issues.  
    2. For each topic:  
    - Combine insights from different documents.  
    - Specify source documents.  
    - Include numerical data/timelines.  
    - Explain business impact using retail examples.  
    3. Sort by descending relevance score.  
    4. Markdown formatting with clear headings.  
    5. Add a "Need Further Review" section for uncaptured documents{content_note}  
    Avoid technical jargon. Focus on operational impacts and strategic recommendations."""  
    
        response = self.client.chat.completions.create(  
            model=self.deployment_id,  
            messages=[  
                {"role": "system", "content": "Senior analyst creating consolidated trade report"},  
                {"role": "user", "content": prompt}  
            ],  
            temperature=0.1  
        )  
        return response.choices[0].message.content.strip()  


# ===== SustainabilityAgent =====
class SustainabilityAgent:
    def __init__(self, client, deployment_id):
        self.client = client
        self.deployment_id = deployment_id

    def analyze_document(self, text):
        prompt = """
You are a senior analyst specializing in Sustainability and ESG (Environmental, Social, and Governance) topics. Identify all significant ESG-related topics mentioned in the text that could impact Macy's corporate responsibility, supply chain ethics, or brand reputation.

For each topic, provide:
- A clear topic name.
- A concise 1-sentence summary describing its impact or relevance.
- A relevance score from 1 (minor mention) to 10 (critical detail).

Output one topic per line with format:

- Topic Name: Summary [Relevance Score]

Examples:
- Carbon Emissions Reduction: Macy's aims to cut carbon footprint 30% by 2030 [9]
- Ethical Sourcing Practices: Strengthening supplier labor standards [8]
- Renewable Energy Use: Increasing use of solar energy in stores [7]

Ignore content unrelated to ESG or sustainability.

Begin analysis. Text:
"""
        response = self.client.chat.completions.create(
            model=self.deployment_id,
            messages=[
                {"role": "system", "content": "You analyze sustainability and ESG issues for Macy's management team."},
                {"role": "user", "content": prompt + "\n\n" + text}
            ],
            temperature=0
        )
        return self._parse_topics(response.choices[0].message.content.strip())

    def _parse_topics(self, text):
        topics = []
        pattern = r'^- (.*?): (.*?) \[(\d+)\]$'
        for line in text.split('\n'):
            line = line.strip()
            match = re.match(pattern, line)
            if match:
                topics.append({
                    'name': match.group(1).strip(),
                    'summary': match.group(2).strip(),
                    'score': int(match.group(3).strip())
                })
        return topics

    def stream_generate_detail(self, text, topic):
        prompt = f"""
You are drafting a detailed briefing for Macy's CEO on the sustainability topic '{topic}' extracted from the document.

Provide:
1. An overview.
2. Key insights and direct excerpts.
3. Relevant figures or timelines.
4. Potential impact on Macy's CSR, brand, and supply chain.
5. 3-5 strategic recommendations.

Document:
{text}

Topic: {topic}

Deliver as structured markdown for executives.
"""
        messages = [
            {"role": "system", "content": "Senior ESG analyst briefing to CEO"},
            {"role": "user", "content": prompt}
        ]
        response = self.client.chat.completions.create(
            model=self.deployment_id,
            messages=messages,
            temperature=0,
            stream=True,
        )
        return response
    
    def generate_consolidated_summary_from_topics(self, processed_files):
        topic_map = {}
        all_files = set(processed_files.keys())
        files_with_topics = set()

        for filename, filedata in processed_files.items():
            for topic in filedata['topics']:
                name = topic['name']
                if name not in topic_map:
                    topic_map[name] = {
                        'files': set(),
                        'summaries': [],
                        'max_score': 0
                    }
                topic_map[name]['files'].add(filename)
                topic_map[name]['summaries'].append(topic['summary'])
                topic_map[name]['max_score'] = max(topic_map[name]['max_score'], topic['score'])
                files_with_topics.add(filename)

        files_without_topics = all_files - files_with_topics
        content_note = (
            f"\n\n**Note:** The following documents contained content not captured in topics: {', '.join(files_without_topics)}. "
            "Please review separately for additional insights."
            if files_without_topics else ""
        )

        sorted_topics = sorted(topic_map.items(), key=lambda x: x[1]['max_score'], reverse=True)
        topics_text = []

        for name, info in sorted_topics:
            files = sorted(info['files'])
            summaries = list(set(info['summaries']))
            score = info['max_score']

            topics_text.append(
                f"**{name}** (Relevance: {score}/10)\n"
                f"- Source Documents: {', '.join(files)}\n"
                f"- Key Points:\n" +
                '\n'.join([f'  - {s}' for s in summaries])
            )

        topics_block = '\n\n'.join(topics_text)

        prompt = f"""
    Create a consolidated sustainability analysis report for Macy's executive team using these extracted topics:

    {topics_block}

    Guidelines:
    1. Start with executive summary highlighting top 3 ESG priorities
    2. For each topic:
    - Combine insights from different documents
    - Specify source documents
    - Include numerical targets and timelines
    - Explain brand/reputation impact using retail examples
    3. Sort by descending relevance score
    4. Markdown formatting with clear headings
    5. Add "Need Further Review" section for uncaptured documents{content_note}

    Focus on operational impacts and sustainability strategy recommendations.
    Avoid technical jargon. Use retail-specific examples.
    """

        response = self.client.chat.completions.create(
            model=self.deployment_id,
            messages=[
                {"role": "system", "content": "Senior analyst creating consolidated sustainability report"},
                {"role": "user", "content": prompt}
            ],
            temperature=0
        )
        return response.choices[0].message.content.strip()