Spaces:
Running on Zero
Running on Zero
| """Configuration for Aethron Portfolio RAG — REVISED v3.""" | |
| import os | |
| # Paths | |
| BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| DATA_DIR = os.path.join(BASE_DIR, "data") | |
| INDEX_DIR = os.path.join(DATA_DIR, "index") | |
| KB_PATH = os.path.join(DATA_DIR, "aragit_portfolio_kb.md") | |
| # Embedding: BGE-small — 384-dim, ~50MB, strong technical retrieval | |
| EMBEDDING_MODEL = "BAAI/bge-small-en-v1.5" | |
| EMBEDDING_DIM = 384 | |
| # SLM: microsoft/Phi-3.5-mini-instruct via transformers | |
| LLM_MODEL_ID = "microsoft/Phi-3.5-mini-instruct" | |
| LLM_MAX_NEW_TOKENS = 512 | |
| LLM_TEMPERATURE = 0.1 | |
| LLM_DO_SAMPLE = False | |
| # Retrieval | |
| CHUNK_SIZE = 1024 | |
| CHUNK_OVERLAP = 200 | |
| TOP_K = 6 | |
| TOP_K_FETCH = 12 | |
| # Router keywords | |
| RECRUITER_KEYWORDS = [ | |
| "hire", "hiring", "salary", "available", "experience", "years", "skills", | |
| "kubernetes", "k8s", "docker", "python", "remote", "relocation", "visa", | |
| "full-time", "contract", "consulting", "rate", "contact", "email", "phone", | |
| "education", "degree", "university", "certification", "publication", | |
| "work", "worked", "job", "company", "career", "employed", "position", | |
| "kaggle", "medal", "competition", "master", "gold", "silver", "bronze" | |
| ] | |
| TECHNICAL_KEYWORDS = [ | |
| "architecture", "neuro-symbolic", "agentic", "rag", "mcp", "a2a", | |
| "temporal", "opa", "rego", "fhir", "ehr", "hipaa", "governance", | |
| "quantization", "lora", "qlora", "gemma", "mistral", "llm", "slm", | |
| "dag", "langgraph", "fastapi", "pydantic", "axiomis", "sentrixia", | |
| "nash", "equilibrium", "barnabus", "nayar", "zarif", "cogitator", | |
| "reflexa", "evolutio", "planning-rubicon", "world model", "repo", | |
| "repository", "github", "project", "implementation", "design", | |
| "stack", "layer", "pipeline", "orchestration", "clinical", "graphrag", | |
| "energy", "grid", "supply chain", "procurement", "finance", "regtech", | |
| "kyc", "aml", "biology", "protein", "molecular", "education", "tutoring", | |
| "marketing", "intent", "forecasting", "demand", "drift", "evaluator" | |
| ] | |
| # Keyword → section_type fallback mapping | |
| KEYWORD_SECTION_MAP = { | |
| "work": ["experience", "experience_summary_v2"], | |
| "worked": ["experience", "experience_summary_v2"], | |
| "job": ["experience", "experience_summary_v2"], | |
| "company": ["experience", "experience_summary_v2"], | |
| "career": ["experience", "experience_summary_v2"], | |
| "employed": ["experience", "experience_summary_v2"], | |
| "position": ["experience", "experience_summary_v2"], | |
| "skill": ["skills", "skills_summary"], | |
| "skills": ["skills", "skills_summary"], | |
| "expertise": ["skills", "skills_summary"], | |
| "technology": ["skills", "skills_summary"], | |
| "tech": ["skills", "skills_summary"], | |
| "publication": ["publications", "publications_summary"], | |
| "publications": ["publications", "publications_summary"], | |
| "paper": ["publications", "publications_summary"], | |
| "article": ["publications", "publications_summary"], | |
| "wrote": ["publications", "publications_summary"], | |
| "written": ["publications", "publications_summary"], | |
| "kaggle": ["kaggle_summary", "identity"], | |
| "medal": ["kaggle_summary"], | |
| "competition": ["kaggle_summary"], | |
| "master": ["kaggle_summary"], | |
| "gold": ["kaggle_summary"], | |
| "silver": ["kaggle_summary"], | |
| "bronze": ["kaggle_summary"], | |
| "clinical": ["clinical_ai_projects", "projects", "experience"], | |
| "healthcare": ["clinical_ai_projects", "projects", "experience"], | |
| "medical": ["clinical_ai_projects", "projects", "experience"], | |
| "marketing": ["marketing_ai_projects", "projects", "experience"], | |
| "advertising": ["marketing_ai_projects", "projects"], | |
| "supply chain": ["supply_chain_projects", "projects"], | |
| "logistics": ["supply_chain_projects", "projects"], | |
| "procurement": ["supply_chain_projects", "projects"], | |
| "energy": ["energy_projects", "projects"], | |
| "grid": ["energy_projects", "projects"], | |
| "biology": ["computational_biology_projects", "projects"], | |
| "protein": ["computational_biology_projects", "projects"], | |
| "molecular": ["computational_biology_projects", "projects"], | |
| "finance": ["finance_regtech_projects", "projects", "experience"], | |
| "regtech": ["finance_regtech_projects", "projects"], | |
| "kyc": ["finance_regtech_projects", "projects"], | |
| "aml": ["finance_regtech_projects", "projects"], | |
| "education": ["education_projects", "projects"], | |
| "tutoring": ["education_projects", "projects"], | |
| "neuro-symbolic": ["neuro_symbolic_projects", "architecture_deep_dive_axiomis", "projects"], | |
| "neuro symbolic": ["neuro_symbolic_projects", "architecture_deep_dive_axiomis", "projects"], | |
| "sota": ["projects", "projects_master_list", "neuro_symbolic_projects"], | |
| "github": ["projects", "projects_master_list"], | |
| "repo": ["projects", "projects_master_list"], | |
| } | |
| PERSONA_DEFAULT = "general" | |
| def detect_persona(query: str) -> str: | |
| """Simple keyword-based persona detection.""" | |
| q = query.lower() | |
| rec_score = sum(1 for kw in RECRUITER_KEYWORDS if kw in q) | |
| tech_score = sum(1 for kw in TECHNICAL_KEYWORDS if kw in q) | |
| if rec_score > tech_score and rec_score > 0: | |
| return "recruiter" | |
| elif tech_score > rec_score and tech_score > 0: | |
| return "technical" | |
| return PERSONA_DEFAULT | |
| def get_boosted_sections(query: str) -> list: | |
| """Return section types to boost based on keyword fallback.""" | |
| q = query.lower() | |
| boosted = set() | |
| for keyword, sections in KEYWORD_SECTION_MAP.items(): | |
| if keyword in q: | |
| boosted.update(sections) | |
| return list(boosted) |