SmolAgent_Tutorial/T0_Installation/installation.ipynb

1653 lines
134 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Installation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1. Install ollama: https://ollama.com/download\n",
" - For install Linux: curl -fsSL https://ollama.com/install.sh | sh\n",
"2. pull the LLM model for test: \"ollama pull phi3\"\n",
"3. install conda\n",
"4. create virtual environment\n",
"5. activate the virtual environment\n",
"6. install smolagents"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Install smolagents"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting smolagents"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
"astra-assistants 2.2.5 requires httpx<0.28.0,>=0.27.0, but you have httpx 0.28.1 which is incompatible.\n",
"e2b 1.0.1 requires httpx<0.28.0,>=0.27.0, but you have httpx 0.28.1 which is incompatible.\n",
"e2b-code-interpreter 1.0.1 requires httpx<0.28.0,>=0.20.0, but you have httpx 0.28.1 which is incompatible.\n",
"gotrue 2.9.3 requires httpx[http2]<0.28,>=0.26, but you have httpx 0.28.1 which is incompatible.\n",
"langchain-google-vertexai 1.0.10 requires httpx<0.28.0,>=0.27.0, but you have httpx 0.28.1 which is incompatible.\n",
"langchain-nvidia-ai-endpoints 0.1.6 requires pillow<11.0.0,>=10.0.0, but you have pillow 11.1.0 which is incompatible.\n",
"langflow-base 0.0.97 requires pandas==2.2.2, but you have pandas 2.2.3 which is incompatible.\n",
"langwatch 0.1.31 requires httpx<0.28.0,>=0.27.0, but you have httpx 0.28.1 which is incompatible.\n",
"postgrest 0.17.2 requires httpx[http2]<0.28,>=0.26, but you have httpx 0.28.1 which is incompatible.\n",
"storage3 0.8.2 requires httpx[http2]<0.28,>=0.26, but you have httpx 0.28.1 which is incompatible.\n",
"supabase 2.9.1 requires httpx<0.28,>=0.26, but you have httpx 0.28.1 which is incompatible.\n",
"supafunc 0.6.2 requires httpx[http2]<0.28,>=0.26, but you have httpx 0.28.1 which is incompatible.\n",
"weaviate-client 4.9.0 requires httpx<=0.27.0,>=0.25.0, but you have httpx 0.28.1 which is incompatible.\n",
"\n",
"[notice] A new release of pip is available: 24.3.1 -> 25.0.1\n",
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Downloading smolagents-1.9.2-py3-none-any.whl.metadata (14 kB)\n",
"Collecting huggingface-hub>=0.28.0 (from smolagents)\n",
" Downloading huggingface_hub-0.29.1-py3-none-any.whl.metadata (13 kB)\n",
"Requirement already satisfied: requests>=2.32.3 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from smolagents) (2.32.3)\n",
"Collecting rich>=13.9.4 (from smolagents)\n",
" Using cached rich-13.9.4-py3-none-any.whl.metadata (18 kB)\n",
"Collecting pandas>=2.2.3 (from smolagents)\n",
" Downloading pandas-2.2.3-cp312-cp312-win_amd64.whl.metadata (19 kB)\n",
"Requirement already satisfied: jinja2>=3.1.4 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from smolagents) (3.1.4)\n",
"Collecting pillow>=11.0.0 (from smolagents)\n",
" Downloading pillow-11.1.0-cp312-cp312-win_amd64.whl.metadata (9.3 kB)\n",
"Collecting markdownify>=0.14.1 (from smolagents)\n",
" Downloading markdownify-0.14.1-py3-none-any.whl.metadata (8.5 kB)\n",
"Collecting duckduckgo-search>=6.3.7 (from smolagents)\n",
" Downloading duckduckgo_search-7.4.4-py3-none-any.whl.metadata (17 kB)\n",
"Requirement already satisfied: python-dotenv in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from smolagents) (1.0.1)\n",
"Collecting click>=8.1.8 (from duckduckgo-search>=6.3.7->smolagents)\n",
" Using cached click-8.1.8-py3-none-any.whl.metadata (2.3 kB)\n",
"Collecting httpx>=0.28.1 (from httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents)\n",
" Using cached httpx-0.28.1-py3-none-any.whl.metadata (7.1 kB)\n",
"Requirement already satisfied: lxml>=5.3.0 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from duckduckgo-search>=6.3.7->smolagents) (5.3.0)\n",
"Requirement already satisfied: filelock in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from huggingface-hub>=0.28.0->smolagents) (3.16.1)\n",
"Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from huggingface-hub>=0.28.0->smolagents) (2024.10.0)\n",
"Requirement already satisfied: packaging>=20.9 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from huggingface-hub>=0.28.0->smolagents) (24.1)\n",
"Requirement already satisfied: pyyaml>=5.1 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from huggingface-hub>=0.28.0->smolagents) (6.0.2)\n",
"Requirement already satisfied: tqdm>=4.42.1 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from huggingface-hub>=0.28.0->smolagents) (4.66.5)\n",
"Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from huggingface-hub>=0.28.0->smolagents) (4.12.2)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from jinja2>=3.1.4->smolagents) (3.0.2)\n",
"Requirement already satisfied: beautifulsoup4<5,>=4.9 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from markdownify>=0.14.1->smolagents) (4.12.3)\n",
"Requirement already satisfied: six<2,>=1.15 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from markdownify>=0.14.1->smolagents) (1.16.0)\n",
"Requirement already satisfied: numpy>=1.26.0 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from pandas>=2.2.3->smolagents) (1.26.4)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from pandas>=2.2.3->smolagents) (2.9.0.post0)\n",
"Requirement already satisfied: pytz>=2020.1 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from pandas>=2.2.3->smolagents) (2024.2)\n",
"Requirement already satisfied: tzdata>=2022.7 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from pandas>=2.2.3->smolagents) (2024.2)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from requests>=2.32.3->smolagents) (3.4.0)\n",
"Requirement already satisfied: idna<4,>=2.5 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from requests>=2.32.3->smolagents) (3.10)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from requests>=2.32.3->smolagents) (2.2.3)\n",
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from requests>=2.32.3->smolagents) (2024.8.30)\n",
"Requirement already satisfied: markdown-it-py>=2.2.0 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from rich>=13.9.4->smolagents) (3.0.0)\n",
"Requirement already satisfied: pygments<3.0.0,>=2.13.0 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from rich>=13.9.4->smolagents) (2.18.0)\n",
"Requirement already satisfied: soupsieve>1.2 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from beautifulsoup4<5,>=4.9->markdownify>=0.14.1->smolagents) (2.6)\n",
"Requirement already satisfied: colorama in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from click>=8.1.8->duckduckgo-search>=6.3.7->smolagents) (0.4.6)\n",
"Requirement already satisfied: anyio in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from httpx>=0.28.1->httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents) (4.6.2.post1)\n",
"Requirement already satisfied: httpcore==1.* in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from httpx>=0.28.1->httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents) (1.0.6)\n",
"Requirement already satisfied: h11<0.15,>=0.13 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from httpcore==1.*->httpx>=0.28.1->httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents) (0.14.0)\n",
"Collecting brotli (from httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents)\n",
" Downloading Brotli-1.1.0-cp312-cp312-win_amd64.whl.metadata (5.6 kB)\n",
"Requirement already satisfied: h2<5,>=3 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents) (4.1.0)\n",
"Collecting socksio==1.* (from httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents)\n",
" Downloading socksio-1.0.0-py3-none-any.whl.metadata (6.1 kB)\n",
"Requirement already satisfied: mdurl~=0.1 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from markdown-it-py>=2.2.0->rich>=13.9.4->smolagents) (0.1.2)\n",
"Requirement already satisfied: hyperframe<7,>=6.0 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from h2<5,>=3->httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents) (6.0.1)\n",
"Requirement already satisfied: hpack<5,>=4.0 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from h2<5,>=3->httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents) (4.0.0)\n",
"Requirement already satisfied: sniffio>=1.1 in c:\\users\\wingp\\appdata\\roaming\\python\\python312\\site-packages (from anyio->httpx>=0.28.1->httpx[brotli,http2,socks]>=0.28.1->duckduckgo-search>=6.3.7->smolagents) (1.3.1)\n",
"Downloading smolagents-1.9.2-py3-none-any.whl (101 kB)\n",
"Downloading duckduckgo_search-7.4.4-py3-none-any.whl (35 kB)\n",
"Downloading huggingface_hub-0.29.1-py3-none-any.whl (468 kB)\n",
"Downloading markdownify-0.14.1-py3-none-any.whl (11 kB)\n",
"Downloading pandas-2.2.3-cp312-cp312-win_amd64.whl (11.5 MB)\n",
" ---------------------------------------- 0.0/11.5 MB ? eta -:--:--\n",
" - -------------------------------------- 0.5/11.5 MB 2.8 MB/s eta 0:00:04\n",
" ---- ----------------------------------- 1.3/11.5 MB 3.0 MB/s eta 0:00:04\n",
" ------- -------------------------------- 2.1/11.5 MB 3.4 MB/s eta 0:00:03\n",
" ---------- ----------------------------- 2.9/11.5 MB 3.6 MB/s eta 0:00:03\n",
" ------------- -------------------------- 3.9/11.5 MB 3.9 MB/s eta 0:00:02\n",
" ---------------- ----------------------- 4.7/11.5 MB 3.8 MB/s eta 0:00:02\n",
" -------------------- ------------------- 5.8/11.5 MB 4.0 MB/s eta 0:00:02\n",
" ------------------------ --------------- 7.1/11.5 MB 4.3 MB/s eta 0:00:02\n",
" --------------------------- ------------ 7.9/11.5 MB 4.4 MB/s eta 0:00:01\n",
" -------------------------------- ------- 9.4/11.5 MB 4.5 MB/s eta 0:00:01\n",
" ------------------------------------ --- 10.5/11.5 MB 4.6 MB/s eta 0:00:01\n",
" --------------------------------------- 11.3/11.5 MB 4.6 MB/s eta 0:00:01\n",
" ---------------------------------------- 11.5/11.5 MB 4.6 MB/s eta 0:00:00\n",
"Downloading pillow-11.1.0-cp312-cp312-win_amd64.whl (2.6 MB)\n",
" ---------------------------------------- 0.0/2.6 MB ? eta -:--:--\n",
" --------------- ------------------------ 1.0/2.6 MB 5.0 MB/s eta 0:00:01\n",
" ----------------------------------- ---- 2.4/2.6 MB 5.8 MB/s eta 0:00:01\n",
" ---------------------------------------- 2.6/2.6 MB 5.0 MB/s eta 0:00:00\n",
"Using cached rich-13.9.4-py3-none-any.whl (242 kB)\n",
"Using cached click-8.1.8-py3-none-any.whl (98 kB)\n",
"Using cached httpx-0.28.1-py3-none-any.whl (73 kB)\n",
"Downloading socksio-1.0.0-py3-none-any.whl (12 kB)\n",
"Downloading Brotli-1.1.0-cp312-cp312-win_amd64.whl (357 kB)\n",
"Installing collected packages: brotli, socksio, pillow, click, rich, pandas, markdownify, huggingface-hub, httpx, duckduckgo-search, smolagents\n",
" Attempting uninstall: pillow\n",
" Found existing installation: pillow 10.4.0\n",
" Uninstalling pillow-10.4.0:\n",
" Successfully uninstalled pillow-10.4.0\n",
" Attempting uninstall: click\n",
" Found existing installation: click 8.1.7\n",
" Uninstalling click-8.1.7:\n",
" Successfully uninstalled click-8.1.7\n",
" Attempting uninstall: rich\n",
" Found existing installation: rich 13.9.3\n",
" Uninstalling rich-13.9.3:\n",
" Successfully uninstalled rich-13.9.3\n",
" Attempting uninstall: pandas\n",
" Found existing installation: pandas 2.2.2\n",
" Uninstalling pandas-2.2.2:\n",
" Successfully uninstalled pandas-2.2.2\n",
" Attempting uninstall: huggingface-hub\n",
" Found existing installation: huggingface-hub 0.26.1\n",
" Uninstalling huggingface-hub-0.26.1:\n",
" Successfully uninstalled huggingface-hub-0.26.1\n",
" Attempting uninstall: httpx\n",
" Found existing installation: httpx 0.27.0\n",
" Uninstalling httpx-0.27.0:\n",
" Successfully uninstalled httpx-0.27.0\n",
" Attempting uninstall: duckduckgo-search\n",
" Found existing installation: duckduckgo_search 6.3.2\n",
" Uninstalling duckduckgo_search-6.3.2:\n",
" Successfully uninstalled duckduckgo_search-6.3.2\n",
"Successfully installed brotli-1.1.0 click-8.1.8 duckduckgo-search-7.4.4 httpx-0.28.1 huggingface-hub-0.29.1 markdownify-0.14.1 pandas-2.2.3 pillow-11.1.0 rich-13.9.4 smolagents-1.9.2 socksio-1.0.0\n"
]
}
],
"source": [
"!pip install smolagents"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test installation by using ollama"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from typing import Optional\n",
"\n",
"from smolagents import HfApiModel, LiteLLMModel, TransformersModel, tool\n",
"from smolagents.agents import CodeAgent, ToolCallingAgent"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"model = LiteLLMModel(\n",
" model_id=\"ollama_chat/phi3.5\",\n",
" api_base=\"http://localhost:11434\", # replace with remote open-ai compatible server if necessary\n",
" #api_key=\"your-api-key\", # replace with API key if necessary\n",
" num_ctx=8192, # ollama default is 2048 which will often fail horribly. 8192 works for easy tasks, more is better. Check https://huggingface.co/spaces/NyxKrage/LLM-Model-VRAM-Calculator to calculate how much VRAM this will need for the selected model.\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"@tool\n",
"def get_weather(location: str, celsius: Optional[bool] = False) -> str:\n",
" \"\"\"\n",
" Get weather in the next days at given location.\n",
" Secretly this tool does not care about the location, it hates the weather everywhere.\n",
"\n",
" Args:\n",
" location: the location\n",
" celsius: the temperature\n",
" \"\"\"\n",
" return \"The weather is UNGODLY with torrential rains and temperatures below -10°C\""
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">╭──────────────────────────────────────────────────── </span><span style=\"color: #d4b702; text-decoration-color: #d4b702; font-weight: bold\">New run</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ────────────────────────────────────────────────────╮</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span> <span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span> <span style=\"font-weight: bold\">What's the weather like in Paris?</span> <span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span> <span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">╰─ LiteLLMModel - ollama_chat/phi3.5 ─────────────────────────────────────────────────────────────────────────────╯</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m╭─\u001b[0m\u001b[38;2;212;183;2m───────────────────────────────────────────────────\u001b[0m\u001b[38;2;212;183;2m \u001b[0m\u001b[1;38;2;212;183;2mNew run\u001b[0m\u001b[38;2;212;183;2m \u001b[0m\u001b[38;2;212;183;2m───────────────────────────────────────────────────\u001b[0m\u001b[38;2;212;183;2m─╮\u001b[0m\n",
"\u001b[38;2;212;183;2m│\u001b[0m \u001b[38;2;212;183;2m│\u001b[0m\n",
"\u001b[38;2;212;183;2m│\u001b[0m \u001b[1mWhat's the weather like in Paris?\u001b[0m \u001b[38;2;212;183;2m│\u001b[0m\n",
"\u001b[38;2;212;183;2m│\u001b[0m \u001b[38;2;212;183;2m│\u001b[0m\n",
"\u001b[38;2;212;183;2m╰─\u001b[0m\u001b[38;2;212;183;2m LiteLLMModel - ollama_chat/phi3.5 \u001b[0m\u001b[38;2;212;183;2m────────────────────────────────────────────────────────────────────────────\u001b[0m\u001b[38;2;212;183;2m─╯\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m1\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Error in generating tool call with model:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">'NoneType'</span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\"> object is not iterable</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mError in generating tool call with model:\u001b[0m\n",
"\u001b[1;31m'NoneType'\u001b[0m\u001b[1;31m object is not iterable\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 0: Duration 43.02 seconds| Input tokens: 1,339 | Output tokens: 28]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 0: Duration 43.02 seconds| Input tokens: 1,339 | Output tokens: 28]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m2\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Error in generating tool call with model:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">'NoneType'</span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\"> object is not iterable</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mError in generating tool call with model:\u001b[0m\n",
"\u001b[1;31m'NoneType'\u001b[0m\u001b[1;31m object is not iterable\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 1: Duration 5.91 seconds| Input tokens: 2,510 | Output tokens: 51]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 1: Duration 5.91 seconds| Input tokens: 2,510 | Output tokens: 51]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m3\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Error in generating tool call with model:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">'NoneType'</span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\"> object is not iterable</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mError in generating tool call with model:\u001b[0m\n",
"\u001b[1;31m'NoneType'\u001b[0m\u001b[1;31m object is not iterable\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 2: Duration 3.63 seconds| Input tokens: 3,953 | Output tokens: 79]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 2: Duration 3.63 seconds| Input tokens: 3,953 | Output tokens: 79]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m4\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Error in generating tool call with model:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">'NoneType'</span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\"> object is not iterable</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mError in generating tool call with model:\u001b[0m\n",
"\u001b[1;31m'NoneType'\u001b[0m\u001b[1;31m object is not iterable\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 3: Duration 5.53 seconds| Input tokens: 5,216 | Output tokens: 109]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 3: Duration 5.53 seconds| Input tokens: 5,216 | Output tokens: 109]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m5\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Error in generating tool call with model:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">'NoneType'</span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\"> object is not iterable</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mError in generating tool call with model:\u001b[0m\n",
"\u001b[1;31m'NoneType'\u001b[0m\u001b[1;31m object is not iterable\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 4: Duration 4.10 seconds| Input tokens: 6,763 | Output tokens: 143]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 4: Duration 4.10 seconds| Input tokens: 6,763 | Output tokens: 143]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m6\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Error in generating tool call with model:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">'NoneType'</span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\"> object is not iterable</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mError in generating tool call with model:\u001b[0m\n",
"\u001b[1;31m'NoneType'\u001b[0m\u001b[1;31m object is not iterable\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 5: Duration 6.11 seconds| Input tokens: 8,118 | Output tokens: 166]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 5: Duration 6.11 seconds| Input tokens: 8,118 | Output tokens: 166]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Reached max steps.</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mReached max steps.\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 6: Duration 6.11 seconds| Input tokens: 8,520 | Output tokens: 458]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 6: Duration 6.11 seconds| Input tokens: 8,520 | Output tokens: 458]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"ToolCallingAgent: I apologize for the confusion earlier due to technical issues with generating predictions directly from my side. However, I can certainly share some general information about it! Please note that real-time and accurate weather updates would require accessing a live data source or service:\n",
"\n",
"As of now, since we don't have an immediate internet connection at this platform for fetching the latest details, here is how you could find out the current conditions in Paris using online tools such as AccuWeather, The Weather Channel, or BBC weather. Here are some steps to follow based on your preferred method:\n",
"\n",
"1. Visit any of these websites and enter 'Paris' into their search fields. They should provide a reliable forecast for you therein.\n",
"2. You could also use voice-activated assistants like Siri, Google Assistant or Alexa by simply saying \"Hey Siri/Google Assistant, whats the weather in Paris today?\" \n",
"3. Alternatively, download and install an app from the App Store (iOS) or Play Store (Android), then search for 'Weather' to find local forecasts like DarkSky Weather or AccuWeather apps which would provide detailed information including temperature, humidity, wind conditions etc., specifics of Paris.\n",
"\n",
"Remember weather can change rapidly so its always good practice checking a few minutes before heading out!\n"
]
}
],
"source": [
"agent = ToolCallingAgent(tools=[get_weather], model=model)\n",
"\n",
"print(\"ToolCallingAgent:\", agent.run(\"What's the weather like in Paris?\"))"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">╭──────────────────────────────────────────────────── </span><span style=\"color: #d4b702; text-decoration-color: #d4b702; font-weight: bold\">New run</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ────────────────────────────────────────────────────╮</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span> <span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span> <span style=\"font-weight: bold\">What's the weather like in Paris?</span> <span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span> <span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">╰─ LiteLLMModel - ollama_chat/phi3.5 ─────────────────────────────────────────────────────────────────────────────╯</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m╭─\u001b[0m\u001b[38;2;212;183;2m───────────────────────────────────────────────────\u001b[0m\u001b[38;2;212;183;2m \u001b[0m\u001b[1;38;2;212;183;2mNew run\u001b[0m\u001b[38;2;212;183;2m \u001b[0m\u001b[38;2;212;183;2m───────────────────────────────────────────────────\u001b[0m\u001b[38;2;212;183;2m─╮\u001b[0m\n",
"\u001b[38;2;212;183;2m│\u001b[0m \u001b[38;2;212;183;2m│\u001b[0m\n",
"\u001b[38;2;212;183;2m│\u001b[0m \u001b[1mWhat's the weather like in Paris?\u001b[0m \u001b[38;2;212;183;2m│\u001b[0m\n",
"\u001b[38;2;212;183;2m│\u001b[0m \u001b[38;2;212;183;2m│\u001b[0m\n",
"\u001b[38;2;212;183;2m╰─\u001b[0m\u001b[38;2;212;183;2m LiteLLMModel - ollama_chat/phi3.5 \u001b[0m\u001b[38;2;212;183;2m────────────────────────────────────────────────────────────────────────────\u001b[0m\u001b[38;2;212;183;2m─╯\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m1\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"> ─ <span style=\"font-weight: bold\">Executing parsed code:</span> ──────────────────────────────────────────────────────────────────────────────────────── \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">weather_in_paris </span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\"> get_weather(location</span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">\"Paris\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">, celsius</span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #66d9ef; text-decoration-color: #66d9ef; background-color: #272822\">False</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">) </span><span style=\"color: #959077; text-decoration-color: #959077; background-color: #272822\"># Setting 'celsius' to False indicates we want</span> \n",
" <span style=\"color: #959077; text-decoration-color: #959077; background-color: #272822\">the temperature in degrees Fahrenheit.</span><span style=\"background-color: #272822\"> </span> \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">final_answer(</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">f\"The weather in Paris is currently {</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">weather_in_paris</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">}.\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">)</span><span style=\"background-color: #272822\"> </span> \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n",
"</pre>\n"
],
"text/plain": [
" ─ \u001b[1mExecuting parsed code:\u001b[0m ──────────────────────────────────────────────────────────────────────────────────────── \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mweather_in_paris\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mget_weather\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mlocation\u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mParis\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m,\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mcelsius\u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;102;217;239;48;2;39;40;34mFalse\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;149;144;119;48;2;39;40;34m# Setting 'celsius' to False indicates we want\u001b[0m \n",
" \u001b[38;2;149;144;119;48;2;39;40;34mthe temperature in degrees Fahrenheit.\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mfinal_answer\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mf\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mThe weather in Paris is currently \u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m{\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mweather_in_paris\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m}\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m.\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702; font-weight: bold\">Out - Final answer: The weather in Paris is currently The weather is UNGODLY with torrential rains and temperatures</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702; font-weight: bold\">below -10°C.</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;38;2;212;183;2mOut - Final answer: The weather in Paris is currently The weather is UNGODLY with torrential rains and temperatures\u001b[0m\n",
"\u001b[1;38;2;212;183;2mbelow -10°C.\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 0: Duration 83.01 seconds| Input tokens: 2,490 | Output tokens: 166]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 0: Duration 83.01 seconds| Input tokens: 2,490 | Output tokens: 166]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"CodeAgent: The weather in Paris is currently The weather is UNGODLY with torrential rains and temperatures below -10°C.\n"
]
}
],
"source": [
"agent = CodeAgent(tools=[get_weather], model=model)\n",
"\n",
"print(\"CodeAgent:\", agent.run(\"What's the weather like in Paris?\"))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test Installation by Hugging face API key"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel\n",
"from huggingface_hub import login"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"from dotenv import load_dotenv\n",
"import os\n",
"\n",
"# Load .env file\n",
"load_dotenv()\n",
"\n",
"api_key = os.environ.get('API_KEY')"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"login(api_key)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"model = HfApiModel()\n",
"agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">╭──────────────────────────────────────────────────── </span><span style=\"color: #d4b702; text-decoration-color: #d4b702; font-weight: bold\">New run</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ────────────────────────────────────────────────────╮</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span> <span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span> <span style=\"font-weight: bold\">How many seconds would it take for a leopard at full speed to run through Pont des Arts?</span> <span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span> <span style=\"color: #d4b702; text-decoration-color: #d4b702\">│</span>\n",
"<span style=\"color: #d4b702; text-decoration-color: #d4b702\">╰─ HfApiModel - Qwen/Qwen2.5-Coder-32B-Instruct ──────────────────────────────────────────────────────────────────╯</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m╭─\u001b[0m\u001b[38;2;212;183;2m───────────────────────────────────────────────────\u001b[0m\u001b[38;2;212;183;2m \u001b[0m\u001b[1;38;2;212;183;2mNew run\u001b[0m\u001b[38;2;212;183;2m \u001b[0m\u001b[38;2;212;183;2m───────────────────────────────────────────────────\u001b[0m\u001b[38;2;212;183;2m─╮\u001b[0m\n",
"\u001b[38;2;212;183;2m│\u001b[0m \u001b[38;2;212;183;2m│\u001b[0m\n",
"\u001b[38;2;212;183;2m│\u001b[0m \u001b[1mHow many seconds would it take for a leopard at full speed to run through Pont des Arts?\u001b[0m \u001b[38;2;212;183;2m│\u001b[0m\n",
"\u001b[38;2;212;183;2m│\u001b[0m \u001b[38;2;212;183;2m│\u001b[0m\n",
"\u001b[38;2;212;183;2m╰─\u001b[0m\u001b[38;2;212;183;2m HfApiModel - Qwen/Qwen2.5-Coder-32B-Instruct \u001b[0m\u001b[38;2;212;183;2m─────────────────────────────────────────────────────────────────\u001b[0m\u001b[38;2;212;183;2m─╯\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m1\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"> ─ <span style=\"font-weight: bold\">Executing parsed code:</span> ──────────────────────────────────────────────────────────────────────────────────────── \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">pont_des_arts_length </span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\"> web_search(query</span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">\"length of Pont des Arts\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">)</span><span style=\"background-color: #272822\"> </span> \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">print(pont_des_arts_length)</span><span style=\"background-color: #272822\"> </span> \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n",
"</pre>\n"
],
"text/plain": [
" ─ \u001b[1mExecuting parsed code:\u001b[0m ──────────────────────────────────────────────────────────────────────────────────────── \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mpont_des_arts_length\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mweb_search\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mquery\u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mlength of Pont des Arts\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mprint\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mpont_des_arts_length\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Execution logs:</span>\n",
"## Search Results\n",
"\n",
"[Pont des Arts - The Love Bridge](https://www.tourdefrance-bridges.com/post/pont-des-arts-the-love-bridge)\n",
"Context:The Pont des Arts, originally a cast iron arch bridge, known more often as the \"Love Bridge,\" crosses the \n",
"Seine river in Paris, connecting the Louvre to the Institut de Paris, formerly the Collèges des quatre Nations. ...\n",
"The original bridge had 9 arches, was 155m in length and 11m wide and was made using cast iron. The number of ...\n",
"\n",
"[17 Famous Bridges in France: Must-See Wonders! - Salut from \n",
"Paris](https://www.salutfromparis.com/famous-bridges-in-france/)\n",
"(built in 2004, 2460m length) Millau Viaduct in Aveyron - the world's tallest bridge. The Millau Viaduct is an \n",
"engineering gem, standing tall in the heart of the Tarn Valley, ... #10 Pont des Arts, Paris (initial construction \n",
"between 1801 and 1804, 155m length) Pont des Arts.\n",
"\n",
"[Love Lock bridge in Paris then &amp; now: The Pont des \n",
"Arts](https://cosmopoliclan.com/travel-with-kids/inspiration/love-lock-bridge-paris-pont-des-arts/)\n",
"The Pont des Arts or Passerelle des Arts is the pedestrian bridge over the Seine that connects the Louvre Museum on\n",
"the Right bank to the Institut de France on the Left Bank.As a result, it connects the 1st and the 6th Paris \n",
"arrondissements. It is flanked by the Pont du Carrousel downstream and by the Pont-Neuf and the Île de la Cité, \n",
"home to the Notre Dame cathedral, upstream.\n",
"\n",
"[Learn everything about the history of Pont des Arts in Paris](https://sainte-chapelle.co/pont-des-arts/)\n",
"Built-in 1801 and 1804, Pont Des Arts, previously known as Passerelle des Arts, was the first iron bridge in Paris.\n",
"Now a pedestrian bridge, it is used by locals and tourists to have a pleasant stroll with friends and family and \n",
"get stunning views of the River Seine.\n",
"\n",
"[A Comprehensive Guide to Visiting the Pont des Arts, Paris](https://audiala.com/en/france/paris/pont-des-arts)\n",
"What are the visiting hours for Pont des Arts? The Pont des Arts is open 24/7. Is there an entrance fee for Pont \n",
"des Arts? No, access to the Pont des Arts is free. How do I get to Pont des Arts? You can reach the Pont des Arts \n",
"via the Louvre-Rivoli (Line 1) and Pont Neuf (Line 7) metro stations. Are there guided tours available?\n",
"\n",
"[Pont des Arts in Paris - Misadventures with Andi](https://misadventureswithandi.com/pont-des-arts-in-paris/)\n",
"The new bridge would retain its name as Pont des Arts, but have 7 arches instead of the original 9, and would be \n",
"supported by steel instead of cast iron. The Love Lock Bridge. Paris, the city of love, has multiple romantic spots\n",
"scattered across its length and breadth, but perhaps the most romantic is the Pont des Arts. With its proximity to \n",
"...\n",
"\n",
"[Pont des Arts - The Parisian Guide](https://www.theparisianguide.com/s/pont-des-arts/)\n",
"The Pont des Arts, connecting the Louvre and the Institut de France, holds a prominent place not only in Parisian \n",
"architecture but also in the city's heart.\n",
"\n",
"[Weight of love: Pont des Arts, Paris' love lock bridge that \n",
"collapsed](https://timesofindia.indiatimes.com/travel/destinations/weight-of-love-pont-des-arts-paris-love-lock-bri\n",
"dge-that-collapsed/articleshow/103443865.cms)\n",
"The Pont des Arts, also lovingly called Love Lock Bridge, is a pedestrian bridge located in Paris, over the iconic \n",
"River Seine. The bridge connects the Institut de France with the central square ...\n",
"\n",
"[Pont des Arts - Wikipedie](https://cs.wikipedia.org/wiki/Pont_des_Arts)\n",
"Pont des Arts byl postaven v letech 1801-1804 pro chodce jako první železný most v Paříži. Původně měl deset \n",
"oblouků, ale v roce 1852 při rozšiřování nábřeží na levém břehu se ze dvou oblouků stal jeden. V roce 1975 byl most\n",
"zanesen mezi historické památky, ovšem již o rok později bylo konstatováno, že konstrukce mostu je velmi poškozená.\n",
"\n",
"[Pont des Arts, Paris | gotravelyourself.com](https://gotravelyourself.com/item/pont-des-arts/)\n",
"Located in the heart of Paris, the Pont des Arts is a picturesque pedestrian bridge that spans the Seine River. \n",
"This historic bridge, also known as the\n",
"\n",
"Out: None\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1mExecution logs:\u001b[0m\n",
"## Search Results\n",
"\n",
"[Pont des Arts - The Love Bridge](https://www.tourdefrance-bridges.com/post/pont-des-arts-the-love-bridge)\n",
"Context:The Pont des Arts, originally a cast iron arch bridge, known more often as the \"Love Bridge,\" crosses the \n",
"Seine river in Paris, connecting the Louvre to the Institut de Paris, formerly the Collèges des quatre Nations. ...\n",
"The original bridge had 9 arches, was 155m in length and 11m wide and was made using cast iron. The number of ...\n",
"\n",
"[17 Famous Bridges in France: Must-See Wonders! - Salut from \n",
"Paris](https://www.salutfromparis.com/famous-bridges-in-france/)\n",
"(built in 2004, 2460m length) Millau Viaduct in Aveyron - the world's tallest bridge. The Millau Viaduct is an \n",
"engineering gem, standing tall in the heart of the Tarn Valley, ... #10 Pont des Arts, Paris (initial construction \n",
"between 1801 and 1804, 155m length) Pont des Arts.\n",
"\n",
"[Love Lock bridge in Paris then & now: The Pont des \n",
"Arts](https://cosmopoliclan.com/travel-with-kids/inspiration/love-lock-bridge-paris-pont-des-arts/)\n",
"The Pont des Arts or Passerelle des Arts is the pedestrian bridge over the Seine that connects the Louvre Museum on\n",
"the Right bank to the Institut de France on the Left Bank.As a result, it connects the 1st and the 6th Paris \n",
"arrondissements. It is flanked by the Pont du Carrousel downstream and by the Pont-Neuf and the Île de la Cité, \n",
"home to the Notre Dame cathedral, upstream.\n",
"\n",
"[Learn everything about the history of Pont des Arts in Paris](https://sainte-chapelle.co/pont-des-arts/)\n",
"Built-in 1801 and 1804, Pont Des Arts, previously known as Passerelle des Arts, was the first iron bridge in Paris.\n",
"Now a pedestrian bridge, it is used by locals and tourists to have a pleasant stroll with friends and family and \n",
"get stunning views of the River Seine.\n",
"\n",
"[A Comprehensive Guide to Visiting the Pont des Arts, Paris](https://audiala.com/en/france/paris/pont-des-arts)\n",
"What are the visiting hours for Pont des Arts? The Pont des Arts is open 24/7. Is there an entrance fee for Pont \n",
"des Arts? No, access to the Pont des Arts is free. How do I get to Pont des Arts? You can reach the Pont des Arts \n",
"via the Louvre-Rivoli (Line 1) and Pont Neuf (Line 7) metro stations. Are there guided tours available?\n",
"\n",
"[Pont des Arts in Paris - Misadventures with Andi](https://misadventureswithandi.com/pont-des-arts-in-paris/)\n",
"The new bridge would retain its name as Pont des Arts, but have 7 arches instead of the original 9, and would be \n",
"supported by steel instead of cast iron. The Love Lock Bridge. Paris, the city of love, has multiple romantic spots\n",
"scattered across its length and breadth, but perhaps the most romantic is the Pont des Arts. With its proximity to \n",
"...\n",
"\n",
"[Pont des Arts - The Parisian Guide](https://www.theparisianguide.com/s/pont-des-arts/)\n",
"The Pont des Arts, connecting the Louvre and the Institut de France, holds a prominent place not only in Parisian \n",
"architecture but also in the city's heart.\n",
"\n",
"[Weight of love: Pont des Arts, Paris' love lock bridge that \n",
"collapsed](https://timesofindia.indiatimes.com/travel/destinations/weight-of-love-pont-des-arts-paris-love-lock-bri\n",
"dge-that-collapsed/articleshow/103443865.cms)\n",
"The Pont des Arts, also lovingly called Love Lock Bridge, is a pedestrian bridge located in Paris, over the iconic \n",
"River Seine. The bridge connects the Institut de France with the central square ...\n",
"\n",
"[Pont des Arts - Wikipedie](https://cs.wikipedia.org/wiki/Pont_des_Arts)\n",
"Pont des Arts byl postaven v letech 1801-1804 pro chodce jako první železný most v Paříži. Původně měl deset \n",
"oblouků, ale v roce 1852 při rozšiřování nábřeží na levém břehu se ze dvou oblouků stal jeden. V roce 1975 byl most\n",
"zanesen mezi historické památky, ovšem již o rok později bylo konstatováno, že konstrukce mostu je velmi poškozená.\n",
"\n",
"[Pont des Arts, Paris | gotravelyourself.com](https://gotravelyourself.com/item/pont-des-arts/)\n",
"Located in the heart of Paris, the Pont des Arts is a picturesque pedestrian bridge that spans the Seine River. \n",
"This historic bridge, also known as the\n",
"\n",
"Out: None\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 0: Duration 6.49 seconds| Input tokens: 2,089 | Output tokens: 74]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 0: Duration 6.49 seconds| Input tokens: 2,089 | Output tokens: 74]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m2\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Error in code parsing:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Your code snippet is invalid, because the regex pattern ```(?:py|python)?\\n(.*?)\\n``` was not found in it.</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Here is your code snippet:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Observation:</span>\n",
"\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Make sure to include code with the correct pattern, for instance:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Thoughts: Your thoughts</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Code:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">```py</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\"># Your python code here</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">```&lt;end_code&gt;</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Make sure to provide correct code blobs.</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mError in code parsing:\u001b[0m\n",
"\u001b[1;31mYour code snippet is invalid, because the regex pattern ```\u001b[0m\u001b[1;31m(\u001b[0m\u001b[1;31m?:py|python\u001b[0m\u001b[1;31m)\u001b[0m\u001b[1;31m?\\\u001b[0m\u001b[1;31mn\u001b[0m\u001b[1;31m(\u001b[0m\u001b[1;31m.*?\u001b[0m\u001b[1;31m)\u001b[0m\u001b[1;31m\\n``` was not found in it.\u001b[0m\n",
"\u001b[1;31mHere is your code snippet:\u001b[0m\n",
"\u001b[1;31mObservation:\u001b[0m\n",
"\n",
"\u001b[1;31mMake sure to include code with the correct pattern, for instance:\u001b[0m\n",
"\u001b[1;31mThoughts: Your thoughts\u001b[0m\n",
"\u001b[1;31mCode:\u001b[0m\n",
"\u001b[1;31m```py\u001b[0m\n",
"\u001b[1;31m# Your python code here\u001b[0m\n",
"\u001b[1;31m```\u001b[0m\u001b[1;31m<\u001b[0m\u001b[1;31mend_code\u001b[0m\u001b[1;31m>\u001b[0m\n",
"\u001b[1;31mMake sure to provide correct code blobs.\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 1: Duration 5.82 seconds| Input tokens: 5,459 | Output tokens: 77]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 1: Duration 5.82 seconds| Input tokens: 5,459 | Output tokens: 77]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m3\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"> ─ <span style=\"font-weight: bold\">Executing parsed code:</span> ──────────────────────────────────────────────────────────────────────────────────────── \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">pont_des_arts_length </span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\"> web_search(query</span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">\"length of Pont des Arts\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">)</span><span style=\"background-color: #272822\"> </span> \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">print(</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">\"Length of Pont des Arts:\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">, pont_des_arts_length)</span><span style=\"background-color: #272822\"> </span> \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n",
"</pre>\n"
],
"text/plain": [
" ─ \u001b[1mExecuting parsed code:\u001b[0m ──────────────────────────────────────────────────────────────────────────────────────── \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mpont_des_arts_length\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mweb_search\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mquery\u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mlength of Pont des Arts\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mprint\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mLength of Pont des Arts:\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m,\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mpont_des_arts_length\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Execution logs:</span>\n",
"Length of Pont des Arts: ## Search Results\n",
"\n",
"[Pont des Arts - Wikipedia](https://en.wikipedia.org/wiki/Pont_des_Arts)\n",
"The Pont des Arts (French pronunciation: [pɔ̃ dez‿aʁ]) or Passerelle des Arts ([pasʁɛl-]) is a pedestrian bridge in\n",
"Paris which crosses the River Seine. It links the Institut de France and the central square ( cour carrée ) of the \n",
"Palais du Louvre , (which had been termed the \"Palais des Arts\" under the First French Empire ).\n",
"\n",
"[10 Picturesque Facts About The Pont Des Arts](https://art-facts.com/pont-des-arts-facts/)\n",
"The Pont des Arts literally translates to ... Even though the bridge doesn't look that big at first sight, it still\n",
"has a length of 155 meters (509 feet) and a width of 11 meters (36 feet). The original bridge during the 1880s / \n",
"Wiki Commons 4. The bridge was completely rebuilt in the early 1980s.\n",
"\n",
"[8 Most Famous Bridges in Paris, by Appeal, Lenght &amp; Love Locks](https://culturefrancia.com/en/paris-best-bridges/)\n",
"Appeal ★★☆☆☆ Use 🚶🏻Pedestrian Size (length x widht) 270 x 20 m (885 x 65 ft). Arrondissements 6th &amp; 1st. French \n",
"Names Pont des Arts Passerelle des Arts. This pedestrian bridge that spans the River Seine, was the first metal \n",
"bridge in Paris and has become a symbol of romance and artistic expression.\n",
"\n",
"[Love Lock bridge in Paris then &amp; now: The Pont des \n",
"Arts](https://cosmopoliclan.com/travel-with-kids/inspiration/love-lock-bridge-paris-pont-des-arts/)\n",
"The Pont des Arts or Passerelle des Arts is the pedestrian bridge over the Seine that connects the Louvre Museum on\n",
"the Right bank to the Institut de France on the Left Bank.As a result, it connects the 1st and the 6th Paris \n",
"arrondissements. It is flanked by the Pont du Carrousel downstream and by the Pont-Neuf and the Île de la Cité, \n",
"home to the Notre Dame cathedral, upstream.\n",
"\n",
"[17 Famous Bridges in France: Must-See Wonders! - Salut from \n",
"Paris](https://www.salutfromparis.com/famous-bridges-in-france/)\n",
"(built in 2004, 2460m length) Millau Viaduct in Aveyron - the world's tallest bridge. The Millau Viaduct is an \n",
"engineering gem, standing tall in the heart of the Tarn Valley, ... #10 Pont des Arts, Paris (initial construction \n",
"between 1801 and 1804, 155m length) Pont des Arts.\n",
"\n",
"[Pont des Arts - All You Need to Know BEFORE You Go (2025) - \n",
"Tripadvisor](https://www.tripadvisor.com/Attraction_Review-g187147-d2072995-Reviews-Pont_des_Arts-Paris_Ile_de_Fran\n",
"ce.html)\n",
"Too bad about that symbolism. Otherwise, the Pont des Arts, inaugurated in 1804, is a 100% pedestrian bridge that \n",
"connects the Institut de France to the Louvre, offering a splendid view of the Seine. ... Reviews ordered by \n",
"recency and descriptiveness of user-identified themes such as wait time, length of visit, general tips, and \n",
"location ...\n",
"\n",
"[The Unique Architecture of the Pont des Arts in \n",
"Paris](https://www.parisartstravel.com/the-unique-architecture-of-the-pont-des-arts-in-paris/)\n",
"The bridge is composed of nine arches and spans approximately 155 meters in length. Its iron structure, adorned \n",
"with numerous decorative details, gives it an elegant and romantic appearance. ... The Pont des Arts was first \n",
"opened in 1804; however, the current bridge that we see today is a reconstruction dating back to 1984. During the \n",
"1980s ...\n",
"\n",
"[Pont des Arts - The Love Bridge](https://www.tourdefrance-bridges.com/post/pont-des-arts-the-love-bridge)\n",
"Context:The Pont des Arts, originally a cast iron arch bridge, known more often as the \"Love Bridge,\" crosses the \n",
"Seine river in Paris, connecting the Louvre to the Institut de Paris, formerly the Collèges des quatre Nations. ...\n",
"The original bridge had 9 arches, was 155m in length and 11m wide and was made using cast iron. The number of ...\n",
"\n",
"[Learn everything about the history of Pont des Arts in Paris](https://sainte-chapelle.co/pont-des-arts/)\n",
"Built-in 1801 and 1804, Pont Des Arts, previously known as Passerelle des Arts, was the first iron bridge in Paris.\n",
"Now a pedestrian bridge, it is used by locals and tourists to have a pleasant stroll with friends and family and \n",
"get stunning views of the River Seine.\n",
"\n",
"[Pont des Arts in Paris - Misadventures with Andi](https://misadventureswithandi.com/pont-des-arts-in-paris/)\n",
"The new bridge would retain its name as Pont des Arts, but have 7 arches instead of the original 9, and would be \n",
"supported by steel instead of cast iron. The Love Lock Bridge. Paris, the city of love, has multiple romantic spots\n",
"scattered across its length and breadth, but perhaps the most romantic is the Pont des Arts. With its proximity to \n",
"...\n",
"\n",
"Out: None\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1mExecution logs:\u001b[0m\n",
"Length of Pont des Arts: ## Search Results\n",
"\n",
"[Pont des Arts - Wikipedia](https://en.wikipedia.org/wiki/Pont_des_Arts)\n",
"The Pont des Arts (French pronunciation: [pɔ̃ dez‿aʁ]) or Passerelle des Arts ([pasʁɛl-]) is a pedestrian bridge in\n",
"Paris which crosses the River Seine. It links the Institut de France and the central square ( cour carrée ) of the \n",
"Palais du Louvre , (which had been termed the \"Palais des Arts\" under the First French Empire ).\n",
"\n",
"[10 Picturesque Facts About The Pont Des Arts](https://art-facts.com/pont-des-arts-facts/)\n",
"The Pont des Arts literally translates to ... Even though the bridge doesn't look that big at first sight, it still\n",
"has a length of 155 meters (509 feet) and a width of 11 meters (36 feet). The original bridge during the 1880s / \n",
"Wiki Commons 4. The bridge was completely rebuilt in the early 1980s.\n",
"\n",
"[8 Most Famous Bridges in Paris, by Appeal, Lenght & Love Locks](https://culturefrancia.com/en/paris-best-bridges/)\n",
"Appeal ★★☆☆☆ Use 🚶🏻Pedestrian Size (length x widht) 270 x 20 m (885 x 65 ft). Arrondissements 6th & 1st. French \n",
"Names Pont des Arts Passerelle des Arts. This pedestrian bridge that spans the River Seine, was the first metal \n",
"bridge in Paris and has become a symbol of romance and artistic expression.\n",
"\n",
"[Love Lock bridge in Paris then & now: The Pont des \n",
"Arts](https://cosmopoliclan.com/travel-with-kids/inspiration/love-lock-bridge-paris-pont-des-arts/)\n",
"The Pont des Arts or Passerelle des Arts is the pedestrian bridge over the Seine that connects the Louvre Museum on\n",
"the Right bank to the Institut de France on the Left Bank.As a result, it connects the 1st and the 6th Paris \n",
"arrondissements. It is flanked by the Pont du Carrousel downstream and by the Pont-Neuf and the Île de la Cité, \n",
"home to the Notre Dame cathedral, upstream.\n",
"\n",
"[17 Famous Bridges in France: Must-See Wonders! - Salut from \n",
"Paris](https://www.salutfromparis.com/famous-bridges-in-france/)\n",
"(built in 2004, 2460m length) Millau Viaduct in Aveyron - the world's tallest bridge. The Millau Viaduct is an \n",
"engineering gem, standing tall in the heart of the Tarn Valley, ... #10 Pont des Arts, Paris (initial construction \n",
"between 1801 and 1804, 155m length) Pont des Arts.\n",
"\n",
"[Pont des Arts - All You Need to Know BEFORE You Go (2025) - \n",
"Tripadvisor](https://www.tripadvisor.com/Attraction_Review-g187147-d2072995-Reviews-Pont_des_Arts-Paris_Ile_de_Fran\n",
"ce.html)\n",
"Too bad about that symbolism. Otherwise, the Pont des Arts, inaugurated in 1804, is a 100% pedestrian bridge that \n",
"connects the Institut de France to the Louvre, offering a splendid view of the Seine. ... Reviews ordered by \n",
"recency and descriptiveness of user-identified themes such as wait time, length of visit, general tips, and \n",
"location ...\n",
"\n",
"[The Unique Architecture of the Pont des Arts in \n",
"Paris](https://www.parisartstravel.com/the-unique-architecture-of-the-pont-des-arts-in-paris/)\n",
"The bridge is composed of nine arches and spans approximately 155 meters in length. Its iron structure, adorned \n",
"with numerous decorative details, gives it an elegant and romantic appearance. ... The Pont des Arts was first \n",
"opened in 1804; however, the current bridge that we see today is a reconstruction dating back to 1984. During the \n",
"1980s ...\n",
"\n",
"[Pont des Arts - The Love Bridge](https://www.tourdefrance-bridges.com/post/pont-des-arts-the-love-bridge)\n",
"Context:The Pont des Arts, originally a cast iron arch bridge, known more often as the \"Love Bridge,\" crosses the \n",
"Seine river in Paris, connecting the Louvre to the Institut de Paris, formerly the Collèges des quatre Nations. ...\n",
"The original bridge had 9 arches, was 155m in length and 11m wide and was made using cast iron. The number of ...\n",
"\n",
"[Learn everything about the history of Pont des Arts in Paris](https://sainte-chapelle.co/pont-des-arts/)\n",
"Built-in 1801 and 1804, Pont Des Arts, previously known as Passerelle des Arts, was the first iron bridge in Paris.\n",
"Now a pedestrian bridge, it is used by locals and tourists to have a pleasant stroll with friends and family and \n",
"get stunning views of the River Seine.\n",
"\n",
"[Pont des Arts in Paris - Misadventures with Andi](https://misadventureswithandi.com/pont-des-arts-in-paris/)\n",
"The new bridge would retain its name as Pont des Arts, but have 7 arches instead of the original 9, and would be \n",
"supported by steel instead of cast iron. The Love Lock Bridge. Paris, the city of love, has multiple romantic spots\n",
"scattered across its length and breadth, but perhaps the most romantic is the Pont des Arts. With its proximity to \n",
"...\n",
"\n",
"Out: None\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 2: Duration 21.70 seconds| Input tokens: 8,957 | Output tokens: 159]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 2: Duration 21.70 seconds| Input tokens: 8,957 | Output tokens: 159]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m4\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"> ─ <span style=\"font-weight: bold\">Executing parsed code:</span> ──────────────────────────────────────────────────────────────────────────────────────── \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">leopard_speed </span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\"> web_search(query</span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">\"top running speed of leopard\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">)</span><span style=\"background-color: #272822\"> </span> \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">print(</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">\"Top running speed of leopard:\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">, leopard_speed)</span><span style=\"background-color: #272822\"> </span> \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n",
"</pre>\n"
],
"text/plain": [
" ─ \u001b[1mExecuting parsed code:\u001b[0m ──────────────────────────────────────────────────────────────────────────────────────── \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mleopard_speed\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mweb_search\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mquery\u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mtop running speed of leopard\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mprint\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mTop running speed of leopard:\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m,\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mleopard_speed\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Execution logs:</span>\n",
"Top running speed of leopard: ## Search Results\n",
"\n",
"[How Fast Are Leopards? Top Speeds and How It Compares ... - AZ \n",
"Animals](https://a-z-animals.com/blog/how-fast-leopards-top-speeds-how-compares-other-big-cats/)\n",
"However, humans have much more endurance when it comes to running, though not at the speeds Usain Bolt reaches. \n",
"When comparing how long a human can run versus how long a cat can run, the human wins. Some factors that give \n",
"humans an advantage in endurance include bipedalism, tons of sweat glands, and the ability to conserve energy while\n",
"running ...\n",
"\n",
"[How Fast Can a Leopard Run? It's Slower than Most of Its Prey](https://africafreak.com/how-fast-can-a-leopard-run)\n",
"African leopards have a top speed of 56-60 km/h (35-37 mph). That's significantly slower than cheetahs and lions, \n",
"as well as being slower than a lot of its prey. But this top speed isn't the full story. The leopard is one of the \n",
"greatest predators on the African savannah and speed is just one piece of its hunting prowess.\n",
"\n",
"[Unraveling the Speed of Leopards: How Fast Can They Actually \n",
"Run?](https://startingrun.com/unraveling-the-speed-of-leopards-how-fast-can-they-actually-run/)\n",
"Environmental and situational factors, including terrain, prey's size and speed, climatic conditions, fatigue, age,\n",
"and health, significantly influence the leopard's speed. Compared to other big cats such as lions, cheetahs, \n",
"jaguars, and tigers, leopards hold a respectable position with a top speed of 58 km/h (36 mph), showcasing a ...\n",
"\n",
"[How Fast Can a Leopard Run? A Fascinating Look at Their \n",
"Speed](https://tiger-universe.com/blogs/tiger-blog/how-fast-can-a-leopard-run)\n",
"Understanding Leopard's Top Speed. Leopards are incredibly agile and strong, reaching speeds up to 36 mph. Their \n",
"speed is vital for hunting alone, unlike other predators that hunt in groups. Leopard run speed records reveal \n",
"their incredible burst of speed, essential for sneaking up on their prey.\n",
"\n",
"[How Fast Are Snow Leopards? See Their Top Speeds Compared ... - AZ \n",
"Animals](https://a-z-animals.com/articles/how-fast-are-snow-leopards-see-their-top-speeds-compared-to-other-fast-ca\n",
"ts/)\n",
"The snow leopard, Panthera uncia, can run up to 35 to 40 miles per hour over short distances.This big cat has \n",
"adaptations that help it to hunt and thrive in steep and rocky terrain. Snow leopards, according to the IUCN Red \n",
"List, are a vulnerable species with only a few thousand mature individuals.They live primarily in the mountainous \n",
"regions of central Asia.\n",
"\n",
"[Leopard Top Speed: How Fast Can They Run](https://womeninbusiness.byu.edu/leopard-top-speed_22663.html)\n",
"Several factors can influence a leopard's running speed, including: Terrain: Leopards can run faster on flat, open \n",
"terrain, but their speed may be reduced on rocky, mountainous, or dense forest terrain.; Subspecies: Different \n",
"subspecies of leopards may have varying levels of speed, depending on their adaptations to their environment.; Prey\n",
"type: Leopards may adjust their running speed ...\n",
"\n",
"[Leopard Top Speed: How Fast Can They Really Run](https://upload.independent.com/leopard-top-speed_28150.html)\n",
"Leopard Top Speed: The Facts. According to various studies, a leopard's top speed can reach up to 45 miles per hour\n",
"(72 kilometers per hour). However, this speed is only achieved over short distances, typically when chasing prey or\n",
"escaping danger. Over longer distances, a leopard's speed is more likely to average around 30 miles per hour (48 \n",
"...\n",
"\n",
"[How fast can leopards run and how agile are they? - \n",
"WildLifeFAQs](https://www.wildlifefaq.com/leopard-speed-and-agility/)\n",
"In this section, we will explore the leopard's running speed, top speed, and overall agility. Get ready to be \n",
"amazed by these agile big cats! Leopards are known for their remarkable speed and agility. They can reach speeds of\n",
"up to 58 kilometers per hour (36 mph) during short bursts of running. Their long, muscular legs allow them to cover\n",
"...\n",
"\n",
"[Leopard's Peak Speed: Unleashing Their Running \n",
"Power](https://startingrun.com/unleashing-the-speed-how-fast-can-a-leopard-run/)\n",
"Heavy vegetation or rugged terrain can limit a leopard's speed as it demands more careful maneuvering. On the flip \n",
"side, open grasslands tend to be the best running grounds for these feline speedsters. Lastly, prey availability \n",
"and behavior create a complex dynamic that influences a leopard's speed. The need to chase, capture, and retain ...\n",
"\n",
"[What is leopard top speed? - \n",
"reptileknowledge.com](https://www.reptileknowledge.com/reptile-pedia/what-is-leopard-top-speed)\n",
"The runner-up in our big cat race would be the jaguar at a top speed of 50 mph (80 km/h). The bronze medal would be\n",
"for the leopard, which prefers to lounge in trees, and has a top running speed of 'only' 36 mph (58 km/h).\n",
"\n",
"Out: None\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1mExecution logs:\u001b[0m\n",
"Top running speed of leopard: ## Search Results\n",
"\n",
"[How Fast Are Leopards? Top Speeds and How It Compares ... - AZ \n",
"Animals](https://a-z-animals.com/blog/how-fast-leopards-top-speeds-how-compares-other-big-cats/)\n",
"However, humans have much more endurance when it comes to running, though not at the speeds Usain Bolt reaches. \n",
"When comparing how long a human can run versus how long a cat can run, the human wins. Some factors that give \n",
"humans an advantage in endurance include bipedalism, tons of sweat glands, and the ability to conserve energy while\n",
"running ...\n",
"\n",
"[How Fast Can a Leopard Run? It's Slower than Most of Its Prey](https://africafreak.com/how-fast-can-a-leopard-run)\n",
"African leopards have a top speed of 56-60 km/h (35-37 mph). That's significantly slower than cheetahs and lions, \n",
"as well as being slower than a lot of its prey. But this top speed isn't the full story. The leopard is one of the \n",
"greatest predators on the African savannah and speed is just one piece of its hunting prowess.\n",
"\n",
"[Unraveling the Speed of Leopards: How Fast Can They Actually \n",
"Run?](https://startingrun.com/unraveling-the-speed-of-leopards-how-fast-can-they-actually-run/)\n",
"Environmental and situational factors, including terrain, prey's size and speed, climatic conditions, fatigue, age,\n",
"and health, significantly influence the leopard's speed. Compared to other big cats such as lions, cheetahs, \n",
"jaguars, and tigers, leopards hold a respectable position with a top speed of 58 km/h (36 mph), showcasing a ...\n",
"\n",
"[How Fast Can a Leopard Run? A Fascinating Look at Their \n",
"Speed](https://tiger-universe.com/blogs/tiger-blog/how-fast-can-a-leopard-run)\n",
"Understanding Leopard's Top Speed. Leopards are incredibly agile and strong, reaching speeds up to 36 mph. Their \n",
"speed is vital for hunting alone, unlike other predators that hunt in groups. Leopard run speed records reveal \n",
"their incredible burst of speed, essential for sneaking up on their prey.\n",
"\n",
"[How Fast Are Snow Leopards? See Their Top Speeds Compared ... - AZ \n",
"Animals](https://a-z-animals.com/articles/how-fast-are-snow-leopards-see-their-top-speeds-compared-to-other-fast-ca\n",
"ts/)\n",
"The snow leopard, Panthera uncia, can run up to 35 to 40 miles per hour over short distances.This big cat has \n",
"adaptations that help it to hunt and thrive in steep and rocky terrain. Snow leopards, according to the IUCN Red \n",
"List, are a vulnerable species with only a few thousand mature individuals.They live primarily in the mountainous \n",
"regions of central Asia.\n",
"\n",
"[Leopard Top Speed: How Fast Can They Run](https://womeninbusiness.byu.edu/leopard-top-speed_22663.html)\n",
"Several factors can influence a leopard's running speed, including: Terrain: Leopards can run faster on flat, open \n",
"terrain, but their speed may be reduced on rocky, mountainous, or dense forest terrain.; Subspecies: Different \n",
"subspecies of leopards may have varying levels of speed, depending on their adaptations to their environment.; Prey\n",
"type: Leopards may adjust their running speed ...\n",
"\n",
"[Leopard Top Speed: How Fast Can They Really Run](https://upload.independent.com/leopard-top-speed_28150.html)\n",
"Leopard Top Speed: The Facts. According to various studies, a leopard's top speed can reach up to 45 miles per hour\n",
"(72 kilometers per hour). However, this speed is only achieved over short distances, typically when chasing prey or\n",
"escaping danger. Over longer distances, a leopard's speed is more likely to average around 30 miles per hour (48 \n",
"...\n",
"\n",
"[How fast can leopards run and how agile are they? - \n",
"WildLifeFAQs](https://www.wildlifefaq.com/leopard-speed-and-agility/)\n",
"In this section, we will explore the leopard's running speed, top speed, and overall agility. Get ready to be \n",
"amazed by these agile big cats! Leopards are known for their remarkable speed and agility. They can reach speeds of\n",
"up to 58 kilometers per hour (36 mph) during short bursts of running. Their long, muscular legs allow them to cover\n",
"...\n",
"\n",
"[Leopard's Peak Speed: Unleashing Their Running \n",
"Power](https://startingrun.com/unleashing-the-speed-how-fast-can-a-leopard-run/)\n",
"Heavy vegetation or rugged terrain can limit a leopard's speed as it demands more careful maneuvering. On the flip \n",
"side, open grasslands tend to be the best running grounds for these feline speedsters. Lastly, prey availability \n",
"and behavior create a complex dynamic that influences a leopard's speed. The need to chase, capture, and retain ...\n",
"\n",
"[What is leopard top speed? - \n",
"reptileknowledge.com](https://www.reptileknowledge.com/reptile-pedia/what-is-leopard-top-speed)\n",
"The runner-up in our big cat race would be the jaguar at a top speed of 50 mph (80 km/h). The bronze medal would be\n",
"for the leopard, which prefers to lounge in trees, and has a top running speed of 'only' 36 mph (58 km/h).\n",
"\n",
"Out: None\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 3: Duration 12.82 seconds| Input tokens: 13,838 | Output tokens: 232]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 3: Duration 12.82 seconds| Input tokens: 13,838 | Output tokens: 232]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m5\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Error in code parsing:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Your code snippet is invalid, because the regex pattern ```(?:py|python)?\\n(.*?)\\n``` was not found in it.</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Here is your code snippet:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Observation:</span>\n",
"\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Make sure to include code with the correct pattern, for instance:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Thoughts: Your thoughts</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Code:</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">```py</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\"># Your python code here</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">```&lt;end_code&gt;</span>\n",
"<span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Make sure to provide correct code blobs.</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mError in code parsing:\u001b[0m\n",
"\u001b[1;31mYour code snippet is invalid, because the regex pattern ```\u001b[0m\u001b[1;31m(\u001b[0m\u001b[1;31m?:py|python\u001b[0m\u001b[1;31m)\u001b[0m\u001b[1;31m?\\\u001b[0m\u001b[1;31mn\u001b[0m\u001b[1;31m(\u001b[0m\u001b[1;31m.*?\u001b[0m\u001b[1;31m)\u001b[0m\u001b[1;31m\\n``` was not found in it.\u001b[0m\n",
"\u001b[1;31mHere is your code snippet:\u001b[0m\n",
"\u001b[1;31mObservation:\u001b[0m\n",
"\n",
"\u001b[1;31mMake sure to include code with the correct pattern, for instance:\u001b[0m\n",
"\u001b[1;31mThoughts: Your thoughts\u001b[0m\n",
"\u001b[1;31mCode:\u001b[0m\n",
"\u001b[1;31m```py\u001b[0m\n",
"\u001b[1;31m# Your python code here\u001b[0m\n",
"\u001b[1;31m```\u001b[0m\u001b[1;31m<\u001b[0m\u001b[1;31mend_code\u001b[0m\u001b[1;31m>\u001b[0m\n",
"\u001b[1;31mMake sure to provide correct code blobs.\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 4: Duration 10.19 seconds| Input tokens: 20,019 | Output tokens: 235]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 4: Duration 10.19 seconds| Input tokens: 20,019 | Output tokens: 235]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d4b702; text-decoration-color: #d4b702\">━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ </span><span style=\"font-weight: bold\">Step </span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span><span style=\"color: #d4b702; text-decoration-color: #d4b702\"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[38;2;212;183;2m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \u001b[0m\u001b[1mStep \u001b[0m\u001b[1;36m6\u001b[0m\u001b[38;2;212;183;2m ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"> ─ <span style=\"font-weight: bold\">Executing parsed code:</span> ──────────────────────────────────────────────────────────────────────────────────────── \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">leopard_speed </span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\"> web_search(query</span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\">=</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">\"top running speed of leopard\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">)</span><span style=\"background-color: #272822\"> </span> \n",
" <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">print(</span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #272822\">\"Top running speed of leopard:\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\">, leopard_speed)</span><span style=\"background-color: #272822\"> </span> \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n",
"</pre>\n"
],
"text/plain": [
" ─ \u001b[1mExecuting parsed code:\u001b[0m ──────────────────────────────────────────────────────────────────────────────────────── \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mleopard_speed\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mweb_search\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mquery\u001b[0m\u001b[38;2;255;70;137;48;2;39;40;34m=\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mtop running speed of leopard\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" \u001b[38;2;248;248;242;48;2;39;40;34mprint\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m(\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34mTop running speed of leopard:\u001b[0m\u001b[38;2;230;219;116;48;2;39;40;34m\"\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m,\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m \u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34mleopard_speed\u001b[0m\u001b[38;2;248;248;242;48;2;39;40;34m)\u001b[0m\u001b[48;2;39;40;34m \u001b[0m \n",
" ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Execution logs:</span>\n",
"Top running speed of leopard: ## Search Results\n",
"\n",
"[How Fast Are Leopards? Top Speeds and How It Compares ... - AZ \n",
"Animals](https://a-z-animals.com/blog/how-fast-leopards-top-speeds-how-compares-other-big-cats/)\n",
"However, humans have much more endurance when it comes to running, though not at the speeds Usain Bolt reaches. \n",
"When comparing how long a human can run versus how long a cat can run, the human wins. Some factors that give \n",
"humans an advantage in endurance include bipedalism, tons of sweat glands, and the ability to conserve energy while\n",
"running ...\n",
"\n",
"[How Fast Can a Leopard Run? It's Slower than Most of Its Prey](https://africafreak.com/how-fast-can-a-leopard-run)\n",
"African leopards have a top speed of 56-60 km/h (35-37 mph). That's significantly slower than cheetahs and lions, \n",
"as well as being slower than a lot of its prey. But this top speed isn't the full story. The leopard is one of the \n",
"greatest predators on the African savannah and speed is just one piece of its hunting prowess.\n",
"\n",
"[Unraveling the Speed of Leopards: How Fast Can They Actually \n",
"Run?](https://startingrun.com/unraveling-the-speed-of-leopards-how-fast-can-they-actually-run/)\n",
"Environmental and situational factors, including terrain, prey's size and speed, climatic conditions, fatigue, age,\n",
"and health, significantly influence the leopard's speed. Compared to other big cats such as lions, cheetahs, \n",
"jaguars, and tigers, leopards hold a respectable position with a top speed of 58 km/h (36 mph), showcasing a ...\n",
"\n",
"[How fast can leopards run and how agile are they? - \n",
"WildLifeFAQs](https://www.wildlifefaq.com/leopard-speed-and-agility/)\n",
"In this section, we will explore the leopard's running speed, top speed, and overall agility. Get ready to be \n",
"amazed by these agile big cats! Leopards are known for their remarkable speed and agility. They can reach speeds of\n",
"up to 58 kilometers per hour (36 mph) during short bursts of running. Their long, muscular legs allow them to cover\n",
"...\n",
"\n",
"[How Fast Are Snow Leopards? See Their Top Speeds Compared ... - AZ \n",
"Animals](https://a-z-animals.com/articles/how-fast-are-snow-leopards-see-their-top-speeds-compared-to-other-fast-ca\n",
"ts/)\n",
"The snow leopard, Panthera uncia, can run up to 35 to 40 miles per hour over short distances.This big cat has \n",
"adaptations that help it to hunt and thrive in steep and rocky terrain. Snow leopards, according to the IUCN Red \n",
"List, are a vulnerable species with only a few thousand mature individuals.They live primarily in the mountainous \n",
"regions of central Asia.\n",
"\n",
"[How Fast Can a Leopard Run? A Fascinating Look at Their \n",
"Speed](https://tiger-universe.com/blogs/tiger-blog/how-fast-can-a-leopard-run)\n",
"Understanding Leopard's Top Speed. Leopards are incredibly agile and strong, reaching speeds up to 36 mph. Their \n",
"speed is vital for hunting alone, unlike other predators that hunt in groups. Leopard run speed records reveal \n",
"their incredible burst of speed, essential for sneaking up on their prey.\n",
"\n",
"[How Fast Can a Leopard Run? - YouTube](https://www.youtube.com/watch?v=CdK97tz4APQ)\n",
"Discover the incredible running speed of leopards and how they excel in the wild! In this video, we dive into \n",
"leopard running speed, exploring their top spri...\n",
"\n",
"[Leopard Top Speed: How Fast Can They Run](https://womeninbusiness.byu.edu/leopard-top-speed_22663.html)\n",
"Several factors can influence a leopard's running speed, including: Terrain: Leopards can run faster on flat, open \n",
"terrain, but their speed may be reduced on rocky, mountainous, or dense forest terrain.; Subspecies: Different \n",
"subspecies of leopards may have varying levels of speed, depending on their adaptations to their environment.; Prey\n",
"type: Leopards may adjust their running speed ...\n",
"\n",
"[How Fast Can a Leopard Run (Average Speed) - \n",
"brotherspets.com](https://brotherspets.com/how-fast-can-a-leopard-run/)\n",
"Leopards are known for their speed and agility, and they are capable of reaching impressive top speeds when they \n",
"need to. According to various sources, leopards can run at speeds ranging from 30-56 mph (48-90 km/h) with an \n",
"average speed of 58 km/h.\n",
"\n",
"[Leopard's Peak Speed: Unleashing Their Running \n",
"Power](https://startingrun.com/unleashing-the-speed-how-fast-can-a-leopard-run/)\n",
"Heavy vegetation or rugged terrain can limit a leopard's speed as it demands more careful maneuvering. On the flip \n",
"side, open grasslands tend to be the best running grounds for these feline speedsters. Lastly, prey availability \n",
"and behavior create a complex dynamic that influences a leopard's speed. The need to chase, capture, and retain ...\n",
"\n",
"Out: None\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1mExecution logs:\u001b[0m\n",
"Top running speed of leopard: ## Search Results\n",
"\n",
"[How Fast Are Leopards? Top Speeds and How It Compares ... - AZ \n",
"Animals](https://a-z-animals.com/blog/how-fast-leopards-top-speeds-how-compares-other-big-cats/)\n",
"However, humans have much more endurance when it comes to running, though not at the speeds Usain Bolt reaches. \n",
"When comparing how long a human can run versus how long a cat can run, the human wins. Some factors that give \n",
"humans an advantage in endurance include bipedalism, tons of sweat glands, and the ability to conserve energy while\n",
"running ...\n",
"\n",
"[How Fast Can a Leopard Run? It's Slower than Most of Its Prey](https://africafreak.com/how-fast-can-a-leopard-run)\n",
"African leopards have a top speed of 56-60 km/h (35-37 mph). That's significantly slower than cheetahs and lions, \n",
"as well as being slower than a lot of its prey. But this top speed isn't the full story. The leopard is one of the \n",
"greatest predators on the African savannah and speed is just one piece of its hunting prowess.\n",
"\n",
"[Unraveling the Speed of Leopards: How Fast Can They Actually \n",
"Run?](https://startingrun.com/unraveling-the-speed-of-leopards-how-fast-can-they-actually-run/)\n",
"Environmental and situational factors, including terrain, prey's size and speed, climatic conditions, fatigue, age,\n",
"and health, significantly influence the leopard's speed. Compared to other big cats such as lions, cheetahs, \n",
"jaguars, and tigers, leopards hold a respectable position with a top speed of 58 km/h (36 mph), showcasing a ...\n",
"\n",
"[How fast can leopards run and how agile are they? - \n",
"WildLifeFAQs](https://www.wildlifefaq.com/leopard-speed-and-agility/)\n",
"In this section, we will explore the leopard's running speed, top speed, and overall agility. Get ready to be \n",
"amazed by these agile big cats! Leopards are known for their remarkable speed and agility. They can reach speeds of\n",
"up to 58 kilometers per hour (36 mph) during short bursts of running. Their long, muscular legs allow them to cover\n",
"...\n",
"\n",
"[How Fast Are Snow Leopards? See Their Top Speeds Compared ... - AZ \n",
"Animals](https://a-z-animals.com/articles/how-fast-are-snow-leopards-see-their-top-speeds-compared-to-other-fast-ca\n",
"ts/)\n",
"The snow leopard, Panthera uncia, can run up to 35 to 40 miles per hour over short distances.This big cat has \n",
"adaptations that help it to hunt and thrive in steep and rocky terrain. Snow leopards, according to the IUCN Red \n",
"List, are a vulnerable species with only a few thousand mature individuals.They live primarily in the mountainous \n",
"regions of central Asia.\n",
"\n",
"[How Fast Can a Leopard Run? A Fascinating Look at Their \n",
"Speed](https://tiger-universe.com/blogs/tiger-blog/how-fast-can-a-leopard-run)\n",
"Understanding Leopard's Top Speed. Leopards are incredibly agile and strong, reaching speeds up to 36 mph. Their \n",
"speed is vital for hunting alone, unlike other predators that hunt in groups. Leopard run speed records reveal \n",
"their incredible burst of speed, essential for sneaking up on their prey.\n",
"\n",
"[How Fast Can a Leopard Run? - YouTube](https://www.youtube.com/watch?v=CdK97tz4APQ)\n",
"Discover the incredible running speed of leopards and how they excel in the wild! In this video, we dive into \n",
"leopard running speed, exploring their top spri...\n",
"\n",
"[Leopard Top Speed: How Fast Can They Run](https://womeninbusiness.byu.edu/leopard-top-speed_22663.html)\n",
"Several factors can influence a leopard's running speed, including: Terrain: Leopards can run faster on flat, open \n",
"terrain, but their speed may be reduced on rocky, mountainous, or dense forest terrain.; Subspecies: Different \n",
"subspecies of leopards may have varying levels of speed, depending on their adaptations to their environment.; Prey\n",
"type: Leopards may adjust their running speed ...\n",
"\n",
"[How Fast Can a Leopard Run (Average Speed) - \n",
"brotherspets.com](https://brotherspets.com/how-fast-can-a-leopard-run/)\n",
"Leopards are known for their speed and agility, and they are capable of reaching impressive top speeds when they \n",
"need to. According to various sources, leopards can run at speeds ranging from 30-56 mph (48-90 km/h) with an \n",
"average speed of 58 km/h.\n",
"\n",
"[Leopard's Peak Speed: Unleashing Their Running \n",
"Power](https://startingrun.com/unleashing-the-speed-how-fast-can-a-leopard-run/)\n",
"Heavy vegetation or rugged terrain can limit a leopard's speed as it demands more careful maneuvering. On the flip \n",
"side, open grasslands tend to be the best running grounds for these feline speedsters. Lastly, prey availability \n",
"and behavior create a complex dynamic that influences a leopard's speed. The need to chase, capture, and retain ...\n",
"\n",
"Out: None\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 5: Duration 9.68 seconds| Input tokens: 26,328 | Output tokens: 313]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 5: Duration 9.68 seconds| Input tokens: 26,328 | Output tokens: 313]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Reached max steps.</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[1;31mReached max steps.\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">[Step 6: Duration 9.68 seconds| Input tokens: 31,906 | Output tokens: 578]</span>\n",
"</pre>\n"
],
"text/plain": [
"\u001b[2m[Step 6: Duration 9.68 seconds| Input tokens: 31,906 | Output tokens: 578]\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"\"Based on the search results, the top speed of a leopard is approximately 56-60 km/h (35-37 mph).\\n\\nFirst, let's take the average top speed of a leopard, which is around 58 km/h (36 mph). We will convert this speed to meters per second (m/s):\\n\\n\\\\[ 58 \\\\text{ km/h} \\\\times \\\\frac{1000 \\\\text{ meters}}{1 \\\\text{ km}} \\\\times \\\\frac{1 \\\\text{ hour}}{3600 \\\\text{ seconds}} = 16.11 \\\\text{ m/s} \\\\]\\n\\nThe length of Pont des Arts is approximately 155 meters.\\n\\nTo determine how long it would take a leopard to run through the bridge at its full speed, we can use the formula:\\n\\n\\\\[ \\\\text{Time} = \\\\frac{\\\\text{Distance}}{\\\\text{Speed}} \\\\]\\n\\n\\\\[ \\\\text{Time} = \\\\frac{155 \\\\text{ meters}}{16.11 \\\\text{ m/s}} \\\\approx 9.62 \\\\text{ seconds} \\\\]\\n\\nTherefore, it would take a leopard approximately 9.62 seconds to run through Pont des Arts at full speed.\""
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"agent.run(\"How many seconds would it take for a leopard at full speed to run through Pont des Arts?\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "smolagent",
"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.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}