-
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
feat: Implement social AI agent to encourage camping #22
Conversation
…nversations - Introduced a new SocialAgent class designed to engage users in conversations about camping, emphasizing emotional benefits and personal growth. - Created ConversationHistory and Message classes to track dialogue and context effectively. - Developed a structured prompt for the agent to follow, ensuring responses are concise and focused on camping. - Added OllamaClient for generating responses via an external API, enhancing interaction capabilities. - Included a run_conversation_demo function to simulate user-agent interactions in a camping scenario. These changes establish a foundation for a conversational agent aimed at promoting outdoor activities, improving user engagement through structured dialogue.
feat: Implement SocialAgent for camping conversations
Reviewer's Guide by SourceryThis pull request introduces a new social agent interaction demo using the Ollama API and the Mistral model. It includes a basic implementation of a conversation history, message handling, and prompt generation for the social agent, focusing on a scenario where the agent tries to convince a user to go camping. Sequence diagram for the conversation flowsequenceDiagram
participant User
participant Demo as run_conversation_demo
participant History as ConversationHistory
participant Agent as SocialAgent
participant Ollama as OllamaClient
Demo->>History: create(scenario)
Demo->>Agent: create(model_name)
Agent->>Agent: generate_response(history)
Agent->>History: get_context()
Agent->>Agent: _create_prompt(history)
Agent->>Ollama: generate(prompt, model)
Ollama-->>Agent: response
Agent-->>Demo: response
Demo->>History: add_message(AGENT, response)
loop Until user types 'quit'
User->>Demo: input message
Demo->>History: add_message(USER, input)
Demo->>Agent: generate_response(history)
Agent->>History: get_context()
Agent->>Agent: _create_prompt(history)
Agent->>Ollama: generate(prompt, model)
Ollama-->>Agent: response
Agent-->>Demo: response
Demo->>History: add_message(AGENT, response)
end
Class diagram for the social agent conversation systemclassDiagram
class Role {
<<enumeration>>
AGENT
USER
}
class Message {
+Role role
+str content
+int turn_index
}
class Scenario {
+str description
+str agent_goal
+str agent_profile
+str user_profile
}
class ConversationHistory {
+Scenario scenario
+List[Message] messages
+int current_turn
+add_message(role: Role, content: str)
+get_context() str
}
class SocialAgent {
+str model_name
+OllamaClient ollama_client
+generate_response(history: ConversationHistory) str
-_create_prompt(history: ConversationHistory) str
}
class OllamaClient {
+str base_url
+generate(prompt: str, model: str) str
}
ConversationHistory --> Message
ConversationHistory --> Scenario
Message --> Role
SocialAgent --> OllamaClient
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 making the conversation goals and rules configurable through a config file or parameters rather than hardcoding them in _create_prompt(). This would make the code more reusable for different conversation scenarios.
- The error handling in OllamaClient.generate() could be more specific - consider catching and handling specific HTTP/network exceptions rather than using a generic Exception catch-all.
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 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.
Summary by Sourcery
Implement a social AI agent that encourages users to go camping.
New Features:
Tests: