From eb895492481192ac6b19a1b6714490e7b2ae3ef3 Mon Sep 17 00:00:00 2001 From: Lorenzo Paleari <100212108+LorenzoPaleari@users.noreply.github.com> Date: Tue, 17 Sep 2024 23:08:56 +0200 Subject: [PATCH] feat: updated pydantic to v2 --- examples/anthropic/search_graph_schema_haiku.py | 2 +- examples/anthropic/smart_scraper_schema_haiku.py | 2 +- examples/azure/search_graph_schema_azure.py | 2 +- examples/azure/smart_scraper_schema_azure.py | 2 +- examples/bedrock/search_graph_schema_bedrock.py | 2 +- examples/bedrock/smart_scraper_schema_bedrock.py | 2 +- examples/deepseek/search_graph_schema_deepseek.py | 2 +- examples/deepseek/smart_scraper_schema_deepseek.py | 2 +- examples/extras/serch_graph_scehma.py | 2 +- examples/fireworks/pdf_scraper_multi_fireworks.py | 2 +- examples/fireworks/script_generator_schema_fireworks.py | 2 +- examples/fireworks/search_graph_schema_fireworks.py | 2 +- examples/fireworks/smart_scraper_schema_fireworks.py | 2 +- examples/google_genai/search_graph_schema_gemini.py | 2 +- examples/google_genai/smart_scraper_schema_gemini.py | 2 +- examples/google_vertexai/search_graph_schema_gemini.py | 2 +- examples/google_vertexai/smart_scraper_schema_gemini.py | 2 +- examples/groq/search_graph_schema_groq.py | 2 +- examples/groq/smart_scraper_schema_groq.py | 2 +- examples/integrations/indexify_node_example.py | 2 +- examples/local_models/search_graph_schema_ollama.py | 2 +- examples/local_models/smart_scraper_schema_ollama.py | 2 +- examples/mistral/pdf_scraper_multi_mistral.py | 2 +- examples/mistral/script_generator_schema_mistral.py | 2 +- examples/mistral/search_graph_schema_mistral.py | 2 +- examples/mistral/smart_scraper_schema_mistral.py | 2 +- examples/nemotron/script_generator_schema_nemotron.py | 2 +- examples/nemotron/search_graph_schema_nemotron.py | 2 +- examples/nemotron/smart_scraper_schema_nemotron.py | 2 +- examples/oneapi/search_graph_schema_oneapi.py | 2 +- examples/oneapi/smart_scraper_schema_oneapi.py | 2 +- examples/openai/pdf_scraper_multi_openai.py | 2 +- examples/openai/script_generator_schema_openai.py | 2 +- examples/openai/search_graph_schema_openai.py | 2 +- examples/openai/smart_scraper_schema_openai.py | 2 +- scrapegraphai/nodes/graph_iterator_node.py | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/examples/anthropic/search_graph_schema_haiku.py b/examples/anthropic/search_graph_schema_haiku.py index 0ccafa79..1158d58a 100644 --- a/examples/anthropic/search_graph_schema_haiku.py +++ b/examples/anthropic/search_graph_schema_haiku.py @@ -5,7 +5,7 @@ Example of Search Graph import os 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 SearchGraph load_dotenv() diff --git a/examples/anthropic/smart_scraper_schema_haiku.py b/examples/anthropic/smart_scraper_schema_haiku.py index 0e70aeb5..bd447a06 100644 --- a/examples/anthropic/smart_scraper_schema_haiku.py +++ b/examples/anthropic/smart_scraper_schema_haiku.py @@ -4,7 +4,7 @@ Basic example of scraping pipeline using SmartScraper using Azure OpenAI Key import os from typing import List -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from dotenv import load_dotenv from scrapegraphai.graphs import SmartScraperGraph from scrapegraphai.utils import prettify_exec_info diff --git a/examples/azure/search_graph_schema_azure.py b/examples/azure/search_graph_schema_azure.py index ba80b373..629c92ab 100644 --- a/examples/azure/search_graph_schema_azure.py +++ b/examples/azure/search_graph_schema_azure.py @@ -9,7 +9,7 @@ load_dotenv() from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/azure/smart_scraper_schema_azure.py b/examples/azure/smart_scraper_schema_azure.py index 5c882c46..d0816bf5 100644 --- a/examples/azure/smart_scraper_schema_azure.py +++ b/examples/azure/smart_scraper_schema_azure.py @@ -5,7 +5,7 @@ Basic example of scraping pipeline using SmartScraper with schema import os import json from typing import List -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from dotenv import load_dotenv from scrapegraphai.graphs import SmartScraperGraph diff --git a/examples/bedrock/search_graph_schema_bedrock.py b/examples/bedrock/search_graph_schema_bedrock.py index ad2cadab..a49ba730 100644 --- a/examples/bedrock/search_graph_schema_bedrock.py +++ b/examples/bedrock/search_graph_schema_bedrock.py @@ -4,7 +4,7 @@ Example of Search Graph from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/bedrock/smart_scraper_schema_bedrock.py b/examples/bedrock/smart_scraper_schema_bedrock.py index 02f83029..2829efec 100644 --- a/examples/bedrock/smart_scraper_schema_bedrock.py +++ b/examples/bedrock/smart_scraper_schema_bedrock.py @@ -2,7 +2,7 @@ Basic example of scraping pipeline using SmartScraper """ from typing import List -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from scrapegraphai.graphs import SmartScraperGraph from scrapegraphai.utils import prettify_exec_info diff --git a/examples/deepseek/search_graph_schema_deepseek.py b/examples/deepseek/search_graph_schema_deepseek.py index 9966602d..1471ede1 100644 --- a/examples/deepseek/search_graph_schema_deepseek.py +++ b/examples/deepseek/search_graph_schema_deepseek.py @@ -9,7 +9,7 @@ load_dotenv() from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/deepseek/smart_scraper_schema_deepseek.py b/examples/deepseek/smart_scraper_schema_deepseek.py index 6d924b71..722e02bf 100644 --- a/examples/deepseek/smart_scraper_schema_deepseek.py +++ b/examples/deepseek/smart_scraper_schema_deepseek.py @@ -4,7 +4,7 @@ Basic example of scraping pipeline using SmartScraper import os from typing import List -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from dotenv import load_dotenv from scrapegraphai.graphs import SmartScraperGraph from scrapegraphai.utils import prettify_exec_info diff --git a/examples/extras/serch_graph_scehma.py b/examples/extras/serch_graph_scehma.py index f4135d19..66c47a33 100644 --- a/examples/extras/serch_graph_scehma.py +++ b/examples/extras/serch_graph_scehma.py @@ -5,7 +5,7 @@ Example of Search Graph import os from dotenv import load_dotenv from scrapegraphai.graphs import SearchGraph -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List load_dotenv() diff --git a/examples/fireworks/pdf_scraper_multi_fireworks.py b/examples/fireworks/pdf_scraper_multi_fireworks.py index bbf3808a..c1077061 100644 --- a/examples/fireworks/pdf_scraper_multi_fireworks.py +++ b/examples/fireworks/pdf_scraper_multi_fireworks.py @@ -5,7 +5,7 @@ import os import 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 PdfScraperMultiGraph load_dotenv() diff --git a/examples/fireworks/script_generator_schema_fireworks.py b/examples/fireworks/script_generator_schema_fireworks.py index f6f90ddf..6355a4e8 100644 --- a/examples/fireworks/script_generator_schema_fireworks.py +++ b/examples/fireworks/script_generator_schema_fireworks.py @@ -5,7 +5,7 @@ Basic example of scraping pipeline using ScriptCreatorGraph import os 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 ScriptCreatorGraph from scrapegraphai.utils import prettify_exec_info diff --git a/examples/fireworks/search_graph_schema_fireworks.py b/examples/fireworks/search_graph_schema_fireworks.py index a16d3ae2..d88d991e 100644 --- a/examples/fireworks/search_graph_schema_fireworks.py +++ b/examples/fireworks/search_graph_schema_fireworks.py @@ -9,7 +9,7 @@ load_dotenv() from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/fireworks/smart_scraper_schema_fireworks.py b/examples/fireworks/smart_scraper_schema_fireworks.py index cefb4d7d..d71593f3 100644 --- a/examples/fireworks/smart_scraper_schema_fireworks.py +++ b/examples/fireworks/smart_scraper_schema_fireworks.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() diff --git a/examples/google_genai/search_graph_schema_gemini.py b/examples/google_genai/search_graph_schema_gemini.py index 3c44dd2d..e4b7983d 100644 --- a/examples/google_genai/search_graph_schema_gemini.py +++ b/examples/google_genai/search_graph_schema_gemini.py @@ -9,7 +9,7 @@ load_dotenv() from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/google_genai/smart_scraper_schema_gemini.py b/examples/google_genai/smart_scraper_schema_gemini.py index 8096c466..6c817e20 100644 --- a/examples/google_genai/smart_scraper_schema_gemini.py +++ b/examples/google_genai/smart_scraper_schema_gemini.py @@ -4,7 +4,7 @@ Basic example of scraping pipeline using SmartScraper with schema import os from typing import List -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from dotenv import load_dotenv from scrapegraphai.utils import prettify_exec_info from scrapegraphai.graphs import SmartScraperGraph diff --git a/examples/google_vertexai/search_graph_schema_gemini.py b/examples/google_vertexai/search_graph_schema_gemini.py index 7e73c584..54586c7e 100644 --- a/examples/google_vertexai/search_graph_schema_gemini.py +++ b/examples/google_vertexai/search_graph_schema_gemini.py @@ -9,7 +9,7 @@ load_dotenv() from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/google_vertexai/smart_scraper_schema_gemini.py b/examples/google_vertexai/smart_scraper_schema_gemini.py index 18e0ef5b..541ce9aa 100644 --- a/examples/google_vertexai/smart_scraper_schema_gemini.py +++ b/examples/google_vertexai/smart_scraper_schema_gemini.py @@ -4,7 +4,7 @@ Basic example of scraping pipeline using SmartScraper with schema import os from typing import List -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from dotenv import load_dotenv from scrapegraphai.utils import prettify_exec_info from scrapegraphai.graphs import SmartScraperGraph diff --git a/examples/groq/search_graph_schema_groq.py b/examples/groq/search_graph_schema_groq.py index d5253f2c..4cc2209d 100644 --- a/examples/groq/search_graph_schema_groq.py +++ b/examples/groq/search_graph_schema_groq.py @@ -9,7 +9,7 @@ load_dotenv() from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/groq/smart_scraper_schema_groq.py b/examples/groq/smart_scraper_schema_groq.py index b2b377b3..f9c1a40b 100644 --- a/examples/groq/smart_scraper_schema_groq.py +++ b/examples/groq/smart_scraper_schema_groq.py @@ -4,7 +4,7 @@ Basic example of scraping pipeline using SmartScraper with schema import os, json from typing import List -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from dotenv import load_dotenv from scrapegraphai.graphs import SmartScraperGraph from scrapegraphai.utils import prettify_exec_info diff --git a/examples/integrations/indexify_node_example.py b/examples/integrations/indexify_node_example.py index fae2403a..61db52d2 100644 --- a/examples/integrations/indexify_node_example.py +++ b/examples/integrations/indexify_node_example.py @@ -8,7 +8,7 @@ from typing import List from dotenv import load_dotenv load_dotenv() -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from scrapegraphai.graphs import SmartScraperGraph from scrapegraphai.integrations import IndexifyNode diff --git a/examples/local_models/search_graph_schema_ollama.py b/examples/local_models/search_graph_schema_ollama.py index 6720383c..fb87954f 100644 --- a/examples/local_models/search_graph_schema_ollama.py +++ b/examples/local_models/search_graph_schema_ollama.py @@ -4,7 +4,7 @@ Example of Search Graph from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/local_models/smart_scraper_schema_ollama.py b/examples/local_models/smart_scraper_schema_ollama.py index 5f15b080..35503bd7 100644 --- a/examples/local_models/smart_scraper_schema_ollama.py +++ b/examples/local_models/smart_scraper_schema_ollama.py @@ -3,7 +3,7 @@ Basic example of scraping pipeline using SmartScraper with schema """ import json from typing import List -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from scrapegraphai.graphs import SmartScraperGraph from scrapegraphai.utils import prettify_exec_info diff --git a/examples/mistral/pdf_scraper_multi_mistral.py b/examples/mistral/pdf_scraper_multi_mistral.py index 18b8a1f0..e9f1613f 100644 --- a/examples/mistral/pdf_scraper_multi_mistral.py +++ b/examples/mistral/pdf_scraper_multi_mistral.py @@ -5,7 +5,7 @@ import os import 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 PdfScraperMultiGraph load_dotenv() diff --git a/examples/mistral/script_generator_schema_mistral.py b/examples/mistral/script_generator_schema_mistral.py index beaca4c1..3ad46685 100644 --- a/examples/mistral/script_generator_schema_mistral.py +++ b/examples/mistral/script_generator_schema_mistral.py @@ -6,7 +6,7 @@ import os from dotenv import load_dotenv from scrapegraphai.graphs import ScriptCreatorGraph from scrapegraphai.utils import prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List load_dotenv() diff --git a/examples/mistral/search_graph_schema_mistral.py b/examples/mistral/search_graph_schema_mistral.py index d804d984..7c71c0b1 100644 --- a/examples/mistral/search_graph_schema_mistral.py +++ b/examples/mistral/search_graph_schema_mistral.py @@ -5,7 +5,7 @@ Example of Search Graph import os 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 SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info diff --git a/examples/mistral/smart_scraper_schema_mistral.py b/examples/mistral/smart_scraper_schema_mistral.py index 517bd743..3e1e505a 100644 --- a/examples/mistral/smart_scraper_schema_mistral.py +++ b/examples/mistral/smart_scraper_schema_mistral.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() diff --git a/examples/nemotron/script_generator_schema_nemotron.py b/examples/nemotron/script_generator_schema_nemotron.py index 09d0d682..3f0713a4 100644 --- a/examples/nemotron/script_generator_schema_nemotron.py +++ b/examples/nemotron/script_generator_schema_nemotron.py @@ -7,7 +7,7 @@ from dotenv import load_dotenv from scrapegraphai.graphs import ScriptCreatorGraph from scrapegraphai.utils import prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List load_dotenv() diff --git a/examples/nemotron/search_graph_schema_nemotron.py b/examples/nemotron/search_graph_schema_nemotron.py index 84150f53..eec72daf 100644 --- a/examples/nemotron/search_graph_schema_nemotron.py +++ b/examples/nemotron/search_graph_schema_nemotron.py @@ -9,7 +9,7 @@ load_dotenv() from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/nemotron/smart_scraper_schema_nemotron.py b/examples/nemotron/smart_scraper_schema_nemotron.py index 11ce4de2..e1462e85 100644 --- a/examples/nemotron/smart_scraper_schema_nemotron.py +++ b/examples/nemotron/smart_scraper_schema_nemotron.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() diff --git a/examples/oneapi/search_graph_schema_oneapi.py b/examples/oneapi/search_graph_schema_oneapi.py index d99bca00..7fc44539 100644 --- a/examples/oneapi/search_graph_schema_oneapi.py +++ b/examples/oneapi/search_graph_schema_oneapi.py @@ -4,7 +4,7 @@ Example of Search Graph from scrapegraphai.graphs import SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List # ************************************************ diff --git a/examples/oneapi/smart_scraper_schema_oneapi.py b/examples/oneapi/smart_scraper_schema_oneapi.py index b12bbf66..0c011bb6 100644 --- a/examples/oneapi/smart_scraper_schema_oneapi.py +++ b/examples/oneapi/smart_scraper_schema_oneapi.py @@ -2,7 +2,7 @@ Basic example of scraping pipeline using SmartScraper and OneAPI """ from typing import List -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from scrapegraphai.graphs import SmartScraperGraph from scrapegraphai.utils import prettify_exec_info diff --git a/examples/openai/pdf_scraper_multi_openai.py b/examples/openai/pdf_scraper_multi_openai.py index a405da43..91e219e3 100644 --- a/examples/openai/pdf_scraper_multi_openai.py +++ b/examples/openai/pdf_scraper_multi_openai.py @@ -5,7 +5,7 @@ import os import 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 PdfScraperMultiGraph load_dotenv() diff --git a/examples/openai/script_generator_schema_openai.py b/examples/openai/script_generator_schema_openai.py index e8e7d111..5e542c53 100644 --- a/examples/openai/script_generator_schema_openai.py +++ b/examples/openai/script_generator_schema_openai.py @@ -7,7 +7,7 @@ from dotenv import load_dotenv from scrapegraphai.graphs import ScriptCreatorGraph from scrapegraphai.utils import prettify_exec_info -from langchain_core.pydantic_v1 import BaseModel, Field +from pydantic import BaseModel, Field from typing import List load_dotenv() diff --git a/examples/openai/search_graph_schema_openai.py b/examples/openai/search_graph_schema_openai.py index c0440955..571f08b0 100644 --- a/examples/openai/search_graph_schema_openai.py +++ b/examples/openai/search_graph_schema_openai.py @@ -5,7 +5,7 @@ Example of Search Graph import os 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 SearchGraph from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info diff --git a/examples/openai/smart_scraper_schema_openai.py b/examples/openai/smart_scraper_schema_openai.py index f1ce3d14..0c1618d6 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() diff --git a/scrapegraphai/nodes/graph_iterator_node.py b/scrapegraphai/nodes/graph_iterator_node.py index 8781cf2d..e38461f1 100644 --- a/scrapegraphai/nodes/graph_iterator_node.py +++ b/scrapegraphai/nodes/graph_iterator_node.py @@ -5,7 +5,7 @@ import asyncio from typing import List, Optional from tqdm.asyncio import tqdm from .base_node import BaseNode -from langchain_core.pydantic_v1 import BaseModel +from pydantic import BaseModel DEFAULT_BATCHSIZE = 16