File size: 2,687 Bytes
a8ee0db
67ce3bc
6ee44e5
67ce3bc
 
a8ee0db
67ce3bc
a8ee0db
67ce3bc
 
a8ee0db
67ce3bc
a8ee0db
 
 
 
 
 
 
 
 
67ce3bc
a8ee0db
67ce3bc
a8ee0db
 
 
 
 
 
 
 
 
 
 
 
 
67ce3bc
a8ee0db
 
cb30661
a8ee0db
 
 
cb30661
6ee44e5
 
a8ee0db
 
6ee44e5
a8ee0db
 
 
 
6ee44e5
a8ee0db
 
 
 
 
 
 
 
 
 
 
81872d9
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
import json
from crewai import Crew, Process
from .agents import report_generator_agent, skills_extractor_agent, experience_extractor_agent, project_extractor_agent, education_extractor_agent, ProfileBuilderAgent, informations_personnelle_agent, reconversion_detector_agent
from .tasks import generate_report_task
from typing import List

def run_interview_analysis(conversation_history: list, job_description_text: str, analyzer_model, rag_handler) -> str:
    """
    Analyse l'intégralité de la conversation et génère un rapport de feedback.
    Cette fonction est conçue pour être appelée en arrière-plan.
    """
    structured_analysis = analyzer_model.run_full_analysis(conversation_history, job_description_text)
    rag_feedback = []
    if structured_analysis.get("intent_analysis"):
        for intent in structured_analysis["intent_analysis"]:
            query = f"Conseils pour un candidat qui cherche à {intent['labels'][0]}"
            rag_feedback.extend(rag_handler.get_relevant_feedback(query))
    
    if structured_analysis.get("sentiment_analysis"):
        for sentiment_group in structured_analysis["sentiment_analysis"]:
            for sentiment in sentiment_group:
                if sentiment['label'] == 'stress' and sentiment['score'] > 0.6:
                    rag_feedback.extend(rag_handler.get_relevant_feedback("gestion du stress en entretien"))

    unique_feedback = list(set(rag_feedback))
    interview_crew = Crew(
        agents=[report_generator_agent],
        tasks=[generate_report_task],
        process=Process.sequential,
        verbose=False,
        telemetry=False
    )

    final_report = interview_crew.kickoff(inputs={
        'structured_analysis_data': json.dumps(structured_analysis, indent=2),
        'rag_contextual_feedback': "\n".join(unique_feedback)
    })
    
    return final_report

def analyse_cv(cv_content: str) -> json:
    crew = Crew(
        agents=[            
            informations_personnelle_agent,
            skills_extractor_agent,
            experience_extractor_agent,
            project_extractor_agent,
            education_extractor_agent,
            reconversion_detector_agent,

            ProfileBuilderAgent       
        ],
        tasks=[
            task_extract_informations,
            task_extract_skills,
            task_extract_experience,
            task_extract_projects,
            task_extract_education,
            task_detect_reconversion,
            task_build_profile     
        ],
        process=Process.sequential,
        verbose=False,
        telemetry=False
    )
    result = crew.kickoff(inputs={"cv_content": cv_content})
    return result