Skip to content

What to do on timeout? #831

Closed
Closed
@silgon

Description

@silgon

The following is a script from the readme with two lines changed, prompt and source in the parameters' list of SmartScraperGraph. I get a timeout and in the documentation, I don't see how to configure the parameter

import json
from scrapegraphai.graphs import SmartScraperGraph

# Define the configuration for the scraping pipeline
graph_config = {
    "llm": {
        "api_key": "YOUR_OPENAI_APIKEY",
        "model": "openai/gpt-4o-mini",
    },
    "verbose": True,
    "headless": False,
}

# Create the SmartScraperGraph instance
smart_scraper_graph = SmartScraperGraph(
    prompt="Give me the url of all the modules including #",
    source="https://scrapegraph-ai.readthedocs.io/en/latest/modules/modules.html",
    config=graph_config
)

# Run the pipeline
result = smart_scraper_graph.run()
print(json.dumps(result, indent=4))

Result

--- Executing Fetch Node ---
--- (Fetching HTML from: https://scrapegraph-ai.readthedocs.io/en/latest/modules/modules.html) ---
--- Executing ParseNode Node ---
--- Executing GenerateAnswer Node ---
Timeout error: Response took longer than 30 seconds
{
    "error": "Response timeout exceeded"
}

I tried to add timetout in the llm code without much success as follows:

graph_config = {
    "llm": {
        "api_key": "YOUR_OPENAI_APIKEY",
        "model": "openai/gpt-4o-mini",
+       "timeout": "300",
    },
    "verbose": True,
    "headless": False,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions