From 873204de418dd1ebb5962560484bc32ca792bffe Mon Sep 17 00:00:00 2001 From: Devansh Kaloti Date: Sun, 13 Oct 2024 17:27:47 -0400 Subject: [PATCH] Fix issues in LLAMA Index Cookbook --- cookbook/llama-index-web-agent.ipynb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cookbook/llama-index-web-agent.ipynb b/cookbook/llama-index-web-agent.ipynb index 93211d4b..dec181d6 100644 --- a/cookbook/llama-index-web-agent.ipynb +++ b/cookbook/llama-index-web-agent.ipynb @@ -179,7 +179,7 @@ }, "outputs": [], "source": [ - "from llama_index.tools import FunctionTool\n", + "from llama_index.core.tools import FunctionTool\n", "from playwright.async_api import async_playwright\n", "from tarsier import Tarsier, GoogleVisionOCRService\n", "import os\n", @@ -219,7 +219,7 @@ " \"\"\"\n", " x_path = tag_to_xpath[element_id]\n", " print(x_path)\n", - " element = page.locator(x_path)\n", + " element = page.locator(x_path['xpath'])\n", " await element.scroll_into_view_if_needed()\n", " await page.wait_for_timeout(1000)\n", " await element.click()\n", @@ -236,7 +236,7 @@ " \"\"\"\n", " x_path = tag_to_xpath[element_id]\n", " print(x_path)\n", - " await page.locator(x_path).press_sequentially(text)\n", + " await page.locator(x_path['xpath']).press_sequentially(text)\n", " return await read_page()\n", "\n", "\n", @@ -276,10 +276,10 @@ }, "outputs": [], "source": [ - "from llama_index.agent import OpenAIAgent\n", - "from llama_index.llms import OpenAI\n", + "from llama_index.agent.openai import OpenAIAgent\n", + "from llama_index.llms.openai import OpenAI\n", "\n", - "llm = OpenAI(model=\"gpt-4\")\n", + "llm = OpenAI(model=\"gpt-4o\")\n", "tarsier_agent = OpenAIAgent.from_tools(\n", " [read_page_tool, click_tool, type_text_tool, press_key_tool],\n", " llm=llm,\n", @@ -585,7 +585,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.6" + "version": "3.12.7" } }, "nbformat": 4,