Spaces:
Sleeping
Sleeping
File size: 5,276 Bytes
3fb2fb4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# =============================================================================
# utils/domain_configs.py
# =============================================================================
from typing import Dict, List
from core.config import MambaConfig
class DomainConfigs:
"""Configurations for different specialist domains"""
DOMAINS = {
# STEM domains
"mathematics": {
"keywords": ["equation", "theorem", "proof", "calculate", "derivative", "integral", "matrix", "algebra", "geometry", "statistics"],
"description": "Mathematical reasoning and computation"
},
"physics": {
"keywords": ["force", "energy", "momentum", "quantum", "relativity", "particle", "wave", "thermodynamics", "mechanics"],
"description": "Physics concepts and problems"
},
"chemistry": {
"keywords": ["molecule", "atom", "reaction", "compound", "bond", "element", "organic", "inorganic", "catalyst"],
"description": "Chemistry and molecular science"
},
"biology": {
"keywords": ["cell", "DNA", "protein", "organism", "evolution", "genetics", "ecology", "anatomy", "physiology"],
"description": "Biological sciences"
},
# Programming domains
"python": {
"keywords": ["def", "class", "import", "python", "pandas", "numpy", "matplotlib", "sklearn", "tensorflow"],
"description": "Python programming and data science"
},
"javascript": {
"keywords": ["function", "var", "let", "const", "javascript", "react", "node", "async", "promise"],
"description": "JavaScript and web development"
},
"systems": {
"keywords": ["linux", "server", "network", "database", "docker", "kubernetes", "cloud", "devops"],
"description": "Systems programming and infrastructure"
},
# Language domains
"writing": {
"keywords": ["essay", "article", "story", "paragraph", "thesis", "narrative", "prose", "literature"],
"description": "Creative and technical writing"
},
"translation": {
"keywords": ["translate", "language", "spanish", "french", "german", "chinese", "japanese", "korean"],
"description": "Language translation and linguistics"
},
# Business domains
"business": {
"keywords": ["market", "strategy", "finance", "management", "revenue", "profit", "customer", "sales"],
"description": "Business and economics"
},
"legal": {
"keywords": ["law", "contract", "court", "legal", "attorney", "judge", "case", "statute", "regulation"],
"description": "Legal reasoning and analysis"
},
# Other domains
"history": {
"keywords": ["war", "empire", "civilization", "century", "ancient", "medieval", "revolution", "dynasty"],
"description": "Historical knowledge and analysis"
},
"philosophy": {
"keywords": ["ethics", "moral", "logic", "metaphysics", "epistemology", "consciousness", "existence"],
"description": "Philosophical reasoning"
},
"medical": {
"keywords": ["patient", "diagnosis", "treatment", "disease", "medicine", "surgery", "therapy", "symptom"],
"description": "Medical knowledge and healthcare"
},
"arts": {
"keywords": ["painting", "music", "sculpture", "artist", "gallery", "museum", "aesthetic", "culture"],
"description": "Arts and cultural topics"
}
}
@classmethod
def get_domain_configs(cls, num_specialists: int = 100) -> List[Dict]:
"""Generate configurations for specialist domains"""
configs = []
base_domains = list(cls.DOMAINS.keys())
# Create configurations
for i in range(num_specialists):
if i < len(base_domains):
# Use predefined domains
domain_name = base_domains[i]
domain_info = cls.DOMAINS[domain_name]
else:
# Create sub-specializations or general domains
base_idx = i % len(base_domains)
domain_name = f"{base_domains[base_idx]}_sub_{i}"
domain_info = cls.DOMAINS[base_domains[base_idx]]
config = {
"id": i,
"name": domain_name,
"keywords": domain_info["keywords"],
"description": domain_info["description"],
"weight": 1.0 # Can be adjusted based on importance
}
configs.append(config)
return configs
@classmethod
def create_specialist_config(cls, base_config: MambaConfig, domain_id: int) -> MambaConfig:
"""Create a specialist configuration for a specific domain"""
specialist_config = MambaConfig(**base_config.__dict__)
specialist_config.specialist_id = domain_id
return specialist_config |