Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat: add structured output format
Marco Vinciguerra7d2fc672c8c3
diff --git a/examples/anthropic/search_graph_schema_haiku.py b/examples/anthropic/search_graph_schema_haiku.pyindex 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 Listfrom dotenv import load_dotenv-load_dotenv()-+from pydantic import BaseModel, Fieldfrom scrapegraphai.graphs import SearchGraph-from pydantic import BaseModel, Field-from typing import List+load_dotenv()# ************************************************# Define the output schema for the graphdiff --git a/examples/azure/smart_scraper_schema_azure.py b/examples/azure/smart_scraper_schema_azure.pyindex 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 jsonfrom typing import Listfrom pydantic import BaseModel, Fieldfrom dotenv import load_dotenvdiff --git a/examples/local_models/smart_scraper_schema_ollama.py b/examples/local_models/smart_scraper_schema_ollama.pyindex 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 arbitrarilydiff --git a/examples/openai/smart_scraper_openai.py b/examples/openai/smart_scraper_openai.pyindex 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 jsonfrom scrapegraphai.graphs import SmartScraperGraphfrom scrapegraphai.utils import prettify_exec_infofrom dotenv import load_dotenvdiff --git a/examples/openai/smart_scraper_schema_openai.py b/examples/openai/smart_scraper_schema_openai.pyindex 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 schemaimport os, jsonfrom typing import Listfrom dotenv import load_dotenv-from langchain_core.pydantic_v1 import BaseModel, Field+from pydantic import BaseModel, Fieldfrom scrapegraphai.graphs import SmartScraperGraphload_dotenv()