File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1+ """
2+ Basic example of scraping pipeline using SmartScraperMultiConcatGraph with Groq
3+ """
4+
5+ import os
6+ import json
7+ from dotenv import load_dotenv
8+ from scrapegraphai .graphs import SmartScraperGraph
9+
10+ load_dotenv ()
11+
12+ # ************************************************
13+ # Define the configuration for the graph
14+ # ************************************************
15+
16+ graph_config = {
17+ "llm" : {
18+ "api_key" : os .getenv ("GROQ_APIKEY" ),
19+ "model" : "groq/gemma-7b-it" ,
20+ },
21+ "verbose" : True ,
22+ "headless" : True ,
23+ "reattempt" : True #Setting this to True will allow the graph to reattempt the scraping process
24+ }
25+
26+ # *******************************************************
27+ # Create the SmartScraperMultiCondGraph instance and run it
28+ # *******************************************************
29+
30+ multiple_search_graph = SmartScraperGraph (
31+ prompt = "Who is Marco Perini?" ,
32+ source = "https://perinim.github.io/" ,
33+ schema = None ,
34+ config = graph_config
35+ )
36+
37+ result = multiple_search_graph .run ()
38+ print (json .dumps (result , indent = 4 ))
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ dependencies = [
3838 " async-timeout>=4.0.3" ,
3939 " transformers>=4.44.2" ,
4040 " googlesearch-python>=1.2.5" ,
41- " simpleeval>=1.0.0"
41+ " simpleeval>=1.0.0" ,
42+ " async_timeout>=4.0.3"
4243]
4344
4445license = " MIT"
You can’t perform that action at this time.
0 commit comments