ScrapeGraphAI / Scrapegraph-ai

Python scraper based on AI
https://scrapegraphai.com
MIT License
15.16k stars 1.25k forks source link

IndexError: list index out of range in SearchGraph #774

Open boral opened 1 day ago

boral commented 1 day ago

Getting following error. Using Jupyter.

''' from scrapegraphai.graphs import SearchGraph

Define the configuration for the graph

graph_config = { "llm": { "api_key": OPENAI_API_KEY, "model": "gpt-3.5-turbo", "temperature": 0, }, }

Create the SearchGraph instance

search_graph = SearchGraph( prompt="Give list of diagnositic centers in Hooghly West bengal along with their details in a table", config=graph_config ) '''

Error

''' IndexError Traceback (most recent call last)

in <cell line: 13>() 11 12 # Create the SearchGraph instance ---> 13 search_graph = SearchGraph( 14 prompt="Give list of diagnositic centers in Hooghly West bengal along with their details in a table", 15 config=graph_config

2 frames

/usr/local/lib/python3.10/dist-packages/scrapegraphai/graphs/abstract_graph.py in _create_llm(self, llm_config) 147 split_model_provider = llm_params["model"].split("/", 1) 148 llm_params["model_provider"] = split_model_provider[0] --> 149 llm_params["model"] = split_model_provider[1] 150 151 if llm_params["model_provider"] not in known_providers:

IndexError: list index out of range '''

f-aguzzi commented 1 day ago

You have to manually specify the model in the provider_name/model_name format. Rewrite your graph config like this:

graph_config = {
  "llm": {
    "api_key": OPENAI_API_KEY,
    "model": "openai/gpt-3.5-turbo",
    "temperature": 0,
  },
}

Let us know if it works after adding this. Thanks for using this library.