Skip to content

Commit

Permalink
fix: Fix queries calls
Browse files Browse the repository at this point in the history
  • Loading branch information
whiterabbit1983 committed Apr 19, 2024
1 parent 7000518 commit e1275f1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
15 changes: 5 additions & 10 deletions agents-api/agents_api/activities/summarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import Callable
from textwrap import dedent
from temporalio import activity
from agents_api.clients.cozo import client
from agents_api.models.entry.entries_summarization import (
get_toplevel_entries_query,
entries_summarization_query,
Expand Down Expand Up @@ -154,9 +153,7 @@ async def summarization(session_id: str) -> None:
session_id = UUID(session_id)
entries = [
Entry(**row)
for _, row in client.run(
get_toplevel_entries_query(session_id=session_id)
).iterrows()
for _, row in get_toplevel_entries_query(session_id=session_id).iterrows()
]

assert len(entries) > 0, "no need to summarize on empty entries list"
Expand All @@ -172,10 +169,8 @@ async def summarization(session_id: str) -> None:
timestamp=entries[-1].timestamp + 0.01,
)

client.run(
entries_summarization_query(
session_id=session_id,
new_entry=new_entry,
old_entry_ids=[e.id for e in entries],
)
entries_summarization_query(
session_id=session_id,
new_entry=new_entry,
old_entry_ids=[e.id for e in entries],
)
6 changes: 4 additions & 2 deletions agents-api/agents_api/activities/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ class ChatML(BaseModel):
token_count: Optional[int] = None


class BaseTask(BaseModel): ...
class BaseTask(BaseModel):
...


class BaseTaskArgs(BaseModel): ...
class BaseTaskArgs(BaseModel):
...


class AddPrinciplesTaskArgs(BaseTaskArgs):
Expand Down
6 changes: 4 additions & 2 deletions agents-api/agents_api/clients/worker/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ class ChatML(BaseModel):
token_count: Optional[int] = None


class BaseTask(BaseModel): ...
class BaseTask(BaseModel):
...


class BaseTaskArgs(BaseModel): ...
class BaseTaskArgs(BaseModel):
...


class MemoryManagementTaskArgs(BaseTaskArgs):
Expand Down
4 changes: 2 additions & 2 deletions agents-api/agents_api/models/entry/entries_summarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def entries_summarization_query(

entries = [
[
new_entry.id,
session_id,
str(new_entry.id),
str(session_id),
source,
role,
new_entry.name or "",
Expand Down

0 comments on commit e1275f1

Please sign in to comment.