From bbec6df3fdc84c77a98cd04bc8d62cf9c078e7cc Mon Sep 17 00:00:00 2001 From: ThomasTaroni Date: Sat, 21 Jun 2025 22:19:50 +0200 Subject: [PATCH] Refactor response handling to parse JSON content. Replace raw response text retrieval with JSON parsing to extract specific content. This ensures more precise data handling and aligns with expected response structure. --- src/phoenix_technologies/smd/server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/phoenix_technologies/smd/server.py b/src/phoenix_technologies/smd/server.py index d86704e..45b89a8 100644 --- a/src/phoenix_technologies/smd/server.py +++ b/src/phoenix_technologies/smd/server.py @@ -49,7 +49,8 @@ async def summarize_to_words(text: str, title: str, target_word_count: int = 100 async with aiohttp.ClientSession() as session: async with session.post(url, headers=headers, json=payload) as response: if response.status == 200: - return await response.text() + data = await response.json() + return data.get("choices")[0].get("message").get("content") else: return await response.text()