Skip to content

Commit

Permalink
fix: Fix execute yaml task test
Browse files Browse the repository at this point in the history
  • Loading branch information
whiterabbit1983 committed Aug 26, 2024
1 parent 3457252 commit 9feb981
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions agents-api/tests/test_execution_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,17 +719,22 @@ async def _(
):
mock_model_response = ModelResponse(
id="fake_id",
choices=[Choices(message={"role": "assistant", "content": "Hello, world!"})],
choices=[Choices(message={"role": "assistant", "content": "found: true\nvalue: 'Gaga'"})],
created=0,
object="text_completion",
)

with patch("agents_api.clients.litellm.acompletion") as acompletion, open(
"./tests/sample_tasks/find_selector.yaml", "r"
) as task_file:
input = dict(
screenshot_base64="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA",
network_requests=[{"request": {}, "response": {"body": "Lady Gaga"}}],
parameters=["name"],
)
task_definition = yaml.safe_load(task_file)
acompletion.return_value = mock_model_response
data = CreateExecutionRequest(input={"parameters": ["param1", "param2"]})
data = CreateExecutionRequest(input=input)

task = create_task(
developer_id=developer_id,
Expand All @@ -752,6 +757,4 @@ async def _(

mock_run_task_execution_workflow.assert_called_once()

result = await handle.result()
assert result["content"] == "Hello, world!"
assert result["role"] == "assistant"
await handle.result()

0 comments on commit 9feb981

Please sign in to comment.