| from agents.tools.voice_tools import VoiceTools |
| from agents.tools.llm_tools import LLMTools |
| from agents.tools.knowledge_tools import KnowledgeTools |
| from agents.tools.validation_tools import ValidationTools |
| from crewai import Agent |
| from utils.knowledge_base import KnowledgeBase |
|
|
| class PersonalCoachCrew: |
| def __init__(self, config): |
| self.config = config |
| |
| self.voice_tools = VoiceTools(self.config) |
| self.llm_tools = LLMTools(self.config) |
| self.knowledge_tools = KnowledgeTools(self.config) |
| self.validation_tools = ValidationTools(self.config) |
|
|
| self.knowledge_base = KnowledgeBase(self.config) |
| self._initialize_agents() |
| self._create_crew() |
|
|
| def _initialize_agents(self): |
| |
| self.conversation_handler = Agent( |
| role="Empathetic Conversation Handler", |
| goal="Understand user's emotional state and needs through compassionate dialogue", |
| backstory="...", |
| verbose=self.config.crew.verbose, |
| allow_delegation=False, |
| tools=[ |
| self.voice_tools.transcribe_audio, |
| self.voice_tools.detect_emotion, |
| self.voice_tools.generate_reflective_questions, |
| ] |
| ) |
| |
| self.wisdom_advisor = Agent( |
| role="Wisdom Keeper and Spiritual Guide", |
| goal="Provide personalized guidance drawing from ancient wisdom and modern psychology", |
| backstory="...", |
| verbose=self.config.crew.verbose, |
| allow_delegation=False, |
| tools=[ |
| self.knowledge_tools.search_knowledge, |
| self.knowledge_tools.extract_wisdom, |
| self.knowledge_tools.suggest_practices, |
| self.llm_tools.mistral_chat, |
| self.llm_tools.generate_advice, |
| ] |
| ) |
| |
| self.response_validator = Agent( |
| role="Response Guardian and Quality Validator", |
| goal="Ensure all responses are safe, appropriate, and truly helpful", |
| backstory="...", |
| verbose=self.config.crew.verbose, |
| allow_delegation=False, |
| tools=[ |
| self.validation_tools.check_safety, |
| self.validation_tools.validate_tone, |
| self.validation_tools.refine_response, |
| ] |
| ) |
| |
| self.interaction_manager = Agent( |
| role="Conversation Flow Manager", |
| goal="Create natural, engaging dialogue that helps users on their journey", |
| backstory="...", |
| verbose=self.config.crew.verbose, |
| allow_delegation=False, |
| tools=[ |
| self.llm_tools.summarize_conversation, |
| ] |
| ) |