Skip to content

Python scraper based on AI

add grow example

VinciGit0059594cbc2f36
diff --git a/README.md b/README.md
index 7ceef975..44036096 100644
--- a/README.md
+++ b/README.md
@@ -134,7 +134,38 @@ result = smart_scraper_graph.run()
print(result)
```
-### Case 4: Extracting information using Gemini
+### Case 4: Extracting information using Groq
+```python
+from scrapegraphai.graphs import SmartScraperGraph
+from scrapegraphai.utils import prettify_exec_info
+
+groq_key = os.getenv("GROQ_APIKEY")
+
+graph_config = {
+ "llm": {
+ "model": "groq/gemma-7b-it",
+ "api_key": groq_key,
+ "temperature": 0
+ },
+ "embeddings": {
+ "model": "ollama/nomic-embed-text",
+ "temperature": 0,
+ "base_url": "http://localhost:11434",
+ },
+ "headless": False
+}
+
+smart_scraper_graph = SmartScraperGraph(
+ prompt="List me all the projects with their description and the author.",
+ source="https://perinim.github.io/projects",
+ config=graph_config
+)
+
+result = smart_scraper_graph.run()
+print(result)
+```
+
+### Case 5: Extracting information using Gemini
```python
from scrapegraphai.graphs import SmartScraperGraph
GOOGLE_APIKEY = "YOUR_API_KEY"
diff --git a/examples/groq/.env.example b/examples/groq/.env.example
new file mode 100644
index 00000000..e39e60fc
--- /dev/null
+++ b/examples/groq/.env.example
@@ -0,0 +1 @@
+GROQ_APIKEY= "your groq key"
\ No newline at end of file
diff --git a/examples/groq/smart_scraper_groq.py b/examples/groq/smart_scraper_groq.py
new file mode 100644
index 00000000..4693fec4
--- /dev/null
+++ b/examples/groq/smart_scraper_groq.py
@@ -0,0 +1,45 @@
+"""
+Basic example of scraping pipeline using SmartScraper
+"""
+
+import os
+from dotenv import load_dotenv
+from scrapegraphai.graphs import SmartScraperGraph
+from scrapegraphai.utils import prettify_exec_info
+
+load_dotenv()
+
+
+# ************************************************
+# Define the configuration for the graph
+# ************************************************
+
+groq_key = os.getenv("GROQ_APIKEY")
+
+graph_config = {
+ "llm": {
+ "api_key": groq_key,
+ "model": "groq/gemma-7b-it",
+ },
+}
+
+# ************************************************
+# Create the SmartScraperGraph instance and run it
+# ************************************************
+
+smart_scraper_graph = SmartScraperGraph(
+ prompt="List me all the projects with their description.",
+ # also accepts a string with the already downloaded HTML code
+ source="https://perinim.github.io/projects/",
+ config=graph_config
+)
+
+result = smart_scraper_graph.run()
+print(result)
+
+# ************************************************
+# Get graph execution info
+# ************************************************
+
+graph_exec_info = smart_scraper_graph.get_execution_info()
+print(prettify_exec_info(graph_exec_info))
diff --git a/examples/mixed_models/.env.example b/examples/mixed_models/.env.example
index 1f38084e..ee2490d5 100644
--- a/examples/mixed_models/.env.example
+++ b/examples/mixed_models/.env.example
@@ -1,4 +1,5 @@
OPENAI_APIKEY="your openai api key"
GOOGLE_APIKEY="your google api key"
AZURE_OPENAI_API_KEY="your azure api key"
-AZURE_OPENAI_ENDPOINT="https://<your-endpoint>.openai.azure.com/"
\ No newline at end of file
+AZURE_OPENAI_ENDPOINT="https://<your-endpoint>.openai.azure.com/"
+GROQ_APIKEY= "your groq key"
\ No newline at end of file