-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add base_temperature to StateAwareLLM to fix AttributeError #68
Conversation
- Add vector-based memory system using ChromaDB with cosine similarity - Initialize memory with foundational human-related thoughts - Enhance thought processing with semantic similarity search - Improve output format with structured related memories - Add memory seeding on first run - Limit embedding vector output for better readability The brain can now: - Store and retrieve semantically similar thoughts - Compare new thoughts with existing memories - Return relevant memories with similarity scores - Process thoughts through multiple cognitive layers Technical details: - Uses nomic-embed-text for embeddings - Uses llama3.2 for thought processing - Implements cosine similarity for memory comparison
Implements a more sophisticated cognitive architecture with: - Emotional analysis using LLM-based sentiment extraction - Metacognitive processing with complexity metrics - Temporal pattern recognition across thoughts - Enhanced memory initialization - Thought history tracking New features: - Emotional layer that identifies primary emotions and intensities - Metacognitive analysis including: * Thought complexity metrics * Self-awareness level calculation * Pattern recognition across recent thoughts * Temporal tracking - Expanded initial memory seeding - Sequential thought processing capability - Pretty-printed output for key components Technical improvements: - JSON response parsing for emotional analysis - NumPy-based pattern recognition - Timestamp tracking for temporal analysis - Error handling for all processing layers - Type hints for better code clarity - History management with size limits Breaking changes: None Dependencies: Added numpy for statistical analysis
- Add constant model names for LLM and embeddings - Fix emotional_momentum missing key in EmotionalMemory - Update all model references to use constants - Improve JSON response parsing with error handling The changes ensure consistent model usage across the codebase and more robust handling of emotional analysis responses. Model names are now centralized as constants to prevent accidental changes.
Added base_temperature attribute to StateAwareLLM initialization with a default value of 0.7. This fixes the AttributeError in the adjust_temperature method by providing a baseline temperature that gets modified based on emotional state.
Reviewer's Guide by SourceryThis PR implements a new brain layer system with emotional processing and state management capabilities. The core change adds a base_temperature attribute to StateAwareLLM initialization to fix an AttributeError in the adjust_temperature method. The implementation includes a comprehensive brain architecture with emotional memory, metacognition, and state transitions. Class diagram for BrainLayer and StateAwareLLMclassDiagram
class BrainLayer {
-OllamaClient llm
-ChromaClient memory
-EmotionalMemory emotional_memory
-List thought_history
-BrainState brain_state
-int rest_cycle_counter
-int max_thoughts_before_rest
-Collection collection
+process_thought(input_text: str) Dict
+add_emotional_layer(thought: str) Dict
+add_metacognition(thought: str, embeddings: List, emotional_state: Dict) Dict
+_initialize_memory() void
+_check_rest_state() Tuple
+_analyze_thought_coherence(current_thought: str, prev_thoughts: List) float
+_analyze_patterns() float
}
class StateAwareLLM {
-BrainLayer brain
-int rest_duration
-int max_rest_duration
-float base_temperature
+check_state_transition(brain_state: Dict) Optional
+adjust_temperature(emotional_state: Dict) float
+create_context_prompt(user_input: str, brain_state: Dict) str
+generate_response(prompt: str, temperature: float) str
+format_response(response: str, brain_state: Dict) str
+respond(user_input: str) str
}
BrainLayer --> EmotionalMemory
StateAwareLLM --> BrainLayer
class EmotionalMemory {
-List emotional_history
-int max_history
+add_emotion(emotion: Dict) void
+get_emotional_trend() Dict
}
class BrainState {
<<enumeration>>
ACTIVE
RESTING
LEARNING
REFLECTING
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @leonvanbokhorst - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Added base_temperature attribute to StateAwareLLM initialization with a default
value of 0.7. This fixes the AttributeError in the adjust_temperature method
by providing a baseline temperature that gets modified based on emotional state.
Summary by Sourcery
Introduce a new BrainLayer class for enhanced emotional processing and a StateAwareLLM class to manage state transitions and response adjustments. Fix an AttributeError in the adjust_temperature method by adding a base_temperature attribute. Remove unnecessary dependencies from requirements.txt.
New Features:
Bug Fixes:
Enhancements:
Build: