File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
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 ))
You can’t perform that action at this time.
0 commit comments