diff --git a/src/phoenix_technologies/smd/server.py b/src/phoenix_technologies/smd/server.py index eeae925..b35ddfb 100644 --- a/src/phoenix_technologies/smd/server.py +++ b/src/phoenix_technologies/smd/server.py @@ -26,7 +26,7 @@ logger = logging.getLogger(__name__) # Initialize FastMCP server mcp = FastMCP("SMD Researcher", host="0.0.0.0", port=8000, timeout_keep_alive=720) -async def summarize_to_words(article: dict, target_word_count: int = 1000) -> str: +async def summarize_to_words(text: str, title: str, target_word_count: int = 1000) -> str: url = f"https://maas.ai-2.kvant.cloud/engines/{os.getenv('SWISSDOX_SUMMARIZING_MODEL', '')}/chat/completions" headers = { "x-litellm-api-key": f"Bearer {os.getenv('SWISSDOX_SUMMARIZING_MODEL_APIKEY', '')}", @@ -41,7 +41,7 @@ async def summarize_to_words(article: dict, target_word_count: int = 1000) -> st }, { "role": "user", - "content": f"{str(article)}" + "content": f"{title} - {text}" } ] } @@ -65,7 +65,7 @@ async def smd_detail_article(article_id): async with session.post(url, headers=headers, json=payload) as response: if response.status == 200: data = await response.json() - summarized_content = await summarize_to_words(data, target_word_count=10000) + summarized_content = await summarize_to_words(title=data.get("title"), text=data.get("text"), target_word_count=10000) return summarized_content else: return {