Skip to content

Python scraper based on AI

feat: add structured output format

Marco Vinciguerra7d2fc672c8c3
diff --git a/examples/anthropic/search_graph_schema_haiku.py b/examples/anthropic/search_graph_schema_haiku.py
index 19eebf09..c9e7a875 100644
--- a/examples/anthropic/search_graph_schema_haiku.py
+++ b/examples/anthropic/search_graph_schema_haiku.py
@@ -3,13 +3,12 @@ Example of Search Graph
"""
import os
+from typing import List
from dotenv import load_dotenv
-load_dotenv()
-
+from pydantic import BaseModel, Field
from scrapegraphai.graphs import SearchGraph
-from pydantic import BaseModel, Field
-from typing import List
+load_dotenv()
# ************************************************
# Define the output schema for the graph
diff --git a/examples/azure/smart_scraper_schema_azure.py b/examples/azure/smart_scraper_schema_azure.py
index 5a9006b2..d0816bf5 100644
--- a/examples/azure/smart_scraper_schema_azure.py
+++ b/examples/azure/smart_scraper_schema_azure.py
@@ -2,7 +2,8 @@
Basic example of scraping pipeline using SmartScraper with schema
"""
-import os, json
+import os
+import json
from typing import List
from pydantic import BaseModel, Field
from dotenv import load_dotenv
diff --git a/examples/local_models/smart_scraper_schema_ollama.py b/examples/local_models/smart_scraper_schema_ollama.py
index 5fcff433..088e2eed 100644
--- a/examples/local_models/smart_scraper_schema_ollama.py
+++ b/examples/local_models/smart_scraper_schema_ollama.py
@@ -19,7 +19,7 @@ class Projects(BaseModel):
graph_config = {
"llm": {
- "model": "ollama/llama3",
+ "model": "ollama/llama3.1",
"temperature": 0,
"format": "json", # Ollama needs the format to be specified explicitly
# "base_url": "http://localhost:11434", # set ollama URL arbitrarily
diff --git a/examples/openai/smart_scraper_openai.py b/examples/openai/smart_scraper_openai.py
index 6771b817..4299ec29 100644
--- a/examples/openai/smart_scraper_openai.py
+++ b/examples/openai/smart_scraper_openai.py
@@ -2,7 +2,8 @@
Basic example of scraping pipeline using SmartScraper
"""
-import os, json
+import os
+import json
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
from dotenv import load_dotenv
diff --git a/examples/openai/smart_scraper_schema_openai.py b/examples/openai/smart_scraper_schema_openai.py
index 5a13e9ae..828a9b0a 100644
--- a/examples/openai/smart_scraper_schema_openai.py
+++ b/examples/openai/smart_scraper_schema_openai.py
@@ -5,7 +5,7 @@ Basic example of scraping pipeline using SmartScraper with schema
import os, json
from typing import List
from dotenv import load_dotenv
-from langchain_core.pydantic_v1 import BaseModel, Field
+from pydantic import BaseModel, Field
from scrapegraphai.graphs import SmartScraperGraph
load_dotenv()