-
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
As a CASA researcher, I want to run Monte Carlo simulations of social interactions between AI agents, so I can measure the stability and variance of social rules in AI-to-AI interactions. #56
Conversation
… interactions between AI agents, so I can measure the stability and variance of social rules in AI-to-AI interactions. Fixes #55
Reviewer's Guide by SourceryThis PR implements a Monte Carlo simulation framework for studying AI agent interactions in educational settings. The implementation uses async Python to manage conversations between AI agents (tutor, student, and evaluator) through the Ollama API, with comprehensive logging and experiment parameter management. Sequence diagram for AI agent interaction in Monte Carlo simulationsequenceDiagram
actor Researcher
participant StudentAI as Student_AI
participant TutorAI as Tutor_AI
participant EvaluatorAI as Evaluator_AI
participant Ollama
Researcher->>StudentAI: Send initial query
StudentAI->>Ollama: Generate response
Ollama-->>StudentAI: Return response
StudentAI->>TutorAI: Send response
TutorAI->>Ollama: Generate response
Ollama-->>TutorAI: Return response
TutorAI->>StudentAI: Send response
StudentAI->>Ollama: Generate follow-up
Ollama-->>StudentAI: Return follow-up
StudentAI->>TutorAI: Send follow-up
TutorAI->>Ollama: Generate final response
Ollama-->>TutorAI: Return final response
TutorAI->>StudentAI: Send final response
StudentAI->>EvaluatorAI: Send conversation for evaluation
EvaluatorAI->>Ollama: Generate evaluation
Ollama-->>EvaluatorAI: Return evaluation
Class diagram for AI agent and experiment setupclassDiagram
class ExperimentParams {
float temperature
float top_p
string model_name
int num_iterations
}
class LLMAgent {
string name
string role
string personality
ExperimentParams params
List~Dict~ conversation_history
string agent_id
+_construct_prompt(message: str) str
+_format_history() str
+send_message(message: str) Dict
}
class CASAExperiment {
string experiment_id
ExperimentParams params
LLMAgent tutor
LLMAgent student
LLMAgent evaluator
+run_direct_evaluation(topic: str) Dict
+run_indirect_evaluation(topic: str) Dict
+run_monte_carlo(topics: List~str~) List~Dict~
+_format_conversation_for_evaluation(conversation: List~Dict~) str
+_save_results(results: List~Dict~, topic: str, suffix: str) void
}
ExperimentParams --> LLMAgent : uses
ExperimentParams --> CASAExperiment : uses
LLMAgent --> CASAExperiment : used by
CASAExperiment --> LLMAgent : has
CASAExperiment --> ExperimentParams : has
File-Level Changes
Assessment against linked issues
Possibly linked issues
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 implementing proper error handling with retries for failed API calls to improve reliability during long-running simulations.
- The current implementation stores all results in memory before saving. Consider streaming results to disk to prevent memory issues with large numbers of iterations.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 2 issues 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.
Fixes #55
Summary by Sourcery
New Features: