diff --git a/agents-api/agents_api/activities/summarization.py b/agents-api/agents_api/activities/summarization.py index 4740cb43a..f5d1115a8 100644 --- a/agents-api/agents_api/activities/summarization.py +++ b/agents-api/agents_api/activities/summarization.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import asyncio from uuid import UUID from typing import Callable from textwrap import dedent @@ -174,13 +173,14 @@ async def summarization(session_id: str) -> None: assert len(entries) > 0, "no need to summarize on empty entries list" - trimmed_messages, entities = await asyncio.gather( - trim_messages(entries, model=summarization_model_name), - get_entities(entries, model=summarization_model_name), - ) - summarized = await summarize_messages( - trimmed_messages, model=summarization_model_name - ) + entities = await get_entities(entries, model=summarization_model_name) + + # trimmed_messages, entities = await asyncio.gather( + # trim_messages(entries, model=summarization_model_name), + # get_entities(entries, model=summarization_model_name), + # ) + summarized = await summarize_messages(entries, model=summarization_model_name) + trimmed_messages = await trim_messages(summarized, model=summarization_model_name) ts_delta = (entries[1]["timestamp"] - entries[0]["timestamp"]) / 2 new_entities_entry = Entry( session_id=session_id, @@ -197,7 +197,7 @@ async def summarization(session_id: str) -> None: old_entry_ids=entities_entry_ids, ) - for msg in summarized: + for msg in trimmed_messages: new_entry = Entry( session_id=session_id, source="summarizer",