feat: add structured output format

This commit is contained in:
Marco Vinciguerra 2024-08-19 14:15:54 +02:00
parent d29338b7c2
commit 7d2fc672c8
5 changed files with 9 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()