Tweaked prompt and added role desc

This commit is contained in:
Viswamedha Nalabotu 2026-03-22 17:26:02 +00:00
parent bf9eb6efb5
commit c1d362665c
2 changed files with 14 additions and 7 deletions

View file

@ -40,7 +40,8 @@ class OnboardingGenerateConsumer(BaseOnboardingConsumer):
ca_config = await self.get_config_by_type(role.uuid, 'curriculum') ca_config = await self.get_config_by_type(role.uuid, 'curriculum')
if not ca_config: if not ca_config:
return await self.send_error("Missing curriculum AgentConfig for this role") return await self.send_error("Missing curriculum AgentConfig for this role")
initial_hits = await self.fetch_knowledge_context(role.uuid, f"{role.name} role responsibilities and key training areas") role_desc_snippet = f"{role.description[:300]}" if getattr(role, 'description', None) else ""
initial_hits = await self.fetch_knowledge_context(role.uuid, f"{role.name}{role_desc_snippet}: key responsibilities, core competencies, and training requirements")
initial_context = self.format_knowledge_context(initial_hits) initial_context = self.format_knowledge_context(initial_hits)
ca_response = await self.orchestrate( ca_response = await self.orchestrate(
OnboardingPrompts.curriculum_generation_prompt(str(role.uuid), role.name, initial_context), OnboardingPrompts.curriculum_generation_prompt(str(role.uuid), role.name, initial_context),

View file

@ -17,15 +17,21 @@ class OnboardingPrompts:
@staticmethod @staticmethod
def curriculum_generation_prompt(role_uuid: str, role_name: str, initial_context: str = '') -> str: def curriculum_generation_prompt(role_uuid: str, role_name: str, initial_context: str = '') -> str:
context_section = f"\nInitial knowledge base search results:\n{initial_context}\n" if initial_context else '' context_section = (
f"\nPrimary source — retrieved training documents for this role:\n{initial_context}\n"
if initial_context else
"\nNo training documents were retrieved. Module titles must be based solely on what you find via tools.\n"
)
return ( return (
f"Create an onboarding curriculum for the '{role_name}' role (role_uuid: {role_uuid}).\n" f"Create an onboarding curriculum for the '{role_name}' role (role_uuid: {role_uuid}).\n"
"Use the available tools to gather context before deciding on modules:\n"
"- Call get_role_context to read the role description\n"
"- Call list_training_files to see what training materials exist\n"
"- Call search_knowledge with a relevant query to find specific content\n"
f"{context_section}\n" f"{context_section}\n"
"Based on what you find, decide how many modules are appropriate for this role's complexity — up to 15. " "The retrieved documents above are your primary source. "
"Module titles MUST reflect the specific topics, responsibilities, and competencies described in those documents — "
"do NOT default to generic onboarding titles (e.g. 'Orientation', 'IT Setup') unless the documents support them.\n"
"You may call tools to supplement your understanding:\n"
"- Call get_role_context if you need the role description\n"
"- Call search_knowledge with a more specific query if the primary source is insufficient for a particular area\n"
"Decide how many modules are appropriate for this role's complexity — up to 15. "
"Output ONLY a valid JSON array of strings representing module titles. " "Output ONLY a valid JSON array of strings representing module titles. "
"Example: [\"Introduction\", \"Safety\", \"Operations\"]" "Example: [\"Introduction\", \"Safety\", \"Operations\"]"
) )