tarsier icon indicating copy to clipboard operation
tarsier copied to clipboard

Fix errors in the LlamaIndex Cookbook Example

Open devanshkaloti opened this issue 1 year ago • 0 comments

Error 1

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], line 1
----> 1 from llama_index.tools import FunctionTool
      2 from playwright.async_api import async_playwright
      3 from tarsier import Tarsier, GoogleVisionOCRService

ModuleNotFoundError: No module named 'llama_index.tools'

Changes:

  • Changed from llama_index.tools import FunctionTool to from llama_index.core.tools import FunctionTool

Error 2

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[5], line 1
----> 1 from llama_index.agent import OpenAIAgent
      2 from llama_index.llms import OpenAI
      4 llm = OpenAI(model="gpt-4")

ImportError: cannot import name 'OpenAIAgent' from 'llama_index.agent' (unknown location)

Changes:

  • Changed OpenAI import statements

Error 3

Error: Locator.press_sequentially: selector: expected string, got object
  • element = page.locator(x_path) -> element = page.locator(x_path['xpath'])

Additional

  • Changed the default example model from gpt-4 to gpt-4o since it has much better performance and is cheaper.
  • These changes work with Python version 3.12.7.

devanshkaloti avatar Oct 13 '24 21:10 devanshkaloti