diff --git a/examples/multion_example_browse.ipynb b/examples/multion_example_browse.ipynb index 23920237..d9775ecf 100644 --- a/examples/multion_example_browse.ipynb +++ b/examples/multion_example_browse.ipynb @@ -14,7 +14,7 @@ "\u001b[?25h Checking if build backend supports build_editable ... \u001b[?25ldone\n", "\u001b[?25h Getting requirements to build editable ... \u001b[?25ldone\n", "\u001b[?25h Preparing editable metadata (pyproject.toml) ... \u001b[?25ldone\n", - "\u001b[?25hRequirement already satisfied: agentops<0.3.0,>=0.2.0 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from multion==1.2.0) (0.2.0)\n", + "\u001b[?25hRequirement already satisfied: agentops<0.3.0,>=0.2.0 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from multion==1.2.0) (0.2.1)\n", "Requirement already satisfied: httpx>=0.21.2 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from multion==1.2.0) (0.27.0)\n", "Requirement already satisfied: httpx-sse==0.4.0 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from multion==1.2.0) (0.4.0)\n", "Requirement already satisfied: pydantic>=1.9.2 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from multion==1.2.0) (2.7.2)\n", @@ -36,7 +36,7 @@ "Building wheels for collected packages: multion\n", " Building editable for multion (pyproject.toml) ... \u001b[?25ldone\n", "\u001b[?25h Created wheel for multion: filename=multion-1.2.0-py3-none-any.whl size=2792 sha256=142c67040af03f6fd4e406d67bc5cdcf78f025c5b289ffe58f887de2f60c0b9c\n", - " Stored in directory: /private/var/folders/jb/71y2z4v178jdr5xcgbxfm0gc0000gp/T/pip-ephem-wheel-cache-z0mo7tvu/wheels/df/4b/d9/cccd5ceada6ca92256cee7f065c3e64e9c91b3d307977e2bba\n", + " Stored in directory: /private/var/folders/jb/71y2z4v178jdr5xcgbxfm0gc0000gp/T/pip-ephem-wheel-cache-b7qk12t7/wheels/df/4b/d9/cccd5ceada6ca92256cee7f065c3e64e9c91b3d307977e2bba\n", "Successfully built multion\n", "Installing collected packages: multion\n", " Attempting uninstall: multion\n", @@ -45,37 +45,36 @@ " Successfully uninstalled multion-1.2.0\n", "Successfully installed multion-1.2.0\n", "Note: you may need to restart the kernel to use updated packages.\n", - "Obtaining file:///Users/howardgil/Desktop/agentops/AgentOps-AI/agentops\n", + "Processing /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops\n", " Installing build dependencies ... \u001b[?25ldone\n", - "\u001b[?25h Checking if build backend supports build_editable ... \u001b[?25ldone\n", - "\u001b[?25h Getting requirements to build editable ... \u001b[?25ldone\n", - "\u001b[?25h Preparing editable metadata (pyproject.toml) ... \u001b[?25ldone\n", - "\u001b[?25hRequirement already satisfied: requests==2.31.0 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from agentops==0.2.0) (2.31.0)\n", - "Requirement already satisfied: psutil==5.9.8 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from agentops==0.2.0) (5.9.8)\n", - "Requirement already satisfied: packaging==23.2 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from agentops==0.2.0) (23.2)\n", - "Requirement already satisfied: termcolor==2.4.0 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from agentops==0.2.0) (2.4.0)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.2.0) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.2.0) (3.7)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.2.0) (2.2.1)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.2.0) (2024.2.2)\n", + "\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n", + "\u001b[?25h Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n", + "\u001b[?25hRequirement already satisfied: requests==2.31.0 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from agentops==0.2.1) (2.31.0)\n", + "Requirement already satisfied: psutil==5.9.8 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from agentops==0.2.1) (5.9.8)\n", + "Requirement already satisfied: packaging==23.2 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from agentops==0.2.1) (23.2)\n", + "Requirement already satisfied: termcolor==2.4.0 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from agentops==0.2.1) (2.4.0)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.2.1) (3.3.2)\n", + "Requirement already satisfied: idna<4,>=2.5 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.2.1) (3.7)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.2.1) (2.2.1)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops/env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.2.1) (2024.2.2)\n", "Building wheels for collected packages: agentops\n", - " Building editable for agentops (pyproject.toml) ... \u001b[?25ldone\n", - "\u001b[?25h Created wheel for agentops: filename=agentops-0.2.0-0.editable-py3-none-any.whl size=7475 sha256=7dadfe129d65306c91e9b497870f49413f095d4014d15cf69927bf2b2e3ddbfd\n", - " Stored in directory: /private/var/folders/jb/71y2z4v178jdr5xcgbxfm0gc0000gp/T/pip-ephem-wheel-cache-oevvs0lr/wheels/43/52/53/9286c77226c557a85392056462580d0d7db8d733d3a9c9be69\n", + " Building wheel for agentops (pyproject.toml) ... \u001b[?25ldone\n", + "\u001b[?25h Created wheel for agentops: filename=agentops-0.2.1-py3-none-any.whl size=43115 sha256=e154480cfde179a77da859a210dbedc77feade7b01cf68ff97d40e271d930b57\n", + " Stored in directory: /private/var/folders/jb/71y2z4v178jdr5xcgbxfm0gc0000gp/T/pip-ephem-wheel-cache-z07zsgac/wheels/43/52/53/9286c77226c557a85392056462580d0d7db8d733d3a9c9be69\n", "Successfully built agentops\n", "Installing collected packages: agentops\n", " Attempting uninstall: agentops\n", - " Found existing installation: agentops 0.2.0\n", - " Uninstalling agentops-0.2.0:\n", - " Successfully uninstalled agentops-0.2.0\n", - "Successfully installed agentops-0.2.0\n", + " Found existing installation: agentops 0.2.1\n", + " Uninstalling agentops-0.2.1:\n", + " Successfully uninstalled agentops-0.2.1\n", + "Successfully installed agentops-0.2.1\n", "Note: you may need to restart the kernel to use updated packages.\n" ] } ], "source": [ "%pip install -e ../../../HowieG/multion-python\n", - "%pip install -e .." + "%pip install .." ] }, { @@ -84,16 +83,22 @@ "metadata": {}, "outputs": [ { - "ename": "TypeError", - "evalue": "SessionsClient.__init__() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[2], line 6\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmultion\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mrequest_options\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m RequestOptions\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m multion \u001b[38;5;241m=\u001b[39m \u001b[43mMultiOn\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 7\u001b[0m \u001b[43m \u001b[49m\u001b[43mapi_key\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43menviron\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mMULTION_API_KEY\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 8\u001b[0m \u001b[43m \u001b[49m\u001b[43magentops_api_key\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43menviron\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mAGENTOPS_API_KEY\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 9\u001b[0m \u001b[43m)\u001b[49m\n\u001b[1;32m 10\u001b[0m cmd \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwhat three things do i get with agentops\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 11\u001b[0m request_options \u001b[38;5;241m=\u001b[39m RequestOptions(\n\u001b[1;32m 12\u001b[0m timeout_in_seconds\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m60\u001b[39m, max_retries\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m4\u001b[39m, additional_headers\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtest\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124ming\u001b[39m\u001b[38;5;124m\"\u001b[39m}\n\u001b[1;32m 13\u001b[0m )\n", - "File \u001b[0;32m~/Desktop/agentops/HowieG/multion-python/src/multion/client.py:54\u001b[0m, in \u001b[0;36mMultiOn.__init__\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 52\u001b[0m agentops_api_key \u001b[38;5;241m=\u001b[39m kwargs\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124magentops_api_key\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m 53\u001b[0m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m---> 54\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msessions \u001b[38;5;241m=\u001b[39m \u001b[43mWrappedSessionsClient\u001b[49m\u001b[43m(\u001b[49m\u001b[43mclient_wrapper\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_client_wrapper\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 55\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m agentops_api_key \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 56\u001b[0m agentops\u001b[38;5;241m.\u001b[39minit(api_key\u001b[38;5;241m=\u001b[39magentops_api_key, auto_start_session\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n", - "File \u001b[0;32m~/Desktop/agentops/HowieG/multion-python/src/multion/sessions/wrapped_client.py:46\u001b[0m, in \u001b[0;36mWrappedSessionsClient.__init__\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 45\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m---> 46\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__init__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "\u001b[0;31mTypeError\u001b[0m: SessionsClient.__init__() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given" + "name": "stderr", + "output_type": "stream", + "text": [ + "🖇 AgentOps: Cannot record event - no current session\n", + "🖇 AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=6f01ccad-23a3-4d34-a497-e61ebafad847\u001b[0m\u001b[0m\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Memorizing the following information: The features provided by AgentOps:\n", + "1. Agent Agnostic SDK\n", + "2. LLM Cost (OpenAI, etc)\n", + "3. Replay Analytics\n", + "\n" ] } ], diff --git a/examples/multion_example_not_integrated.ipynb b/examples/multion_example_not_integrated.ipynb deleted file mode 100644 index d2bd4182..00000000 --- a/examples/multion_example_not_integrated.ipynb +++ /dev/null @@ -1,113 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%pip install multion\n", - "%pip install agentops\n", - "%pip install python-dotenv" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import multion\n", - "from multion.client import MultiOn\n", - "import agentops\n", - "from agentops import ActionEvent, LLMEvent, ToolEvent, ErrorEvent\n", - "import os\n", - "import dotenv\n", - "from dotenv import load_dotenv\n", - "\n", - "load_dotenv()\n", - "\n", - "agentops.init(\"33413f5a-5cf1-4d8f-b0a2-e995a8d4298a\")\n", - "multion = MultiOn(api_key=os.environ.get(\"MULTION_API_KEY\"), agentops_api_key=...)\n", - "create_session_params= {\n", - " \"url\": \"https://www.rei.com/\"\n", - "}\n", - "action_event = ActionEvent(params=create_session_params,action_type=\"create_session\")\n", - "create_session_response = multion.sessions.create(**create_session_params)\n", - "action_event.returns = create_session_response.__dict__\n", - "agentops.record(action_event)\n", - "session_id = create_session_response.session_id\n", - "print(create_session_response.message)\n", - "cmd=\"find the top reviewed satellite phone on REI and add it to my cart. Dismiss any modals as necessary.\"\n", - "step_session_params= {\n", - " \t\"session_id\": session_id,\n", - " \"cmd\": cmd,\n", - " \"url\": \"https://www.rei.com/\",\n", - " \"include_screenshot\":True,\n", - "}\n", - "llm_event = LLMEvent(prompt=cmd)\n", - "agentops.record(llm_event)\n", - "\n", - "action_event = ActionEvent(params=step_session_params,action_type=\"step_session\")\n", - "llm_event = LLMEvent()\n", - "step_session_response = multion.sessions.step(**step_session_params)\n", - "print(step_session_response.message)\n", - "action_event.returns = step_session_response.__dict__\n", - "action_event.screenshot = step_session_response.screenshot\n", - "llm_event.prompt = step_session_response.message\n", - "agentops.record(action_event)\n", - "agentops.record(llm_event)\n", - "\n", - "while step_session_response.status == 'CONTINUE':\n", - " action_event = ActionEvent(params=step_session_params,action_type=\"step_session\")\n", - " llm_event = LLMEvent()\n", - " step_session_response = multion.sessions.step(**step_session_params)\n", - " print(step_session_response.message)\n", - " action_event.returns = step_session_response.__dict__\n", - " action_event.screenshot = step_session_response.screenshot\n", - " llm_event.prompt = step_session_response.message\n", - " agentops.record(action_event)\n", - " agentops.record(llm_event)\n", - " \n", - "if step_session_response.status == 'DONE':\n", - " action_event = ActionEvent(params=step_session_params,action_type=\"step_session\")\n", - " llm_event = LLMEvent()\n", - " print('task completed')\n", - " action_event.returns = step_session_response.__dict__\n", - " action_event.screenshot = step_session_response.screenshot\n", - " llm_event.prompt = step_session_response.message\n", - " agentops.record(action_event)\n", - " agentops.record(llm_event)\n", - "\n", - "print(step_session_response.message)\n", - "get_screenshot = multion.sessions.screenshot(session_id=session_id)\n", - "print(\"screenshot of session: \", get_screenshot.screenshot)\n", - "close_session_response = multion.sessions.close(session_id=session_id)\n", - "print(\"close_session_response: \", close_session_response)\n", - "\n", - "agentops.end_session(\"Success\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "env", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.2" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/examples/multion_example_retrieve.ipynb b/examples/multion_example_retrieve.ipynb index 93e55194..9b587d80 100644 --- a/examples/multion_example_retrieve.ipynb +++ b/examples/multion_example_retrieve.ipynb @@ -7,7 +7,7 @@ "outputs": [], "source": [ "%pip install -e ../../../HowieG/multion-python\n", - "%pip install agentops" + "%pip install .." ] }, { diff --git a/examples/multion_example_step_session.ipynb b/examples/multion_example_step_session.ipynb index a3347ba2..3f80735d 100644 --- a/examples/multion_example_step_session.ipynb +++ b/examples/multion_example_step_session.ipynb @@ -18,7 +18,7 @@ "source": [ "import multion\n", "from multion.client import MultiOn\n", - "from multion.sessions.types.sessions_step_stream_request_browser_params import (\n", + "from multion.sessions.types.sessions_step_request_browser_params import (\n", " SessionsStepRequestBrowserParams,\n", ")\n", "from multion.core.request_options import RequestOptions\n", diff --git a/examples/multion_example_step_stream.ipynb b/examples/multion_example_step_stream.ipynb index 68a6e135..1cf94dfa 100644 --- a/examples/multion_example_step_stream.ipynb +++ b/examples/multion_example_step_stream.ipynb @@ -68,7 +68,7 @@ " 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)s" + "close_session_response = multion.sessions.close(session_id=session_id)" ] } ],