From b3bd5d10a8b4d14b9278aeea72cdcc96dceb7953 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 4 Apr 2026 12:37:01 +0900 Subject: [PATCH] feat: expand individual entity type detection for diverse scenarios The ontology generator creates domain-specific entity types like DataArchitect, AIConsultant, MachineLearningEngineer etc. These were not in the INDIVIDUAL_ENTITY_TYPES list, causing all such entities to be classified as group/institutional types with hardcoded age (30) and uniform MBTI profiles. Changes: - Added common professional roles to INDIVIDUAL_ENTITY_TYPES - Added fallback: unknown types default to individual instead of group, since GROUP_ENTITY_TYPES is a shorter, well-defined list --- backend/app/services/oasis_profile_generator.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/backend/app/services/oasis_profile_generator.py b/backend/app/services/oasis_profile_generator.py index 2555997..fd0eced 100644 --- a/backend/app/services/oasis_profile_generator.py +++ b/backend/app/services/oasis_profile_generator.py @@ -168,7 +168,10 @@ class OasisProfileGenerator: # Individual type entities (need to generate specific personas) INDIVIDUAL_ENTITY_TYPES = [ "student", "alumni", "professor", "person", "publicfigure", - "expert", "faculty", "official", "journalist", "activist" + "expert", "faculty", "official", "journalist", "activist", + "consultant", "engineer", "architect", "researcher", "analyst", + "director", "manager", "leader", "cto", "ceo", "partner", + "developer", "scientist", "strategist", "advisor", "specialist" ] # Group/institutional type entities (need to generate group representative personas) @@ -431,8 +434,16 @@ def _build_entity_context(self, entity: EntityNode) -> str: return "\n\n".join(context_parts) def _is_individual_entity(self, entity_type: str) -> bool: - """Determine if entity is an individual type""" - return entity_type.lower() in self.INDIVIDUAL_ENTITY_TYPES + """Determine if entity is an individual type. + + Falls back to treating unknown types as individual rather than group, + since the ontology generator often creates domain-specific types + (e.g. DataArchitect, AIConsultant) that aren't in either list. + """ + if entity_type.lower() in self.INDIVIDUAL_ENTITY_TYPES: + return True + # Unknown types default to individual rather than group + return entity_type.lower() not in self.GROUP_ENTITY_TYPES def _is_group_entity(self, entity_type: str) -> bool: """Determine if entity is a group/institutional type"""