Skip to content

Commit 7b07fdf

Browse files
committed
add groq example
1 parent 5449ebf commit 7b07fdf

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"""
2+
Basic example of scraping pipeline using SmartScraper
3+
"""
4+
5+
import os
6+
from dotenv import load_dotenv
7+
from scrapegraphai.graphs import SearchGraph
8+
from scrapegraphai.utils import prettify_exec_info
9+
10+
load_dotenv()
11+
12+
13+
# ************************************************
14+
# Define the configuration for the graph
15+
# ************************************************
16+
17+
groq_key = os.getenv("GROQ_APIKEY")
18+
openai_key = os.getenv("OPENAI_APIKEY")
19+
20+
graph_config = {
21+
"llm": {
22+
"model": "groq/gemma-7b-it",
23+
"api_key": groq_key,
24+
"temperature": 0
25+
},
26+
"embeddings": {
27+
"api_key": openai_key,
28+
"model": "openai",
29+
},
30+
"headless": False
31+
}
32+
33+
search_graph = SearchGraph(
34+
prompt="List me the best escursions near Trento",
35+
config=graph_config
36+
)
37+
38+
result = search_graph.run()
39+
print(result)
40+
41+
# ************************************************
42+
# Get graph execution info
43+
# ************************************************
44+
45+
graph_exec_info = search_graph.get_execution_info()
46+
print(prettify_exec_info(graph_exec_info))

0 commit comments

Comments
 (0)