Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What to do on timeout? #831

Open
silgon opened this issue Nov 24, 2024 · 0 comments
Open

What to do on timeout? #831

silgon opened this issue Nov 24, 2024 · 0 comments

Comments

@silgon
Copy link

silgon commented Nov 24, 2024

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,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant