robocorp[major]: upgrade pydantic (#26062)

This commit is contained in:
ccurme
2024-09-04 17:10:15 -04:00
committed by GitHub
parent 9379613132
commit 923ce84aa7
5 changed files with 15 additions and 42 deletions

View File

@@ -2,13 +2,13 @@ import time
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Dict, List, Set, Tuple, Union, cast from typing import Any, Dict, List, Set, Tuple, Union, cast
from langchain_core.pydantic_v1 import ( from langchain_core.utils.json_schema import dereference_refs
from langchain_core.utils.pydantic import is_basemodel_instance
from pydantic import (
BaseModel, BaseModel,
Field, Field,
create_model, create_model,
) )
from langchain_core.utils.json_schema import dereference_refs
from langchain_core.utils.pydantic import is_basemodel_instance
@dataclass(frozen=True) @dataclass(frozen=True)

View File

@@ -13,11 +13,11 @@ from langchain_core.callbacks.manager import CallbackManager
from langchain_core.language_models.chat_models import BaseChatModel from langchain_core.language_models.chat_models import BaseChatModel
from langchain_core.output_parsers import StrOutputParser from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import PromptTemplate from langchain_core.prompts import PromptTemplate
from langchain_core.pydantic_v1 import BaseModel, Field, PrivateAttr, create_model
from langchain_core.runnables import Runnable, RunnablePassthrough from langchain_core.runnables import Runnable, RunnablePassthrough
from langchain_core.tools import BaseTool, StructuredTool, Tool from langchain_core.tools import BaseTool, StructuredTool, Tool
from langchain_core.tracers.context import _tracing_v2_is_enabled from langchain_core.tracers.context import _tracing_v2_is_enabled
from langsmith import Client from langsmith import Client
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr, create_model
from langchain_robocorp._common import ( from langchain_robocorp._common import (
get_param_fields, get_param_fields,
@@ -110,8 +110,9 @@ class ActionServerToolkit(BaseModel):
"""Enable reporting Langsmith trace to Action Server runs""" """Enable reporting Langsmith trace to Action Server runs"""
_run_details: dict = PrivateAttr({}) _run_details: dict = PrivateAttr({})
class Config: model_config = ConfigDict(
arbitrary_types_allowed = True arbitrary_types_allowed=True,
)
def get_tools( def get_tools(
self, self,

View File

@@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
[[package]] [[package]]
name = "annotated-types" name = "annotated-types"
@@ -11,9 +11,6 @@ files = [
{file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"},
] ]
[package.dependencies]
typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""}
[[package]] [[package]]
name = "certifi" name = "certifi"
version = "2024.7.4" version = "2024.7.4"
@@ -229,10 +226,10 @@ files = [
[[package]] [[package]]
name = "langchain-core" name = "langchain-core"
version = "0.2.24" version = "0.2.38"
description = "Building applications with LLMs through composability" description = "Building applications with LLMs through composability"
optional = false optional = false
python-versions = ">=3.8.1,<4.0" python-versions = ">=3.9,<4.0"
files = [] files = []
develop = true develop = true
@@ -246,6 +243,7 @@ pydantic = [
] ]
PyYAML = ">=5.3" PyYAML = ">=5.3"
tenacity = "^8.1.0,!=8.4.0" tenacity = "^8.1.0,!=8.4.0"
typing-extensions = ">=4.7"
[package.source] [package.source]
type = "directory" type = "directory"
@@ -870,5 +868,5 @@ watchmedo = ["PyYAML (>=3.10)"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = ">=3.8.1,<4.0" python-versions = ">=3.9,<4.0"
content-hash = "6b4489fb9ed4fe0871e64ef8ad93a9122a801824811cfeeebb6a42f3d666d50e" content-hash = "a684f0e24648e9106bbb7d79554a71fca47235b61961159872a5d72267406aab"

View File

@@ -18,10 +18,11 @@ disallow_untyped_defs = "True"
"Source Code" = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/robocorp" "Source Code" = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/robocorp"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = ">=3.8.1,<4.0" python = ">=3.9,<4.0"
langchain-core = ">=0.2.24,<0.3" langchain-core = ">=0.2.24,<0.3"
requests = "^2.31.0" requests = "^2.31.0"
types-requests = "^2.31.0.6" types-requests = "^2.31.0.6"
pydantic = ">=2,<3"
[tool.ruff.lint] [tool.ruff.lint]
select = [ "E", "F", "I", "T201",] select = [ "E", "F", "I", "T201",]

View File

@@ -1,27 +0,0 @@
#!/bin/bash
#
# This script searches for lines starting with "import pydantic" or "from pydantic"
# in tracked files within a Git repository.
#
# Usage: ./scripts/check_pydantic.sh /path/to/repository
# Check if a path argument is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 /path/to/repository"
exit 1
fi
repository_path="$1"
# Search for lines matching the pattern within the specified repository
result=$(git -C "$repository_path" grep -E '^import pydantic|^from pydantic')
# Check if any matching lines were found
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 "For example, replace 'from pydantic import BaseModel'"
echo "with 'from langchain_core.pydantic_v1 import BaseModel'"
exit 1
fi