Skip to content

Commit

Permalink
Fix coroutine handling error in tool output submission
Browse files Browse the repository at this point in the history
  • Loading branch information
VRSEN committed May 5, 2024
1 parent 1d99dbb commit 1f26c5d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions app/services/run/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,19 @@ async def submit_tool_outputs_to_run(
return db_run

@staticmethod
def get_in_progress_run_step(*, run_id, session: Session) -> RunStep:
run_step = (
session.execute(
select(RunStep)
.where(RunStep.run_id == run_id)
.where(RunStep.type == "tool_calls")
.where(RunStep.status == "in_progress")
.order_by(desc(RunStep.created_at))
)
.scalars()
.one_or_none()
async def get_in_progress_run_step(*, run_id: str, session: AsyncSession):
result = await session.execute(
select(RunStep)
.where(RunStep.run_id == run_id)
.where(RunStep.type == "tool_calls")
.where(RunStep.status == "in_progress")
.order_by(desc(RunStep.created_at))
)
run_step = result.scalars().one_or_none()

if not run_step:
raise ResourceNotFoundError("run_step not found or not in progress")

return run_step

@staticmethod
Expand Down

0 comments on commit 1f26c5d

Please sign in to comment.