File size: 2,747 Bytes
478dec6
 
 
 
e4b8ed7
478dec6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e4b8ed7
 
478dec6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from sqlalchemy.ext.asyncio import AsyncSession
from externals.databases.pg_models import CVUser
from services.agentic.filter import AgenticFilterService
from services.agentic.weight import AgenticWeightService
from services.agentic.profile_scoring import AgenticScoringService
# from services.agentic.matching import AgenticMatchingService


from utils.logger import get_logger

logger = get_logger("agentic setup")

class AgenticService:
    """
    Facade / Orchestrator for all Agentic services
    """

    def __init__(self, db: AsyncSession, user: CVUser):
        self.db = db
        self.user = user

        self.filter = AgenticFilterService(db, user)
        self.weight = AgenticWeightService(db, user)
        self.score = AgenticScoringService(db, user)

        # self.filter = AgenticMatchingService(db, user)
        # self.filter = AgenticScoringService(db, user)


    # async def scoring_profile(self, input_scoring: PayloadMatchOne):
    #     "Generate profile scoring from an extracted profile and a criteria"
    #     try:
    #         profile : Profile = await get_profile(input_scoring.get("profile_id"))
    #         # profile : Profile = asyncio.run(get_profile(input_scoring.get("profile_id")))
            
    #         tobe_match = InputScoring(
    #             **profile,
    #             criteria=input_scoring.get("criteria"),
    #             criteria_weight=input_scoring.get("criteria_weight")
    #         )
    #         output = await match_one(input_scoring=tobe_match)
    #         # output = asyncio.run(match_one_profile(input_scoring=tobe_match))
    #         return output
        
    #     except Exception as E:
    #         logger.error(f"❌ scoring profile error, {E}")
            
    #         return ResponseExtractOne(
    #                 status="failed",
    #                 message=f"scoring profile error, {E}",
    #             )
    

    # async def scoring_bulk_profile(self, input_scorings: PayloadMatchBulk):
    #     "Generate profile scoring from list of extracted profile and a criteria"
    #     try:
    #         input_scoring_bulk = InputScoringBulk(
    #             profile_ids=input_scorings.get("profile_ids"),
    #             criteria=input_scorings.get("criteria"),
    #             criteria_weight=input_scorings.get("criteria_weight"),
    #         )
            
    #         outputs = await match_bulk(input_scoring_bulk)
    #         return outputs
        
    #     except Exception as E:
    #         logger.error(f"❌ scoring profile bulk error, {E}")
            
    #         return ResponseMatchBulk(
    #                 status="failed",
    #                 message=f"scoring profile bulk error, {E}",
    #             )