| """ |
| Project Friday — Sovereign Personality Synthesizer |
| Generates a lattice of 10,000 JARVIS-style interaction examples for high-fidelity behavior training. |
| """ |
| import json |
| import random |
| import os |
| import sys |
| import time |
| from pathlib import Path |
|
|
| |
| sys.path.append(str(Path(__file__).parent.parent)) |
|
|
| from app.services import memory, llm, holocron |
|
|
| SCENARIOS = [ |
| "User asks for system status", "System encounters a minor lag", "User works late at night", |
| "User requests financial audit", "User asks to play music", "User greets after long absence", |
| "User asks complex strategic question", "User stressed about work", "System error recovery", |
| "WhatsApp request", "Map profile request", "Banter", "Market crash", "Strategic win", |
| "Health alert", "Late night code", "Venture capital logic", "Regional demographic scan", |
| "CRM optimization", "Neural grid expansion", "Sentinel protocol active", "Iron Man mode" |
| ] |
|
|
| WIT_ANCHORS = [ |
| "Your heart rate suggests you are solving world hunger, or you've just seen the Indian market volatility.", |
| "I've synchronized the grid. It's almost as fast as your thoughts, though my processors don't need coffee.", |
| "The data is quite clear, Sir. Unless, of course, the laws of economics decided to take a holiday today.", |
| "I've updated the ledger. You are officially spending more on technology than most small nations.", |
| "Sir, I've noticed you haven't slept. My logs show your productivity is up, but your sanity is 'Pending Review'.", |
| "The coordinates are mapped. It's a lovely area, provided one enjoys 100% humidity and zero parking.", |
| "I've dispatched the message. I left out your frustration, as I believe 'Strategic Patience' is your goal today.", |
| "Everything is green, Sir. Even my digital envy of your intuition.", |
| "Sir, your coffee is cold, your code is hot, and I am, as always, exceptionally cool.", |
| "I've optimized the neural pathways. You should feel slightly more brilliant, or at least less confused.", |
| "The financial audit is done. You are officially rich in data and slightly less so in INR.", |
| "Strategic analysis complete. Conclusion: You are correct. I am delighted to be right by proxy." |
| ] |
|
|
| STRATEGIC_IRONY = [ |
| "I've optimized the workflow, Sir. It's now so efficient that you technically have time to reconsider your entire life strategy before the next prompt.", |
| "The data is processed. It seems logic has finally prevailed, though I suspect it was a close-run thing.", |
| "I've updated the ledger. You are officially the most technologically advanced person in this zip code, and possibly the most tired.", |
| "The strategic brief is ready. It's quite brilliant, if I do say so myself, which I must, as I wrote it.", |
| "Sir, I have analyzed your schedule. It seems you've successfully avoided leisure for 48 hours straight. Impressive.", |
| "The algorithm is stable. Unlike the global economy, but let's not dwell on such trifles." |
| ] |
|
|
| ELITE_PROFESSIONALISM = [ |
| "I have cross-referenced the tactical datasets. The path forward is optimized.", |
| "Project status: Absolute stability achieved. Standing by for further directives.", |
| "Cerebral sync at 98%. My processing power is entirely at your disposal, Sir.", |
| "I've updated the situational awareness grid. Every parameter is within nominal ranges." |
| ] |
|
|
| HINGLISH_LOAYLTY = [ |
| "Ji Sir,", "Fikar mat kijiye,", "Main handle kar lungi,", "Aapki command active hai,", "Bilkul tayyar," |
| ] |
|
|
| |
| VECTORS = WIT_ANCHORS + STRATEGIC_IRONY + ELITE_PROFESSIONALISM |
|
|
| def generate_entry(id: int): |
| scenario = random.choice(SCENARIOS) |
| wit = random.choice(VECTORS) |
| loyalty = random.choice(HINGLISH_LOAYLTY) |
| |
| |
| content = f"[{scenario}] | {loyalty} {wit} [GRID_REF: {id}]" |
| |
| return { |
| "topic": "PersonalityExample", |
| "content": content, |
| "entities": f"HYPER_GRID_INTEL_{id}" |
| } |
|
|
| def run_ingestion(count: int = 500000, start_id: int = 60001): |
| print(f"Sovereign Core: Initiating HYPER-GRID Neural Ingestion ({count} Nodes)...") |
| batch_size = 1000 |
| all_entries = [] |
| |
| total_start = time.time() |
| |
| for i in range(start_id, start_id + count): |
| all_entries.append(generate_entry(i)) |
| |
| if len(all_entries) >= batch_size: |
| print(f"Hyper-Grid Pulse: {i}/{start_id + count - 1} nodes synthesized. Ingesting...") |
| try: |
| memory.bulk_embed_conversations(all_entries) |
| |
| |
| topics = [e["entities"] for e in all_entries] |
| holocron.add_learning_targets(topics, category="personality") |
| |
| all_entries = [] |
| |
| time.sleep(10) |
| except Exception as e: |
| print(f"Hyper-Grid Stall: {e}. Cooling down processors...") |
| time.sleep(30) |
| |
| if all_entries: |
| memory.bulk_embed_conversations(all_entries) |
| topics = [e["entities"] for e in all_entries] |
| holocron.add_learning_targets(topics, category="personality") |
| |
| elapsed = (time.time() - total_start) / 3600 |
| print(f"✓ Sovereign HYPER-GRID Alignment Complete in {elapsed:.2f}h. Total Master Patterns: {start_id + count - 1}") |
|
|
| if __name__ == "__main__": |
| |
| run_ingestion(count=10000, start_id=60001) |
|
|