diff --git a/src/phoenix_technologies/smd/server.py b/src/phoenix_technologies/smd/server.py index 45b89a8..c5bc19d 100644 --- a/src/phoenix_technologies/smd/server.py +++ b/src/phoenix_technologies/smd/server.py @@ -10,6 +10,7 @@ import logging import aiohttp import asyncio import requests +import time from dotenv import load_dotenv from mcp.server.fastmcp import FastMCP @@ -55,6 +56,8 @@ async def summarize_to_words(text: str, title: str, target_word_count: int = 100 return await response.text() async def smd_detail_article(article_id): + logger.info("Starting smd_detail_article function.") + start_time = time.perf_counter() url = f"https://api.swissdox.ch/api/documents/{article_id}" headers = { "Authorization": f"Bearer {os.getenv('SWISSDOX_BEARER_TOKEN', '')}", @@ -67,6 +70,8 @@ async def smd_detail_article(article_id): if response.status == 200: data = await response.json() summarized_content = await summarize_to_words(title=data.get("title"), text=data.get("text"), target_word_count=10000) + execution_time = time.perf_counter() - start_time + logger.info(f"smd_detail_article executed in {execution_time:.2f} seconds.") return { "message": summarized_content, "article_id": article_id