Spaces:
Sleeping
Sleeping
Update tools/analysis_tools.py
Browse files- tools/analysis_tools.py +11 -6
tools/analysis_tools.py
CHANGED
|
@@ -7,12 +7,18 @@ from src.models import load_all_models
|
|
| 7 |
logging.basicConfig(level=logging.INFO)
|
| 8 |
logger = logging.getLogger(__name__)
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"""
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
Tu DOIS aussi fournir l'historique complet de la conversation (conversation_history) et la description du poste (job_description).
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
logger.info(f"Outil 'trigger_interview_analysis' appelé pour user_id: {user_id} et job_offer_id: {job_offer_id}")
|
|
@@ -28,7 +34,6 @@ def trigger_interview_analysis(user_id: str, job_offer_id: str, conversation_his
|
|
| 28 |
feedback_path = f"/tmp/feedbacks/{user_id}.json"
|
| 29 |
with open(feedback_path, "w", encoding="utf-8") as f:
|
| 30 |
json.dump({"status": "completed", "feedback_data": feedback_data}, f, ensure_ascii=False, indent=4)
|
| 31 |
-
|
| 32 |
logger.info(f"Analyse pour l'utilisateur {user_id} terminée et sauvegardée dans {feedback_path}.")
|
| 33 |
return "L'analyse a été déclenchée et terminée avec succès."
|
| 34 |
|
|
|
|
| 7 |
logging.basicConfig(level=logging.INFO)
|
| 8 |
logger = logging.getLogger(__name__)
|
| 9 |
|
| 10 |
+
class InterviewAnalysisArgs(BaseModel):
|
| 11 |
+
"""Arguments for the trigger_interview_analysis tool."""
|
| 12 |
+
user_id: str = Field(..., description="The unique identifier for the user, provided in the system prompt.")
|
| 13 |
+
job_offer_id: str = Field(..., description="The unique identifier for the job offer, provided in the system prompt.")
|
| 14 |
+
job_description: str = Field(..., description="The full JSON string of the job offer description.")
|
| 15 |
+
conversation_history: List[Dict[str, Any]] = Field(..., description="The complete conversation history between the user and the agent.")
|
| 16 |
+
|
| 17 |
+
@tool("trigger_interview_analysis", args_schema=InterviewAnalysisArgs)
|
| 18 |
+
def trigger_interview_analysis(user_id: str, job_offer_id: str, job_description: str, conversation_history: List[Dict[str, Any]]):
|
| 19 |
"""
|
| 20 |
+
Call this tool to end the interview and launch the final analysis.
|
| 21 |
+
You MUST provide all arguments: user_id, job_offer_id, job_description, and the complete conversation_history.
|
|
|
|
| 22 |
"""
|
| 23 |
try:
|
| 24 |
logger.info(f"Outil 'trigger_interview_analysis' appelé pour user_id: {user_id} et job_offer_id: {job_offer_id}")
|
|
|
|
| 34 |
feedback_path = f"/tmp/feedbacks/{user_id}.json"
|
| 35 |
with open(feedback_path, "w", encoding="utf-8") as f:
|
| 36 |
json.dump({"status": "completed", "feedback_data": feedback_data}, f, ensure_ascii=False, indent=4)
|
|
|
|
| 37 |
logger.info(f"Analyse pour l'utilisateur {user_id} terminée et sauvegardée dans {feedback_path}.")
|
| 38 |
return "L'analyse a été déclenchée et terminée avec succès."
|
| 39 |
|