diff --git a/apps/onboarding/consumers/generate.py b/apps/onboarding/consumers/generate.py index 62c243f..b2d2b51 100644 --- a/apps/onboarding/consumers/generate.py +++ b/apps/onboarding/consumers/generate.py @@ -40,7 +40,8 @@ class OnboardingGenerateConsumer(BaseOnboardingConsumer): ca_config = await self.get_config_by_type(role.uuid, 'curriculum') if not ca_config: 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) ca_response = await self.orchestrate( OnboardingPrompts.curriculum_generation_prompt(str(role.uuid), role.name, initial_context), diff --git a/apps/onboarding/consumers/prompts.py b/apps/onboarding/consumers/prompts.py index 45f088d..61a97b6 100644 --- a/apps/onboarding/consumers/prompts.py +++ b/apps/onboarding/consumers/prompts.py @@ -17,15 +17,21 @@ class OnboardingPrompts: @staticmethod 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 ( 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" - "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. " "Example: [\"Introduction\", \"Safety\", \"Operations\"]" )