From 8f24bb909e7b06b02be663869995a0f2b16ca47d Mon Sep 17 00:00:00 2001 From: GuanyiLi-Craig Date: Mon, 2 Jun 2025 18:07:53 +0100 Subject: [PATCH] upgrade grafi version --- grafi_dev/server.py | 20 +++++++++++++++----- pyproject.toml | 2 +- uv.lock | 18 ++++++++++++++---- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/grafi_dev/server.py b/grafi_dev/server.py index ee8b1a1..582e6fc 100644 --- a/grafi_dev/server.py +++ b/grafi_dev/server.py @@ -52,17 +52,27 @@ def _execution_context(conv_id: str, req_id: str): # ---------- conversation helpers ---------------------------------------- def get_conversation_ids(): + evs = container.event_store.get_events() + conv_ids = {e.execution_context.conversation_id for e in evs} return sorted( - { - e.execution_context.conversation_id - for e in container.event_store.get_events() - } + conv_ids, + key=lambda conv_id: min( + e.timestamp for e in evs if e.execution_context.conversation_id == conv_id + ), ) def get_request_ids(conv_id: str): evs = container.event_store.get_conversation_events(conv_id) - return sorted({e.execution_context.assistant_request_id for e in evs}) + req_ids = {e.execution_context.assistant_request_id for e in evs} + return sorted( + req_ids, + key=lambda req_id: min( + e.timestamp + for e in evs + if e.execution_context.assistant_request_id == req_id + ), + ) # ---------- FastAPI factory --------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 4252a60..c01cb3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ readme = "README.md" requires-python = ">=3.12" dependencies = [ "fastapi>=0.115.12", - "grafi>=0.0.11", + "grafi>=0.0.12", "typer>=0.15.3", "uvicorn>=0.34.2", ] diff --git a/uv.lock b/uv.lock index a0b78d3..5bef697 100644 --- a/uv.lock +++ b/uv.lock @@ -167,20 +167,21 @@ wheels = [ [[package]] name = "grafi" -version = "0.0.11" +version = "0.0.12" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "arize-otel" }, { name = "docstring-parser" }, + { name = "jsonpickle" }, { name = "loguru" }, { name = "openai" }, { name = "openinference-instrumentation-openai" }, { name = "pydantic" }, { name = "types-deprecated" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/86/d2/9c0847828af71a8939df82d222182f7ccdb051f23867f76dcabf46669f5a/grafi-0.0.11.tar.gz", hash = "sha256:c041331aa1f844f5a8ccf39d330da086ac084314b02f0b3feb6b282e267c648b", size = 64989 } +sdist = { url = "https://files.pythonhosted.org/packages/dc/41/50694c9b5a259952cc95fc2cabb0172e81d63a3c626ef389ddc8b0cb76e9/grafi-0.0.12.tar.gz", hash = "sha256:1b5fa1baa5cb51f8c9390fee56a02958966711e4b96c6aa7a1f941e204e853d1", size = 66061 } wheels = [ - { url = "https://files.pythonhosted.org/packages/f1/f9/eab6f88a525a0493a01749f5d37001b42a3e9a9856bc5a27da26698e7f67/grafi-0.0.11-py3-none-any.whl", hash = "sha256:f87520f86186fe436adeb5e9fdca2b1453dde9b0653dcdcf40560274e7912e77", size = 109089 }, + { url = "https://files.pythonhosted.org/packages/c6/98/124deda9659f7dd8d7d0b86acb2918bde2073e51a47c05fc9ff506c4cfa0/grafi-0.0.12-py3-none-any.whl", hash = "sha256:d89dd0a443bb40e69aefdd8d95decd11c9a27499c3fb5ad12a092c0bbcdb8b50", size = 112067 }, ] [[package]] @@ -202,7 +203,7 @@ dev = [ [package.metadata] requires-dist = [ { name = "fastapi", specifier = ">=0.115.12" }, - { name = "grafi", specifier = ">=0.0.11" }, + { name = "grafi", specifier = ">=0.0.12" }, { name = "typer", specifier = ">=0.15.3" }, { name = "uvicorn", specifier = ">=0.34.2" }, ] @@ -331,6 +332,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ee/47/3729f00f35a696e68da15d64eb9283c330e776f3b5789bac7f2c0c4df209/jiter-0.9.0-cp313-cp313t-win_amd64.whl", hash = "sha256:6f7838bc467ab7e8ef9f387bd6de195c43bad82a569c1699cb822f6609dd4cdf", size = 206867 }, ] +[[package]] +name = "jsonpickle" +version = "4.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/03/4f/1dde1e344dc41c40bc3f0eb721d7ddc5fed827bf518ba410c369f6bbaa07/jsonpickle-4.1.0.tar.gz", hash = "sha256:d417d6d693a63fb137e53334164aba618d18aca05a4fd025ff01c2ec134ae4c8", size = 318466 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0e/b5/8d90bb4951a1e821d0b4e559edb3c70918b8954b566c7eb9211846a48c47/jsonpickle-4.1.0-py3-none-any.whl", hash = "sha256:763f837a0b2586b45424d9a07108a798d9feac52f3a152606336f7f9e1a22ffa", size = 46615 }, +] + [[package]] name = "loguru" version = "0.7.3"