-
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
Implement comprehensive social simulation framework with CLI and input visualization #39
Conversation
…onality influence - Refactor EmotionalDecisionMaking class to better incorporate personality traits - Add detailed emotional reaction calculation based on personality factors - Implement status threat evaluation for emotional responses - Enhance deliberation process with weighted contributions and relationship context - Add comprehensive emotional impact assessment and support needs identification - Improve contribution gathering with personality-aware prompt modification - Add relationship context tracking for better group dynamics modeling
- Add simulation coordinator and core agent components - Implement group dynamics and emotional processing - Add configuration management and CLI interface - Create proposal and deliberation system - Add event logging and analysis capabilities - Set up project structure and dependencies BREAKING CHANGE: Initial framework implementation
- Remove redundant validation in PersonalityTraits class - Update InputVisualizer to include all personality traits - Use model_dump() instead of dict() for consistent serialization - Add missing dominance and social_influence to trait visualization The double 'dominance' error was occurring due to validation happening in multiple places. This commit simplifies the validation chain by: 1. Relying on Pydantic's built-in Field validation 2. Using model_dump() consistently for serialization 3. Including all personality traits in visualizations 4. Removing redundant validation checks Key changes: - friction_flow/inputs/agent_inputs.py (lines 12-38): Simplified PersonalityTraits class - friction_flow/utils/input_visualizer.py (lines 77-100): Updated trait visualization
Reviewer's Guide by SourceryThis pull request enhances the emotional and social dynamics simulation framework by implementing a comprehensive set of classes and utilities. The changes focus on improving personality trait handling, visualization capabilities, and emotional state management through consistent serialization and validation approaches. Sequence diagram for agent emotional response calculationsequenceDiagram
participant Agent as EnhancedSocialAgent
participant Proposal as DecisionProposal
participant Dynamics as esh_status_dynamics
Agent->>Dynamics: _calculate_initial_reaction(Proposal)
alt stability < 0.5
Dynamics->>Agent: ANXIOUS reaction
end
alt openness > 0.7
Dynamics->>Agent: CONFIDENT reaction
end
alt dominance > 0.7
Dynamics->>Agent: DEFENSIVE reaction
end
Dynamics->>Agent: Return reactions
Updated class diagram for PersonalityTraits and InputVisualizerclassDiagram
class PersonalityTraits {
- agreeableness: float
- conscientiousness: float
- dominance: float
- extraversion: float
- neuroticism: float
- openness: float
- social_influence: float
+ validate_traits(): void
}
class InputVisualizer {
+ visualize_traits(traits: PersonalityTraits): void
+ generate_visualizations(output_dir: Path): void
}
PersonalityTraits -- InputVisualizer : uses
Class diagram for EnhancedSocialAgent and GroupManagerclassDiagram
class EnhancedSocialAgent {
- id: str
- personality: PersonalityTraits
- emotional_state: EmotionalState
- status: Status
+ get_dominant_emotion(): EmotionalState.Emotion
}
class GroupManager {
- agents: List~EnhancedSocialAgent~
- groups: Dict~str, Group~
+ update_groups(): void
+ _calculate_similarity_matrix(): np.ndarray
}
EnhancedSocialAgent -- GroupManager : manages
class Group {
- id: str
- members: Set~EnhancedSocialAgent~
- cohesion: float
- emotional_alignment: float
}
GroupManager o-- Group : contains
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 - here's some feedback:
Overall Comments:
- Consider adding performance instrumentation to track memory usage and processing time of key simulation components
Here's what I looked at during the review
- 🟡 General issues: 3 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.
try: | ||
with open(filename, 'w') as f: | ||
json.dump(self.events, f, indent=2) | ||
self.events = [] |
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.
issue (bug_risk): Event data could be lost if write fails
Only clear events after successful write to prevent data loss. Consider implementing a retry mechanism.
"""Analyze simulation results""" | ||
console = Console() | ||
|
||
try: |
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.
issue (code-quality): Explicitly raise from a previous error (raise-from-previous-error
)
valid_responses = [r for r in responses if r] | ||
if not valid_responses: | ||
return f"Agent {agent.id} is considering the matter." |
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.
issue (code-quality): We've found these issues:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Swap if/else branches (
swap-if-else-branches
)
The double 'dominance' error was occurring due to validation happening in multiple places. This commit simplifies the validation chain by:
Key changes:
Summary by Sourcery
Implement a comprehensive social simulation framework with a CLI for managing simulations, input generation, and result analysis. Enhance input visualization to include all personality traits.
New Features:
Enhancements: