Skip to content

Commit 7d2fc67

Browse files
committed
feat: add structured output format
1 parent d29338b commit 7d2fc67

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

examples/anthropic/search_graph_schema_haiku.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
"""
44

55
import os
6+
from typing import List
67
from dotenv import load_dotenv
7-
load_dotenv()
8-
8+
from pydantic import BaseModel, Field
99
from scrapegraphai.graphs import SearchGraph
1010

11-
from pydantic import BaseModel, Field
12-
from typing import List
11+
load_dotenv()
1312

1413
# ************************************************
1514
# Define the output schema for the graph

examples/azure/smart_scraper_schema_azure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Basic example of scraping pipeline using SmartScraper with schema
33
"""
44

5-
import os, json
5+
import os
6+
import json
67
from typing import List
78
from pydantic import BaseModel, Field
89
from dotenv import load_dotenv

examples/local_models/smart_scraper_schema_ollama.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Projects(BaseModel):
1919

2020
graph_config = {
2121
"llm": {
22-
"model": "ollama/llama3",
22+
"model": "ollama/llama3.1",
2323
"temperature": 0,
2424
"format": "json", # Ollama needs the format to be specified explicitly
2525
# "base_url": "http://localhost:11434", # set ollama URL arbitrarily

examples/openai/smart_scraper_openai.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Basic example of scraping pipeline using SmartScraper
33
"""
44

5-
import os, json
5+
import os
6+
import json
67
from scrapegraphai.graphs import SmartScraperGraph
78
from scrapegraphai.utils import prettify_exec_info
89
from dotenv import load_dotenv

examples/openai/smart_scraper_schema_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os, json
66
from typing import List
77
from dotenv import load_dotenv
8-
from langchain_core.pydantic_v1 import BaseModel, Field
8+
from pydantic import BaseModel, Field
99
from scrapegraphai.graphs import SmartScraperGraph
1010

1111
load_dotenv()

0 commit comments

Comments
 (0)