From 79b237977b6c499742f09054865769cd6c8db92e Mon Sep 17 00:00:00 2001 From: Diwank Singh Tomer Date: Thu, 12 Dec 2024 10:34:18 +0530 Subject: [PATCH] wip: Minor refactors Signed-off-by: Diwank Singh Tomer --- agents-api/.gitignore | 3 ++- agents-api/agents_api/activities/demo.py | 4 +--- agents-api/agents_api/activities/truncation.py | 9 +++++---- agents-api/pyproject.toml | 6 ++++++ agents-api/uv.lock | 11 +++++++++++ 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/agents-api/.gitignore b/agents-api/.gitignore index 33217a796..651078450 100644 --- a/agents-api/.gitignore +++ b/agents-api/.gitignore @@ -1,5 +1,6 @@ # Local database files -cozo.db +cozo* +.cozo* temporal.db *.bak *.dat diff --git a/agents-api/agents_api/activities/demo.py b/agents-api/agents_api/activities/demo.py index f6d63f206..797ef6c90 100644 --- a/agents-api/agents_api/activities/demo.py +++ b/agents-api/agents_api/activities/demo.py @@ -1,5 +1,3 @@ -from typing import Callable - from temporalio import activity from ..env import testing @@ -14,6 +12,6 @@ async def mock_demo_activity(a: int, b: int) -> int: return a + b -demo_activity: Callable[[int, int], int] = activity.defn(name="demo_activity")( +demo_activity = activity.defn(name="demo_activity")( demo_activity if not testing else mock_demo_activity ) diff --git a/agents-api/agents_api/activities/truncation.py b/agents-api/agents_api/activities/truncation.py index afdb43da4..719cf12e3 100644 --- a/agents-api/agents_api/activities/truncation.py +++ b/agents-api/agents_api/activities/truncation.py @@ -14,10 +14,10 @@ def get_extra_entries(messages: list[Entry], token_count_threshold: int) -> list[UUID]: raise NotImplementedError() - if not len(messages): - return messages + # if not len(messages): + # return messages - _token_cnt, _offset = 0, 0 + # _token_cnt, _offset = 0, 0 # if messages[0].role == Role.system: # token_cnt, offset = messages[0].token_count, 1 @@ -36,7 +36,8 @@ def get_extra_entries(messages: list[Entry], token_count_threshold: int) -> list @activity.defn @beartype async def truncation(session_id: str, token_count_threshold: int) -> None: - session_id = UUID(session_id) + raise NotImplementedError() + # session_id = UUID(session_id) # delete_entries( # get_extra_entries( diff --git a/agents-api/pyproject.toml b/agents-api/pyproject.toml index 677abd678..350949523 100644 --- a/agents-api/pyproject.toml +++ b/agents-api/pyproject.toml @@ -60,6 +60,7 @@ dev = [ "ipywidgets>=8.1.5", "julep>=1.43.1", "jupyterlab>=4.3.1", + "pip>=24.3.1", "poethepoet>=0.31.1", "pyjwt>=2.10.1", "pyright>=1.1.389", @@ -68,6 +69,11 @@ dev = [ "ward>=0.68.0b0", ] +[tool.setuptools] +py-modules = [ + "agents_api" +] + [tool.uv.sources] litellm = { url = "https://github.com/julep-ai/litellm/archive/fix_anthropic_tool_image_content.zip" } diff --git a/agents-api/uv.lock b/agents-api/uv.lock index 9517c86f3..1f03aadca 100644 --- a/agents-api/uv.lock +++ b/agents-api/uv.lock @@ -65,6 +65,7 @@ dev = [ { name = "ipywidgets" }, { name = "julep" }, { name = "jupyterlab" }, + { name = "pip" }, { name = "poethepoet" }, { name = "pyjwt" }, { name = "pyright" }, @@ -130,6 +131,7 @@ dev = [ { name = "ipywidgets", specifier = ">=8.1.5" }, { name = "julep", specifier = ">=1.43.1" }, { name = "jupyterlab", specifier = ">=4.3.1" }, + { name = "pip", specifier = ">=24.3.1" }, { name = "poethepoet", specifier = ">=0.31.1" }, { name = "pyjwt", specifier = ">=2.10.1" }, { name = "pyright", specifier = ">=1.1.389" }, @@ -2014,6 +2016,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/9e/c3/059298687310d527a58bb01f3b1965787ee3b40dce76752eda8b44e9a2c5/pexpect-4.9.0-py2.py3-none-any.whl", hash = "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523", size = 63772 }, ] +[[package]] +name = "pip" +version = "24.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f4/b1/b422acd212ad7eedddaf7981eee6e5de085154ff726459cf2da7c5a184c1/pip-24.3.1.tar.gz", hash = "sha256:ebcb60557f2aefabc2e0f918751cd24ea0d56d8ec5445fe1807f1d2109660b99", size = 1931073 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ef/7d/500c9ad20238fcfcb4cb9243eede163594d7020ce87bd9610c9e02771876/pip-24.3.1-py3-none-any.whl", hash = "sha256:3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed", size = 1822182 }, +] + [[package]] name = "platformdirs" version = "4.3.6"