karthikmn commited on
Commit
cc86d5b
·
verified ·
1 Parent(s): 671baae

Update utilities.py

Browse files
Files changed (1) hide show
  1. utilities.py +17 -19
utilities.py CHANGED
@@ -1,21 +1,19 @@
1
- def preprocess_features(data):
2
- # Example of building a simple structured representation
3
- text = (
4
- f"Industry: {data.get('industry')}. "
5
- f"Stage: {data.get('stage')}. "
6
- f"Amount: {data.get('amount')} USD. "
7
- f"Lead Score: {data.get('lead_score')}. "
8
- f"{data.get('emails_last_7_days', 0)} emails in last 7 days. "
9
- f"{data.get('meetings_last_30_days', 0)} meetings in last 30 days."
10
  )
11
- return {"text": text}
12
 
13
- def generate_recommendation(summarizer, data):
14
- prompt = (
15
- f"Generate a next action for a deal at stage {data['stage']} with "
16
- f"{data['emails_last_7_days']} emails and {data['meetings_last_30_days']} meetings."
17
- )
18
- input_ids = summarizer.tokenizer(prompt, return_tensors="pt").input_ids
19
- output_ids = summarizer.generate(input_ids, max_new_tokens=30)
20
- summary = summarizer.tokenizer.decode(output_ids[0], skip_special_tokens=True)
21
- return summary
 
1
+ def prepare_text_input(data):
2
+ return (
3
+ f"Stage: {data.get('stage')}, "
4
+ f"Industry: {data.get('industry')}, "
5
+ f"Lead Score: {data.get('lead_score')}, "
6
+ f"Emails: {data.get('emails_last_7_days')}, "
7
+ f"Meetings: {data.get('meetings_last_30_days')}, "
8
+ f"Amount: {data.get('amount')}, "
9
+ f"Close Gap: {data.get('close_date_gap')} days"
10
  )
 
11
 
12
+ def generate_recommendation(data):
13
+ stage = data.get("stage", "").lower()
14
+ if stage == "negotiation":
15
+ return "Follow up with final pricing discussion."
16
+ elif stage == "proposal/price quote":
17
+ return "Schedule one more meeting to present value."
18
+ else:
19
+ return "Send an email to re-engage the lead."