- Aanpassingen aan opbouw specialist historiek
- Nieuwe versie van de selectie specialist "Fake it till you Make it" ;-)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user