diff --git a/examples/recording-events.ipynb b/examples/recording-events.ipynb index 7d0cc30a..9c766b58 100644 --- a/examples/recording-events.ipynb +++ b/examples/recording-events.ipynb @@ -21,11 +21,12 @@ }, "outputs": [], "source": [ + "import agentops\n", "# Create new session\n", - "agentops.start_session()\n", + "agentops.init()\n", "\n", "# Optionally, we can add tags to the session\n", - "# agentops.start_session(['Hello Tracker'])" + "# agentops.init(tags=['Hello Tracker'])" ] }, { @@ -138,42 +139,24 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "eb23c1325298e22f", "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "🖇 AgentOps: Could not post data - {'message': '/events: Error posting event: Error inserting to table=\\'tools\\'. Postgres: json[\\'code\\']=\\'23505\\'. json[\\'message\\']=\\'duplicate key value violates unique constraint \"tools_pkey\"\\''}\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "🖇 AgentOps: This run cost $0.00\n" - ] - } - ], + "outputs": [], "source": [ "from agentops import ToolEvent, record, ErrorEvent\n", - "import agentops\n", - "\n", - "agentops.init()\n", "\n", "def scrape_website(url: str):\n", " tool_event = ToolEvent(name='scrape_website', params={'url':url}) # the start timestamp is set when the obj is created\n", + "\n", " try:\n", - " 1 / 0\n", + " 1 / 0 # Ooops! Something went wrong\n", " except Exception as e:\n", " record(ErrorEvent(exception=e, trigger_event=tool_event))\n", - " record(tool_event)\n", "\n", - "scrape_website('https://app.agentops.ai') \n", + "scrape_website('https://app.agentops.ai') \n", "\n", "agentops.end_session('Success')" ]