From 3f1df1684addffc82c6b1f1ae7b300185a0fa69e Mon Sep 17 00:00:00 2001 From: SwiftyOS Date: Thu, 21 Sep 2023 17:43:35 +0200 Subject: [PATCH] formatting --- autogpts/forge/forge/agent.py | 30 ++++++++++++++++++++++++------ autogpts/forge/run | 16 ++++++++-------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/autogpts/forge/forge/agent.py b/autogpts/forge/forge/agent.py index 89a24889..d9bcd65b 100644 --- a/autogpts/forge/forge/agent.py +++ b/autogpts/forge/forge/agent.py @@ -1,4 +1,18 @@ -from forge.sdk import Agent, AgentDB, Step, StepRequestBody, Workspace, ForgeLogger, Task, TaskRequestBody +import json +import pprint + +from forge.sdk import ( + Agent, + AgentDB, + Step, + StepRequestBody, + Workspace, + ForgeLogger, + Task, + TaskRequestBody, + PromptEngine, + chat_completion_request, +) LOG = ForgeLogger(__name__) @@ -64,7 +78,7 @@ class ForgeAgent(Agent): Feel free to create subclasses of the database and workspace to implement your own storage """ super().__init__(database, workspace) - + async def create_task(self, task_request: TaskRequestBody) -> Task: """ The agent protocol, which is the core of the Forge, works by creating a task and then @@ -75,7 +89,9 @@ class ForgeAgent(Agent): want here. """ task = await super().create_task(task_request) - LOG.info(f"📦 Task created: {task.task_id} input: {task.input[:40]}{'...' if len(task.input) > 40 else ''}") + LOG.info( + f"📦 Task created: {task.task_id} input: {task.input[:40]}{'...' if len(task.input) > 40 else ''}" + ) return task async def execute_step(self, task_id: str, step_request: StepRequestBody) -> Step: @@ -108,10 +124,12 @@ class ForgeAgent(Agent): step = await self.db.create_step( task_id=task_id, input=step_request, is_last=True ) - message = f'\t🔄 Step executed: {step.step_id} input: {step.input[:19]}' + message = f"\t🔄 Step executed: {step.step_id} input: {step.input[:19]}" if step.is_last: - message = f'\t✅ Final Step completed: {step.step_id} input: {step.input[:19]}' - + message = ( + f"\t✅ Final Step completed: {step.step_id} input: {step.input[:19]}" + ) + LOG.info(message) artifact = await self.db.create_artifact( diff --git a/autogpts/forge/run b/autogpts/forge/run index 9a6e57cb..19ada609 100755 --- a/autogpts/forge/run +++ b/autogpts/forge/run @@ -1,15 +1,15 @@ #!/bin/bash kill $(lsof -t -i :8000) -ENV_PATH=$(poetry env info --path) -if [ -d "$ENV_PATH" ]; then - rm -rf $ENV_PATH - echo "Removed the poetry environment at $ENV_PATH." -else - echo "No poetry environment found." -fi +# ENV_PATH=$(poetry env info --path) +# if [ -d "$ENV_PATH" ]; then +# rm -rf $ENV_PATH +# echo "Removed the poetry environment at $ENV_PATH." +# else +# echo "No poetry environment found." +# fi -poetry install +# poetry install if [ ! -f .env ]; then cp .env.example .env echo "Please add your api keys to the .env file."