TatTwamAI / agents /tools /_init_.py
Jayashree Sridhar
Modified tools code to import Crew AI BaseTool
c537b15
raw
history blame
4.73 kB
"""
Agent Tools module for Personal Coach CrewAI Application
Contains specialized tools for each agent's functionality.
Supports modular class-based tool containers.
"""
# from typing import TYPE_CHECKING, Dict, Any
# # Version info
# __version__ = "1.0.0"
# # Lazy imports for type checking and IDE intellisense
# if TYPE_CHECKING:
# from .voice_tools import VoiceTools
# from .llm_tools import LLMTools
# from .knowledge_tools import KnowledgeTools
# from .validation_tools import ValidationTools
# # Public API: expose only main class-based containers & API
# __all__ = [
# # Tool containers
# "VoiceTools",
# "LLMTools",
# "KnowledgeTools",
# "ValidationTools",
# # Factory and utility functions
# "create_tool_suite",
# "get_tool_by_name",
# "register_tools_with_crew",
# # Constants
# "SUPPORTED_LANGUAGES",
# "TOOL_CATEGORIES"
# ]
# # Constants
# SUPPORTED_LANGUAGES = [
# "en", "es", "fr", "de", "it", "pt", "ru", "zh",
# "ja", "ko", "hi", "ar", "bn", "pa", "te", "mr",
# "ta", "ur", "gu", "kn", "ml", "or"
# ]
# TOOL_CATEGORIES = {
# "VOICE": ["speech_to_text", "text_to_speech", "language_detection"],
# "LLM": ["generate_response", "generate_questions", "summarize", "paraphrase"],
# "KNOWLEDGE": ["search_knowledge", "extract_wisdom", "find_practices"],
# "VALIDATION": ["validate_response", "check_safety", "analyze_tone"]
# }
# # Factory: unified tool suite
# def create_tool_suite(config) -> Dict[str, Any]:
# """
# Create a complete suite of tools for all agents.
# Args:
# config: Configuration object
# Returns:
# dict: Dictionary of initialized tool containers
# """
# from .voice_tools import VoiceTools
# from .llm_tools import LLMTools
# from .knowledge_tools import KnowledgeTools
# from .validation_tools import ValidationTools
# return {
# "voice": VoiceTools(config),
# "llm": LLMTools(config),
# "knowledge": KnowledgeTools(config),
# "validation": ValidationTools(config)
# }
# def get_tool_by_name(tool_name: str, config):
# """
# Get a specific tool container by name.
# Args:
# tool_name: Name of the tool container ('voice', 'llm', 'knowledge', 'validation')
# config: Configuration object
# Returns:
# Tool container class instance or None
# """
# tool_mapping = {
# "voice": lambda c: __import__("agents.tools.voice_tools", fromlist=["VoiceTools"]).VoiceTools(c),
# "llm": lambda c: __import__("agents.tools.llm_tools", fromlist=["LLMTools"]).LLMTools(c),
# "knowledge": lambda c: __import__("agents.tools.knowledge_tools", fromlist=["KnowledgeTools"]).KnowledgeTools(c),
# "validation": lambda c: __import__("agents.tools.validation_tools", fromlist=["ValidationTools"]).ValidationTools(c),
# }
# tool_factory = tool_mapping.get(tool_name.lower())
# if tool_factory:
# return tool_factory(config)
# return None
# # Tool registry for CrewAI (for UI/metadata/documentation)
# def register_tools_with_crew():
# """
# Register all tools with CrewAI framework.
# Returns a list of tool configurations for CrewAI.
# """
# return [
# {
# "name": "speech_to_text",
# "description": "Convert speech in any language to text",
# "category": "VOICE"
# },
# {
# "name": "text_to_speech",
# "description": "Convert text to natural speech in multiple languages",
# "category": "VOICE"
# },
# {
# "name": "search_knowledge",
# "description": "Search through spiritual and self-help texts",
# "category": "KNOWLEDGE"
# },
# {
# "name": "generate_response",
# "description": "Generate empathetic and helpful responses",
# "category": "LLM"
# },
# {
# "name": "validate_response",
# "description": "Ensure response safety and appropriateness",
# "category": "VALIDATION"
# }
# ]
# # Initialization check for debug mode
# import os
# if os.getenv("DEBUG_MODE", "false").lower() == "true":
# print(f"Agent Tools module v{__version__} initialized")
# print(f"Supported languages: {len(SUPPORTED_LANGUAGES)}")
# print(f"Tool categories: {list(TOOL_CATEGORIES.keys())}")
from .voice_tools import VoiceTools
from .llm_tools import LLMTools
from .knowledge_tools import KnowledgeTools
from .validation_tools import ValidationTools
__all__ = [
"VoiceTools",
"LLMTools",
"KnowledgeTools",
"ValidationTools"
]