File size: 6,343 Bytes
0e9ef68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
class SessionState:
    session_stage = ""
    do_evaluation = False
    do_opportunity_analysis = False
    do_customer_research = False
    do_objections = False
    add_objections_to_analysis = True   
    do_ragas_evaluation = False
    customer_research_report_md = "HSBC Quarterly Report 2024-10-16.md"
    customer_research_report_pdf = "HSBC Quarterly Report 2024-10-16.pdf"
    bettetech_value_proposition_pdf = "BetterTech Lending Analytics Solution.pdf"
    do_voice = True
    status = "active"
    scenario = None
    qa_mode = "single"
    questions = []
    start_time = None
    end_time = None
    duration_minutes = None
    attitude = "Happy"
    mood_score = 5
    num_questions = 1
    current_question_index = 0
    previous_answer = None
    question = ""
    ground_truth = ""
    rep_answer = ""
    responses = []
    queries = []
    llm_responses = []
    command = ""
    scores = []
    llm_next_steps = ""
    def __init__(self):
        self.session_stage = "research"
        self.do_evaluation = False
        self.do_opportunity_analysis = False
        self.do_customer_research = True
        self.do_objections = False
        self.add_objections_to_analysis = True
        self.do_ragas_evaluation = False
        self.customer_research_report_md = "HSBC Quarterly Report 2024-10-16.md"
        self.customer_research_report_pdf = "HSBC Quarterly Report 2024-10-16.pdf"
        self.bettetech_value_proposition_pdf = "BetterTech Lending Analytics Solution.pdf"
        self.do_voice = True
        self.status = "active"
        self.scenario = None
        self.qa_mode = "single"
        self.questions = []
        self.start_time = None
        self.end_time = None
        self.duration_minutes = None
        self.attitude = "Happy"
        self.mood_score = 5
        self.num_questions = 1
        self.current_question_index = 0
        self.previous_answer = None
        self.question = ""
        self.ground_truth = ""
        self.rep_answer = ""
        self.responses = []
        self.queries = []
        self.llm_responses = []
        self.command = ""
        self.scores = []
        self.llm_next_steps = ""
        self.company = None
        self.customer = None
        self.opportunity = None
        self.scenario = None
    class Company:
        def __init__(self, name, description, product, product_summary, product_description):
            self.name = name
            self.description = description
            self.product = product
            self.product_summary = product_summary
            self.product_description = product_description

    class Customer:
        def __init__(self, name, contact_name, contact_role):
            self.name = name
            self.contact_name = contact_name
            self.contact_role = contact_role
            self.background = None


    class Opportunity:
        def __init__(self, id, name, stage, description, value, close_date, activity, next_steps):
            self.id = id
            self.name = name
            self.stage = stage
            self.description = description
            self.value = value
            self.close_date = close_date
            self.activity = activity
            self.next_steps = next_steps
            
    def __init__(self):
        self.company = None
        self.customer = None
        self.opportunity = None
        self.scenario = None

    def add_company_info(self, name, description, product, product_summary, product_description):
        self.company = self.Company(name, description, product, product_summary, product_description)

    def add_customer_info(self, name, contact_name, contact_role):
        self.customer = self.Customer(name, contact_name, contact_role)

    def add_opportunity_info(self, id, name, stage, description, value, close_date, activity, next_steps):
        self.opportunity = self.Opportunity(id, name, stage, description, value, close_date, activity, next_steps) 

    def add_scenario_info(self, scenario_data):
        self.scenario = scenario_data
        self.add_opportunity_info(
            id=scenario_data['Opportunity ID'],
            name=scenario_data['Opportunity Name'],
            stage=scenario_data['Opportunity Stage'],
            description=scenario_data['Opportunity Description'],
            value=scenario_data['Opportunity Value'],
            close_date=scenario_data['Close Date'],
            activity=scenario_data['Activity'],
            next_steps=scenario_data['Next Steps']  
        )
        self.add_customer_info(
            name=scenario_data['Customer Name'],
            contact_name=scenario_data['Customer Contact'],
            contact_role=scenario_data['Customer Contact Role']
        )

    def get_opening(self):
        output_lines = [
            "**Simulation Scenario**",
            f"**Customer:** {self.customer.name if self.customer else 'Unknown'}",
            f"**Opportunity:** {self.opportunity.name if self.opportunity else 'Unknown'}",
            f"**Value:** {self.opportunity.value if self.opportunity and hasattr(self.opportunity, 'value') else 'Unknown'}",
            f"**Stage:** {self.opportunity.stage if self.opportunity else 'N/A'}",
            f"**Target Close Date:** {self.opportunity.close_date if self.opportunity and hasattr(self.opportunity, 'close_date') else 'Unknown'}",
            f"**Opportunity Description:** {self.opportunity.description if self.opportunity else 'Unknown'}",
            f"**Meeting with:** {self.customer.contact_name} ({self.customer.contact_role})",
            f"**Activity:** {self.opportunity.activity if self.opportunity and hasattr(self.opportunity, 'activity') else 'Unknown'}",
            f"**Current Meeting:** {self.opportunity.next_steps if self.opportunity and hasattr(self.opportunity, 'next_steps') else 'Unknown'}"
        ]
        output = "\n".join(output_lines)
        return output
    
    def __str__(self):
        company_info = f"{self.company.name} - " if self.company else ""
        customer_info = f"for {self.customer.name}" if self.customer else "No Customer"
        opportunity_info = f"{self.opportunity.name} ({self.opportunity.stage})" if self.opportunity else "No opportunity set"
        return f"{company_info}SessionState: {customer_info} {opportunity_info}".strip()