- Aanpassingen aan opbouw specialist historiek

- Nieuwe versie van de selectie specialist "Fake it till you Make it" ;-)
This commit is contained in:
Josako
2025-06-15 18:31:13 +02:00
parent 82e25b356c
commit dbea41451a
6 changed files with 91 additions and 10 deletions

View File

@@ -17,6 +17,7 @@ fields:
name: "Phone Number" name: "Phone Number"
type: "str" type: "str"
description: "Your Phone Number" description: "Your Phone Number"
context: "Een kleine test om te zien of we context kunnen doorgeven en tonen"
required: true required: true
address: address:
name: "Address" name: "Address"

View File

@@ -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"

View File

@@ -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"

View File

@@ -64,22 +64,29 @@ class CrewAIBaseSpecialistExecutor(BaseSpecialistExecutor):
# Retrieve history # Retrieve history
self._cached_session = cache_manager.chat_session_cache.get_cached_session(self.session_id) self._cached_session = cache_manager.chat_session_cache.get_cached_session(self.session_id)
# Format history for the prompt # Format history for the prompt
self._formatted_history = "\n\n".join([ self._formatted_history = self._generate_formatted_history()
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
])
@property @property
def formatted_history(self) -> str: def formatted_history(self) -> str:
if not self._formatted_history: if not self._formatted_history:
self._formatted_history = "\n\n".join([ self._formatted_history = self._generate_formatted_history()
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
])
return self._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): def _add_task_agent(self, task_name: str, agent_name: str):
self._task_agents[task_name.lower()] = agent_name self._task_agents[task_name.lower()] = agent_name

View File

@@ -106,6 +106,10 @@ class SpecialistResult(BaseModel):
None, None,
description="Optional textual answer from the specialist" 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( form_request: Optional[Dict[str, Any]] = Field(
None, None,
description="Optional form definition to request user input" description="Optional form definition to request user input"

View File

@@ -71,6 +71,11 @@ class SpecialistExecutor(CrewAIBaseSpecialistExecutor):
def execute(self, arguments: SpecialistArguments, formatted_context, citations) -> SpecialistResult: def execute(self, arguments: SpecialistArguments, formatted_context, citations) -> SpecialistResult:
self.log_tuning("Traicie Selection Specialist execution started", {}) 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 = { # flow_inputs = {
# "vacancy_text": arguments.vacancy_text, # "vacancy_text": arguments.vacancy_text,
# "role_name": arguments.role_name, # "role_name": arguments.role_name,