From 6777106fbe053f53e1d094332bbe98870a61fd6f Mon Sep 17 00:00:00 2001 From: Bagatur Date: Tue, 3 Sep 2024 16:50:17 -0700 Subject: [PATCH] fmt --- .../openai/langchain_openai/chat_models/azure.py | 10 +++++----- .../openai/langchain_openai/chat_models/base.py | 10 +++++----- libs/partners/openai/scripts/check_pydantic.sh | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libs/partners/openai/langchain_openai/chat_models/azure.py b/libs/partners/openai/langchain_openai/chat_models/azure.py index b3f09333c20a3..2213b33e80abc 100644 --- a/libs/partners/openai/langchain_openai/chat_models/azure.py +++ b/libs/partners/openai/langchain_openai/chat_models/azure.py @@ -251,7 +251,7 @@ class AzureChatOpenAI(BaseChatOpenAI): Tool calling: .. code-block:: python - from langchain_core.pydantic_v1 import BaseModel, Field + from pydantic import BaseModel, Field class GetWeather(BaseModel): @@ -306,7 +306,7 @@ class GetPopulation(BaseModel): from typing import Optional - from langchain_core.pydantic_v1 import BaseModel, Field + from pydantic import BaseModel, Field class Joke(BaseModel): @@ -733,7 +733,7 @@ def with_structured_output( from typing import Optional from langchain_openai import AzureChatOpenAI - from langchain_core.pydantic_v1 import BaseModel, Field + from pydantic import BaseModel, Field class AnswerWithJustification(BaseModel): @@ -764,7 +764,7 @@ class AnswerWithJustification(BaseModel): .. code-block:: python from langchain_openai import AzureChatOpenAI - from langchain_core.pydantic_v1 import BaseModel + from pydantic import BaseModel class AnswerWithJustification(BaseModel): @@ -851,7 +851,7 @@ class AnswerWithJustification(TypedDict): .. code-block:: from langchain_openai import AzureChatOpenAI - from langchain_core.pydantic_v1 import BaseModel + from pydantic import BaseModel class AnswerWithJustification(BaseModel): answer: str diff --git a/libs/partners/openai/langchain_openai/chat_models/base.py b/libs/partners/openai/langchain_openai/chat_models/base.py index f21670d5c2f88..f753beb40ddd6 100644 --- a/libs/partners/openai/langchain_openai/chat_models/base.py +++ b/libs/partners/openai/langchain_openai/chat_models/base.py @@ -1190,7 +1190,7 @@ def with_structured_output( from typing import Optional from langchain_openai import ChatOpenAI - from langchain_core.pydantic_v1 import BaseModel, Field + from pydantic import BaseModel, Field class AnswerWithJustification(BaseModel): @@ -1221,7 +1221,7 @@ class AnswerWithJustification(BaseModel): .. code-block:: python from langchain_openai import ChatOpenAI - from langchain_core.pydantic_v1 import BaseModel + from pydantic import BaseModel class AnswerWithJustification(BaseModel): @@ -1311,7 +1311,7 @@ class AnswerWithJustification(TypedDict): .. code-block:: from langchain_openai import ChatOpenAI - from langchain_core.pydantic_v1 import BaseModel + from pydantic import BaseModel class AnswerWithJustification(BaseModel): answer: str @@ -1613,7 +1613,7 @@ class ChatOpenAI(BaseChatOpenAI): .. code-block:: python - from langchain_core.pydantic_v1 import BaseModel, Field + from pydantic import BaseModel, Field class GetWeather(BaseModel): @@ -1699,7 +1699,7 @@ class GetPopulation(BaseModel): from typing import Optional - from langchain_core.pydantic_v1 import BaseModel, Field + from pydantic import BaseModel, Field class Joke(BaseModel): diff --git a/libs/partners/openai/scripts/check_pydantic.sh b/libs/partners/openai/scripts/check_pydantic.sh index 06b5bb81ae236..1317f5e53914f 100755 --- a/libs/partners/openai/scripts/check_pydantic.sh +++ b/libs/partners/openai/scripts/check_pydantic.sh @@ -20,8 +20,8 @@ result=$(git -C "$repository_path" grep -E '^import pydantic|^from pydantic') if [ -n "$result" ]; then echo "ERROR: The following lines need to be updated:" echo "$result" - echo "Please replace the code with an import from langchain_core.pydantic_v1." + echo "Please replace the code with an import from pydantic." echo "For example, replace 'from pydantic import BaseModel'" - echo "with 'from langchain_core.pydantic_v1 import BaseModel'" + echo "with 'from pydantic import BaseModel'" exit 1 fi