Skip to content

Commit eaa83ed

Browse files
committed
update project requirement and add example
1 parent 038d2ef commit eaa83ed

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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))

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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

4445
license = "MIT"

0 commit comments

Comments
 (0)