Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix queries calls #283

Merged
merged 3 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
creatorrr marked this conversation as resolved.
Show resolved Hide resolved
]

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],
)
14 changes: 5 additions & 9 deletions agents-api/agents_api/models/entry/entries_summarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from ...common.protocol.entries import Entry
from ..utils import cozo_query
from ...common.utils import json


@cozo_query
Expand Down Expand Up @@ -83,18 +82,15 @@ def entries_summarization_query(
# Create a list of relations indicating which entries the new entry summarizes.

# Convert the new entry's source information into JSON format for storage.
source = json.dumps(new_entry.source)
role = json.dumps(new_entry.role)
content = json.dumps(new_entry.content)

entries = [
[
new_entry.id,
session_id,
source,
role,
str(new_entry.id),
str(session_id),
new_entry.source,
new_entry.role,
new_entry.name or "",
content,
new_entry.content,
new_entry.token_count,
new_entry.tokenizer,
new_entry.created_at,
Expand Down
1 change: 0 additions & 1 deletion agents-api/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ services:
build:
context: .
dockerfile: Dockerfile.worker
entrypoint: ["tail", "-f", "/dev/null"]
depends_on:
text-embeddings-inference:
condition: service_started
Expand Down
Loading