stackConsult commited on
Commit
5b9ce2d
·
verified ·
1 Parent(s): 97376e1

Integrate DataEnrichmentManager into lead_scoring_agent - enrich profiles before scoring

Browse files
Files changed (1) hide show
  1. lead_scoring_agent.py +15 -2
lead_scoring_agent.py CHANGED
@@ -12,12 +12,25 @@ Integrates with enrichment, research, outreach, analytics, validation agents. Se
12
 
13
  from transformers import pipeline
14
  import numpy as np
 
15
 
16
  class LeadScoringAgent:
17
- def __init__(self, model_name: str = 'distilbert-base-uncased'):
18
  self.classifier = pipeline('text-classification', model=model_name)
19
-
 
20
  def score_lead(self, profile: dict) -> dict:
 
 
 
 
 
 
 
 
 
 
 
21
  text = self.profile_to_text(profile)
22
  model_result = self.classifier(text)[0]
23
  intent_score = float(model_result['score'])
 
12
 
13
  from transformers import pipeline
14
  import numpy as np
15
+ from data_enrichment import DataEnrichmentManager
16
 
17
  class LeadScoringAgent:
18
+ def __init__(self, username: str = 'default', model_name: str = 'distilbert-base-uncased'): self.classifier = pipeline('text-classification', model=model_name)
19
  self.classifier = pipeline('text-classification', model=model_name)
20
+ self.username = username
21
+ self.enrichment_manager = DataEnrichmentManager(username)
22
  def score_lead(self, profile: dict) -> dict:
23
+ # ENRICHMENT STEP: Optionally enrich profile before scoring for better accuracy
24
+ try:
25
+ enriched_data = self.enrichment_manager.enrich_contact_full(profile)
26
+ if enriched_data:
27
+ # Merge enriched data into profile for richer scoring
28
+ for key, value in enriched_data.items():
29
+ if key not in profile or not profile.get(key):
30
+ profile[key] = value
31
+ except Exception:
32
+ pass # Continue with available data if enrichment fails
33
+
34
  text = self.profile_to_text(profile)
35
  model_result = self.classifier(text)[0]
36
  intent_score = float(model_result['score'])