Skip to content

Commit

Permalink
Updating retrieval for multion sdk changes (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
HowieG authored Jul 3, 2024
1 parent c6223a1 commit 3e54c42
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions examples/multion/Webpage_data_retrieval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,26 @@
" api_key=os.environ.get(\"MULTION_API_KEY\"),\n",
" agentops_api_key=os.environ.get(\"AGENTOPS_API_KEY\"),\n",
")\n",
"create_session_params = {\"url\": \"https://www.rei.com/\"}\n",
"\n",
"create_session_response = multion.sessions.create(**create_session_params)\n",
"session_id = create_session_response.session_id\n",
"cmd = \"find the cheapest satellite phone on REI\"\n",
"print(create_session_response.message)\n",
"cmd = \"what three things do i get with agentops\"\n",
"url = \"https://www.agentops.ai/\"\n",
"\n",
"retrieve_response = multion.sessions.retrieve(\n",
" session_id=session_id,\n",
" cmd=cmd,\n",
" url=\"https://www.rei.com/\",\n",
" fields=[\"price\"],\n",
" include_screenshot=True,\n",
"retrieve_response = multion.retrieve(\n",
" cmd=cmd, url=url, fields=[\"price\"], include_screenshot=True\n",
")\n",
"print(retrieve_response.message)\n",
"\n",
"while retrieve_response.status == \"CONTINUE\":\n",
" retrieve_response = multion.sessions.retrieve(\n",
" session_id=session_id,\n",
" retrieve_response = multion.retrieve(\n",
" cmd=cmd,\n",
" url=\"https://www.rei.com/\",\n",
" url=url,\n",
" fields=[\"price\"],\n",
" include_screenshot=True,\n",
" )\n",
" print(retrieve_response.message)\n",
"\n",
"if retrieve_response.status == \"DONE\":\n",
" print(\"task completed\")\n",
"\n",
"get_screenshot = multion.sessions.screenshot(session_id=session_id)\n",
"close_session_response = multion.sessions.close(session_id=session_id)"
" print(\"task completed\")"
]
},
{
Expand Down Expand Up @@ -115,7 +104,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 3e54c42

Please sign in to comment.