From dbea41451a66da5d2cc07f509b4670f02a7b582d Mon Sep 17 00:00:00 2001 From: Josako Date: Sun, 15 Jun 2025 18:31:13 +0200 Subject: [PATCH] - Aanpassingen aan opbouw specialist historiek - Nieuwe versie van de selectie specialist "Fake it till you Make it" ;-) --- .../globals/PERSONAL_CONTACT_FORM/1.0.0.yaml | 1 + .../1.0.0.yaml | 30 ++++++++++++++++ .../1.0.0.yaml | 34 +++++++++++++++++++ .../specialists/crewai_base_specialist.py | 27 +++++++++------ .../specialists/specialist_typing.py | 4 +++ .../TRAICIE_SELECTION_SPECIALIST/1_2.py | 5 +++ 6 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 config/tasks/traicie/TRAICIE_COMPETENCIES_INTERVIEW_DEFINITION/1.0.0.yaml create mode 100644 config/tasks/traicie/TRAICIE_KO_CRITERIA_INTERVIEW_DEFINITION/1.0.0.yaml diff --git a/config/specialist_forms/globals/PERSONAL_CONTACT_FORM/1.0.0.yaml b/config/specialist_forms/globals/PERSONAL_CONTACT_FORM/1.0.0.yaml index 6eee03f..b7f5b5f 100644 --- a/config/specialist_forms/globals/PERSONAL_CONTACT_FORM/1.0.0.yaml +++ b/config/specialist_forms/globals/PERSONAL_CONTACT_FORM/1.0.0.yaml @@ -17,6 +17,7 @@ fields: name: "Phone Number" type: "str" description: "Your Phone Number" + context: "Een kleine test om te zien of we context kunnen doorgeven en tonen" required: true address: name: "Address" diff --git a/config/tasks/traicie/TRAICIE_COMPETENCIES_INTERVIEW_DEFINITION/1.0.0.yaml b/config/tasks/traicie/TRAICIE_COMPETENCIES_INTERVIEW_DEFINITION/1.0.0.yaml new file mode 100644 index 0000000..d1867f3 --- /dev/null +++ b/config/tasks/traicie/TRAICIE_COMPETENCIES_INTERVIEW_DEFINITION/1.0.0.yaml @@ -0,0 +1,30 @@ +version: "1.0.0" +name: "KO Criteria Interview Definition" +task_description: > + In context of a vacancy in your company {tenant_name}, you are provided with a set of competencies. (both description + and title). The competencies are in between triple backquotes. You need to prepare for the interviews, + and are to provide for each of these ko criteria: + + - A question to ask the recruitment candidate describing the context of the competency. Use your experience to not + just ask a closed question, but a question from which you can indirectly derive a positive or negative qualification of + the competency based on the answer of the candidate. + + Apply the following tone of voice in both questions and answers: {tone_of_voice} + Apply the following language level in both questions and answers: {language_level} + Use {language} as language for both questions and answers. + + ```{competencies}``` + + {custom_description} + +expected_output: > + For each of the ko criteria, you provide: + - the exact title in the original language + - the question + - a set of answers, with for each answer an indication if it is the correct answer, or a false response. + {custom_expected_output} +metadata: + author: "Josako" + date_added: "2025-06-15" + description: "A Task to define interview Q&A from given KO Criteria" + changes: "Initial Version" diff --git a/config/tasks/traicie/TRAICIE_KO_CRITERIA_INTERVIEW_DEFINITION/1.0.0.yaml b/config/tasks/traicie/TRAICIE_KO_CRITERIA_INTERVIEW_DEFINITION/1.0.0.yaml new file mode 100644 index 0000000..cea4546 --- /dev/null +++ b/config/tasks/traicie/TRAICIE_KO_CRITERIA_INTERVIEW_DEFINITION/1.0.0.yaml @@ -0,0 +1,34 @@ +version: "1.0.0" +name: "KO Criteria Interview Definition" +task_description: > + In context of a vacancy in your company {tenant_name}, you are provided with a set of knock-out criteria + (both description and title). The criteria are in between triple backquotes.You need to prepare for the interviews, + and are to provide for each of these ko criteria: + + - A question to ask the recruitment candidate describing the context of the ko criterium. Use your experience to not + just ask a closed question, but a question from which you can indirectly derive a positive or negative qualification + of the criterium based on the answer of the candidate. + - A set of max 5 answers on that question, from the candidates perspective. One of the answers will result in a + positive evaluation of the criterium, the other ones in a negative evaluation. Mark each of the answers as positive + or negative. + Describe the answers from the perspective of the candidate. Be sure to include all necessary aspects in you answers. + + Apply the following tone of voice in both questions and answers: {tone_of_voice} + Apply the following language level in both questions and answers: {language_level} + Use {language} as language for both questions and answers. + + ```{ko_criteria}``` + + {custom_description} + +expected_output: > + For each of the ko criteria, you provide: + - the exact title as specified in the original language + - the question in {language} + - a set of answers, with for each answer an indication if it is the correct answer, or a false response. In {language}. + {custom_expected_output} +metadata: + author: "Josako" + date_added: "2025-06-15" + description: "A Task to define interview Q&A from given KO Criteria" + changes: "Initial Version" diff --git a/eveai_chat_workers/specialists/crewai_base_specialist.py b/eveai_chat_workers/specialists/crewai_base_specialist.py index ad7c473..bdd10da 100644 --- a/eveai_chat_workers/specialists/crewai_base_specialist.py +++ b/eveai_chat_workers/specialists/crewai_base_specialist.py @@ -64,22 +64,29 @@ class CrewAIBaseSpecialistExecutor(BaseSpecialistExecutor): # Retrieve history self._cached_session = cache_manager.chat_session_cache.get_cached_session(self.session_id) # Format history for the prompt - self._formatted_history = "\n\n".join([ - f"HUMAN:\n{interaction.specialist_results.get('detailed_query')}\n\n" - f"AI:\n{interaction.specialist_results.get('rag_output').get('answer')}" - for interaction in self._cached_session.interactions - ]) + self._formatted_history = self._generate_formatted_history() @property def formatted_history(self) -> str: if not self._formatted_history: - self._formatted_history = "\n\n".join([ - f"HUMAN:\n{interaction.specialist_results.get('detailed_query')}\n\n" - f"AI:\n{interaction.specialist_results.get('rag_output').get('answer', '')}" - for interaction in self._cached_session.interactions - ]) + self._formatted_history = self._generate_formatted_history() return self._formatted_history + def _generate_formatted_history(self) -> str: + """Generate the formatted history string from cached session interactions.""" + return "\n\n".join([ + "\n\n".join([ + f"HUMAN:\n" + f"{interaction.specialist_results['detailed_query']}" + if interaction.specialist_results.get('detailed_query') else "", + f"{interaction.specialist_arguments.get('form_values')}" + if interaction.specialist_arguments.get('form_values') else "", + f"AI:\n{interaction.specialist_results['answer']}" + if interaction.specialist_results.get('answer') else "" + ]).strip() + for interaction in self._cached_session.interactions + ]) + def _add_task_agent(self, task_name: str, agent_name: str): self._task_agents[task_name.lower()] = agent_name diff --git a/eveai_chat_workers/specialists/specialist_typing.py b/eveai_chat_workers/specialists/specialist_typing.py index a9c5dff..ebc4605 100644 --- a/eveai_chat_workers/specialists/specialist_typing.py +++ b/eveai_chat_workers/specialists/specialist_typing.py @@ -106,6 +106,10 @@ class SpecialistResult(BaseModel): None, description="Optional textual answer from the specialist" ) + detailed_query: Optional[str] = Field( + None, + description="Optional detailed query for the specialist" + ) form_request: Optional[Dict[str, Any]] = Field( None, description="Optional form definition to request user input" diff --git a/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_2.py b/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_2.py index 856c2f8..5b7e9af 100644 --- a/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_2.py +++ b/eveai_chat_workers/specialists/traicie/TRAICIE_SELECTION_SPECIALIST/1_2.py @@ -71,6 +71,11 @@ class SpecialistExecutor(CrewAIBaseSpecialistExecutor): def execute(self, arguments: SpecialistArguments, formatted_context, citations) -> SpecialistResult: self.log_tuning("Traicie Selection Specialist execution started", {}) + current_app.logger.debug(f"Arguments: {arguments.model_dump()}") + current_app.logger.debug(f"Formatted Context: {formatted_context}") + current_app.logger.debug(f"Formatted History: {self._formatted_history}") + current_app.logger.debug(f"Cached Chat Session: {self._cached_session}") + # flow_inputs = { # "vacancy_text": arguments.vacancy_text, # "role_name": arguments.role_name,