mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-01-22 23:44:31 +01:00
Fixed issues with benchmarking
This commit is contained in:
12
.env.example
12
.env.example
@@ -1,9 +1,11 @@
|
||||
# Your OpenAI API Key. If GPT-4 is available it will use that, otherwise will use 3.5-turbo
|
||||
OPENAI_API_KEY=MY-API-KEY
|
||||
|
||||
OPENAI_API_KEY=abc
|
||||
# If you want to enable Helicone proxy and caching
|
||||
# HELICONE_KEY=MY-HELICONE-KEY
|
||||
# OPENAI_API_BASE=https://oai.hconeai.com/v1
|
||||
HELICONE_KEY=abc
|
||||
OPENAI_API_BASE=https://oai.hconeai.com/v1
|
||||
|
||||
# Control log level
|
||||
LOG_LEVEL=INFO
|
||||
LOG_LEVEL=INFO
|
||||
DATABASE_NAME="./agent.db"
|
||||
PORT=8000
|
||||
AGENT_WORKSPACE="agbenchmark/workspace"
|
||||
@@ -11,9 +11,11 @@ if __name__ == "__main__":
|
||||
load_dotenv()
|
||||
database_name = os.getenv("DATABASE_NAME")
|
||||
port = os.getenv("PORT")
|
||||
workspace = os.getenv("AGENT_WORKSPACE")
|
||||
auto_gpt = autogpt.agent.AutoGPT()
|
||||
|
||||
database = autogpt.db.AgentDB(database_name)
|
||||
agent = Agent.setup_agent(auto_gpt.task_handler, auto_gpt.step_handler)
|
||||
agent.db = database
|
||||
agent.workspace = workspace
|
||||
agent.start(port=port)
|
||||
|
||||
@@ -14,10 +14,12 @@ class AutoGPT:
|
||||
await Agent.db.create_step(task.task_id, task.input, is_last=True)
|
||||
time.sleep(2)
|
||||
autogpt.utils.run(task.input)
|
||||
# print(f"Created Task id: {task.task_id}")
|
||||
return task
|
||||
|
||||
|
||||
async def step_handler(self, step: Step) -> Step:
|
||||
print(f"step: {step.input}")
|
||||
# print(f"step: {step}")
|
||||
agent_step = await Agent.db.get_step(step.task_id, step.step_id)
|
||||
updated_step: Step = await Agent.db.update_step(agent_step.task_id, agent_step.step_id, status="completed")
|
||||
updated_step.output = agent_step.input
|
||||
|
||||
@@ -137,7 +137,7 @@ class AgentDB(TaskDB):
|
||||
for step in steps:
|
||||
status = Status.created if step[3] == "created" else Status.completed
|
||||
task.steps.append(Step(task_id=step[1], step_id=step[0], name=step[2], status=status, is_last=True if step[4] == 1 else False, additional_properties=step[5]))
|
||||
print(f"Task: {task}")
|
||||
# print(f"Getting task {task_id}.... Task details: {task}")
|
||||
return task
|
||||
else:
|
||||
raise DataNotFoundError("Task not found")
|
||||
@@ -149,7 +149,14 @@ class AgentDB(TaskDB):
|
||||
"SELECT * FROM steps WHERE task_id=? AND step_id=?", (task_id, step_id)
|
||||
)
|
||||
if step := cursor.fetchone():
|
||||
return Step(task_id=task_id, step_id=step_id, name=step[2], status=step[3])
|
||||
return Step(
|
||||
task_id=task_id,
|
||||
step_id=step_id,
|
||||
name=step[2],
|
||||
status=step[3],
|
||||
is_last=step[4] == 1,
|
||||
additional_properties=step[5],
|
||||
)
|
||||
else:
|
||||
raise DataNotFoundError("Step not found")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user