From 4202f251b56787e2cc10dda86646d56bb49a8209 Mon Sep 17 00:00:00 2001 From: Shawn Qiu Date: Tue, 13 Aug 2024 00:15:13 -0700 Subject: [PATCH] clear outputs --- examples/openai-gpt.ipynb | 151 +++++--------------------------------- 1 file changed, 17 insertions(+), 134 deletions(-) diff --git a/examples/openai-gpt.ipynb b/examples/openai-gpt.ipynb index 8919e34e..09cf5ac3 100644 --- a/examples/openai-gpt.ipynb +++ b/examples/openai-gpt.ipynb @@ -21,54 +21,10 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "88c8f60d", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: openai in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (1.40.6)\n", - "Requirement already satisfied: anyio<5,>=3.5.0 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from openai) (4.4.0)\n", - "Requirement already satisfied: distro<2,>=1.7.0 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from openai) (1.9.0)\n", - "Requirement already satisfied: httpx<1,>=0.23.0 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from openai) (0.27.0)\n", - "Requirement already satisfied: jiter<1,>=0.4.0 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from openai) (0.4.2)\n", - "Requirement already satisfied: pydantic<3,>=1.9.0 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from openai) (2.8.2)\n", - "Requirement already satisfied: sniffio in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from openai) (1.3.1)\n", - "Requirement already satisfied: tqdm>4 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from openai) (4.66.5)\n", - "Requirement already satisfied: typing-extensions<5,>=4.11 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from openai) (4.12.2)\n", - "Requirement already satisfied: idna>=2.8 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from anyio<5,>=3.5.0->openai) (3.7)\n", - "Requirement already satisfied: certifi in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from httpx<1,>=0.23.0->openai) (2024.7.4)\n", - "Requirement already satisfied: httpcore==1.* in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from httpx<1,>=0.23.0->openai) (1.0.5)\n", - "Requirement already satisfied: h11<0.15,>=0.13 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n", - "Requirement already satisfied: annotated-types>=0.4.0 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from pydantic<3,>=1.9.0->openai) (0.7.0)\n", - "Requirement already satisfied: pydantic-core==2.20.1 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from pydantic<3,>=1.9.0->openai) (2.20.1)\n", - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Note: you may need to restart the kernel to use updated packages.\n", - "Requirement already satisfied: agentops in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (0.3.7)\n", - "Requirement already satisfied: requests==2.31.0 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from agentops) (2.31.0)\n", - "Requirement already satisfied: psutil==5.9.8 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from agentops) (5.9.8)\n", - "Requirement already satisfied: packaging==23.2 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from agentops) (23.2)\n", - "Requirement already satisfied: termcolor==2.4.0 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from agentops) (2.4.0)\n", - "Requirement already satisfied: charset-normalizer<4,>=2 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from requests==2.31.0->agentops) (3.3.2)\n", - "Requirement already satisfied: idna<4,>=2.5 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from requests==2.31.0->agentops) (3.7)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from requests==2.31.0->agentops) (2.2.2)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (from requests==2.31.0->agentops) (2024.7.4)\n", - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Note: you may need to restart the kernel to use updated packages.\n", - "Requirement already satisfied: python-dotenv in /home/siyangqiu/DevDrive/pythonsdk/env/lib/python3.12/site-packages (1.0.1)\n", - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.2\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Note: you may need to restart the kernel to use updated packages.\n" - ] - } - ], + "outputs": [], "source": [ "%pip install -U openai\n", "%pip install -U agentops\n", @@ -85,7 +41,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "c51dcbda80eb8c53", "metadata": { "collapsed": false @@ -110,7 +66,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "cbc5d13679e269dc", "metadata": { "collapsed": false @@ -134,30 +90,12 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "5d424a02e30ce7f4", "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "🖇 AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=037c5380-e7f2-4ab7-b85b-54b714416fc8\u001b[0m\u001b[0m\n" - ] - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "openai = OpenAI(api_key=OPENAI_API_KEY)\n", "agentops.init(AGENTOPS_API_KEY, default_tags=[\"openai-gpt-notebook\"])" @@ -185,20 +123,12 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "2704d6d625efa77f", "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ChatCompletion(id='chatcmpl-9vfc9uAbQf2b4gkBLF8r2S1hemHff', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='Silent shadows move, unseen, on covert missions of intrigue and espionage.', refusal=None, role='assistant', function_call=None, tool_calls=None))], created=1723531689, model='gpt-3.5-turbo-0125', object='chat.completion', service_tier=None, system_fingerprint=None, usage=CompletionUsage(completion_tokens=15, prompt_tokens=17, total_tokens=32))\n" - ] - } - ], + "outputs": [], "source": [ "message = [{\"role\": \"user\", \"content\": \"Write a 12 word poem about secret agents.\"}]\n", "res = openai.chat.completions.create(\n", @@ -219,21 +149,12 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "537abd77cd0e0d25", "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "🖇 AgentOps: This run's cost $0.000031\n", - "🖇 AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=037c5380-e7f2-4ab7-b85b-54b714416fc8\u001b[0m\u001b[0m\n" - ] - } - ], + "outputs": [], "source": [ "agentops.end_session(\"Success\")" ] @@ -262,30 +183,12 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "544c8f1bdb8c6e4b", "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "🖇 AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=ed47e38d-39c7-498e-bccf-e4b5280c983d\u001b[0m\u001b[0m\n" - ] - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# Create new session\n", "agentops.start_session(tags=[\"openai-gpt-notebook-events\"])" @@ -301,23 +204,12 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "b45754a57148eed1", "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "6" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from agentops import record_action\n", "\n", @@ -340,7 +232,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "2ac84c35", "metadata": {}, "outputs": [], @@ -364,21 +256,12 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "4ca2b49fc06adddb", "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "🖇 AgentOps: This run's cost $0.000017\n", - "🖇 AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=ed47e38d-39c7-498e-bccf-e4b5280c983d\u001b[0m\u001b[0m\n" - ] - } - ], + "outputs": [], "source": [ "agentops.end_session(\"Success\")" ]