From bfc84903d60c79b36497e21a1411df3133a4f099 Mon Sep 17 00:00:00 2001 From: HamadaSalhab Date: Wed, 2 Oct 2024 17:21:05 +0300 Subject: [PATCH] Run poe check --- .../task_steps/raise_complete_async.py | 4 +- .../routers/tasks/update_execution.py | 8 +- agents-api/notebooks/03-summarise.ipynb | 4 +- agents-api/notebooks/RecSum-experiments.ipynb | 84 +++++++++++-------- 4 files changed, 59 insertions(+), 41 deletions(-) diff --git a/agents-api/agents_api/activities/task_steps/raise_complete_async.py b/agents-api/agents_api/activities/task_steps/raise_complete_async.py index a73df3f8d..54fd8a32c 100644 --- a/agents-api/agents_api/activities/task_steps/raise_complete_async.py +++ b/agents-api/agents_api/activities/task_steps/raise_complete_async.py @@ -1,4 +1,5 @@ import base64 + from temporalio import activity from ...autogen.openapi_model import CreateTransitionRequest @@ -11,10 +12,9 @@ @activity.defn async def raise_complete_async(context: StepContext, output: StepOutcome) -> None: - activity_info = activity.info() - captured_token = base64.b64encode(activity_info.task_token).decode('ascii') + captured_token = base64.b64encode(activity_info.task_token).decode("ascii") activity_id = activity_info.activity_id workflow_run_id = activity_info.workflow_run_id workflow_id = activity_info.workflow_id diff --git a/agents-api/agents_api/routers/tasks/update_execution.py b/agents-api/agents_api/routers/tasks/update_execution.py index a5ca30aab..968b6bdfb 100644 --- a/agents-api/agents_api/routers/tasks/update_execution.py +++ b/agents-api/agents_api/routers/tasks/update_execution.py @@ -47,7 +47,9 @@ async def update_execution( workflow_id = token_data["metadata"].get("x-workflow-id", None) if activity_id is None or run_id is None or workflow_id is None: act_handle = temporal_client.get_async_activity_handle( - task_token=base64.b64decode(token_data["task_token"].encode('ascii')), + task_token=base64.b64decode( + token_data["task_token"].encode("ascii") + ), ) else: @@ -59,6 +61,8 @@ async def update_execution( try: await act_handle.complete(data.input) except Exception as e: - raise HTTPException(status_code=500, detail="Failed to resume execution") + raise HTTPException( + status_code=500, detail="Failed to resume execution" + ) case _: raise HTTPException(status_code=400, detail="Invalid request data") diff --git a/agents-api/notebooks/03-summarise.ipynb b/agents-api/notebooks/03-summarise.ipynb index a934fd1b9..98e6f5e0a 100644 --- a/agents-api/notebooks/03-summarise.ipynb +++ b/agents-api/notebooks/03-summarise.ipynb @@ -766,7 +766,9 @@ " messages.append(user(start_message))\n", "\n", " print(\"Starting chatml generation\")\n", - " trim_result = generate(messages, model=\"gpt-4-turbo\", temperature=0.1, stop=[\"