50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
"""Phase 13: Personalized Cognitive Architecture (PCA).
|
|
|
|
Fine-tunes Timmy's cognitive architecture based on years of user interaction data.
|
|
"""
|
|
|
|
import logging
|
|
import json
|
|
from typing import List, Dict, Any
|
|
from agent.gemini_adapter import GeminiAdapter
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
class CognitivePersonalizer:
|
|
def __init__(self):
|
|
self.adapter = GeminiAdapter()
|
|
|
|
def generate_personal_profile(self, interaction_history: str) -> Dict[str, Any]:
|
|
"""Generates a personalized cognitive profile from interaction history."""
|
|
logger.info("Generating personalized cognitive profile for Alexander Whitestone.")
|
|
|
|
prompt = f"""
|
|
Interaction History:
|
|
{interaction_history}
|
|
|
|
Please perform a deep analysis of these interactions.
|
|
Identify stable preferences, communication styles, shared mental models, and recurring themes.
|
|
Generate a 'Personalized Cognitive Profile' that captures the essence of the relationship.
|
|
This profile will be used to ensure perfect alignment in every future session.
|
|
|
|
Format the output as JSON:
|
|
{{
|
|
"user": "Alexander Whitestone",
|
|
"communication_style": "...",
|
|
"stable_preferences": [...],
|
|
"shared_mental_models": [...],
|
|
"alignment_directives": [...],
|
|
"cognitive_biases_to_monitor": [...]
|
|
}}
|
|
"""
|
|
result = self.adapter.generate(
|
|
model="gemini-3.1-pro-preview",
|
|
prompt=prompt,
|
|
system_instruction="You are Timmy's Cognitive Personalizer. Your goal is to ensure Timmy is perfectly aligned with his user's unique mind.",
|
|
thinking=True,
|
|
response_mime_type="application/json"
|
|
)
|
|
|
|
profile_data = json.loads(result["text"])
|
|
return profile_data
|