Skip to content

Commit

Permalink
chore: Re-arrange operations on dialog entries
Browse files Browse the repository at this point in the history
  • Loading branch information
whiterabbit1983 committed Jun 8, 2024
1 parent ddbf7d0 commit cde5055
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions agents-api/agents_api/activities/summarization.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python3

import asyncio
from uuid import UUID
from typing import Callable
from textwrap import dedent
Expand Down Expand Up @@ -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,
Expand All @@ -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",
Expand Down

0 comments on commit cde5055

Please sign in to comment.