Add MetricsTool to telegram_inference_bot.py

This commit is contained in:
2024-08-18 18:56:34 -05:00
parent 1bd7f6de89
commit 3c622d5465
+3 -2
View File
@@ -8,6 +8,7 @@ from telegram import error as TelegramErrors, Update, __version__ as telegram_ve
from telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes, CallbackQueryHandler from telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes, CallbackQueryHandler
from dotenv import load_dotenv from dotenv import load_dotenv
from tools.base_tool import BaseTool from tools.base_tool import BaseTool
from tools.metrics_tool import MetricsTool
from anthropic import Anthropic from anthropic import Anthropic
# Load environment variables # Load environment variables
@@ -38,10 +39,10 @@ conversation_history = {}
processing_status = {} processing_status = {}
# Load tools # Load tools
tools = [] tools = [MetricsTool()] # Add MetricsTool instance
tools_dir = os.path.join(os.path.dirname(__file__), 'tools') tools_dir = os.path.join(os.path.dirname(__file__), 'tools')
for filename in os.listdir(tools_dir): for filename in os.listdir(tools_dir):
if filename.endswith('.py') and filename != '__init__.py' and filename != 'base_tool.py': if filename.endswith('.py') and filename not in ['__init__.py', 'base_tool.py', 'metrics_tool.py']:
module_name = f'tools.{filename[:-3]}' module_name = f'tools.{filename[:-3]}'
module = importlib.import_module(module_name) module = importlib.import_module(module_name)
for name, obj in inspect.getmembers(module): for name, obj in inspect.getmembers(module):