File tree Expand file tree Collapse file tree 4 files changed +80
-2
lines changed Expand file tree Collapse file tree 4 files changed +80
-2
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,38 @@ result = smart_scraper_graph.run()
134134print (result)
135135```
136136
137- ### Case 4: Extracting information using Gemini
137+ ### Case 4: Extracting information using Groq
138+ ``` python
139+ from scrapegraphai.graphs import SmartScraperGraph
140+ from scrapegraphai.utils import prettify_exec_info
141+
142+ groq_key = os.getenv(" GROQ_APIKEY" )
143+
144+ graph_config = {
145+ " llm" : {
146+ " model" : " groq/gemma-7b-it" ,
147+ " api_key" : groq_key,
148+ " temperature" : 0
149+ },
150+ " embeddings" : {
151+ " model" : " ollama/nomic-embed-text" ,
152+ " temperature" : 0 ,
153+ " base_url" : " http://localhost:11434" ,
154+ },
155+ " headless" : False
156+ }
157+
158+ smart_scraper_graph = SmartScraperGraph(
159+ prompt = " List me all the projects with their description and the author." ,
160+ source = " https://perinim.github.io/projects" ,
161+ config = graph_config
162+ )
163+
164+ result = smart_scraper_graph.run()
165+ print (result)
166+ ```
167+
168+ ### Case 5: Extracting information using Gemini
138169``` python
139170from scrapegraphai.graphs import SmartScraperGraph
140171GOOGLE_APIKEY = " YOUR_API_KEY"
Original file line number Diff line number Diff line change 1+ GROQ_APIKEY = " your groq key"
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 SmartScraperGraph
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+
19+ graph_config = {
20+ "llm" : {
21+ "api_key" : groq_key ,
22+ "model" : "groq/gemma-7b-it" ,
23+ },
24+ }
25+
26+ # ************************************************
27+ # Create the SmartScraperGraph instance and run it
28+ # ************************************************
29+
30+ smart_scraper_graph = SmartScraperGraph (
31+ prompt = "List me all the projects with their description." ,
32+ # also accepts a string with the already downloaded HTML code
33+ source = "https://perinim.github.io/projects/" ,
34+ config = graph_config
35+ )
36+
37+ result = smart_scraper_graph .run ()
38+ print (result )
39+
40+ # ************************************************
41+ # Get graph execution info
42+ # ************************************************
43+
44+ graph_exec_info = smart_scraper_graph .get_execution_info ()
45+ print (prettify_exec_info (graph_exec_info ))
Original file line number Diff line number Diff line change 11OPENAI_APIKEY = " your openai api key"
22GOOGLE_APIKEY = " your google api key"
33AZURE_OPENAI_API_KEY = " your azure api key"
4- AZURE_OPENAI_ENDPOINT = " https://<your-endpoint>.openai.azure.com/"
4+ AZURE_OPENAI_ENDPOINT = " https://<your-endpoint>.openai.azure.com/"
5+ GROQ_APIKEY = " your groq key"
You can’t perform that action at this time.
0 commit comments