Jayashree Sridhar
modifed validation tools as basetool instances and modified the calling portion in crew_config.py
c3ffbb9
| 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 | |
| # Centralized tool instances | |
| 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): | |
| # ----- AGENT 1 ----- | |
| 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, | |
| ] | |
| ) | |
| # ----- AGENT 2 ----- | |
| 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, | |
| ] | |
| ) | |
| # ----- AGENT 3 ----- | |
| 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.validate_response_tool | |
| ] | |
| ) | |
| # ----- AGENT 4 ----- | |
| 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, | |
| ] | |
| ) |