`poetry lock` the experimental package. (#9478)

pull/9564/head^2
Predrag Gruevski 1 year ago committed by GitHub
parent 65e893b9cd
commit d564ec944c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,7 +6,6 @@ from __future__ import annotations
import json
from typing import Any, ClassVar, Dict, List, Optional, Type
import pydantic
from langchain.base_language import BaseLanguageModel
from langchain.callbacks.manager import CallbackManagerForChainRun
from langchain.chains.base import Chain
@ -14,6 +13,7 @@ from langchain.chains.llm import LLMChain
from langchain.output_parsers import PydanticOutputParser
from langchain.prompts.prompt import PromptTemplate
from langchain_experimental import pydantic_v1 as pydantic
from langchain_experimental.cpal.constants import Constant
from langchain_experimental.cpal.models import (
CausalModel,

@ -1,3 +1,4 @@
import typing
from importlib import metadata
## Create namespaces for pydantic v1 and v2.
@ -11,11 +12,19 @@ from importlib import metadata
# unambiguously uses either v1 or v2 API.
# * This change is easier to roll out and roll back.
try:
from pydantic.v1 import * # noqa: F403
except ImportError:
# It's currently impossible to support mypy for both pydantic v1 and v2 at once:
# https://github.com/pydantic/pydantic/issues/6022
#
# In the lint environment, pydantic is currently v1.
# When we upgrade it to pydantic v2, we'll need
# to replace this with `from pydantic.v1 import *`.
if typing.TYPE_CHECKING:
from pydantic import * # noqa: F403
else:
try:
from pydantic.v1 import * # noqa: F403
except ImportError:
from pydantic import * # noqa: F403
try:
_PYDANTIC_MAJOR_VERSION: int = int(metadata.version("pydantic").split(".")[0])

@ -1,4 +1,15 @@
try:
from pydantic.v1.dataclasses import * # noqa: F403
except ImportError:
import typing
# It's currently impossible to support mypy for both pydantic v1 and v2 at once:
# https://github.com/pydantic/pydantic/issues/6022
#
# In the lint environment, pydantic is currently v1.
# When we upgrade it to pydantic v2, we'll need to
# replace this with `from pydantic.v1.dataclasses import *`.
if typing.TYPE_CHECKING:
from pydantic.dataclasses import * # noqa: F403
else:
try:
from pydantic.v1.dataclasses import * # noqa: F403
except ImportError:
from pydantic.dataclasses import * # noqa: F403

@ -1,4 +1,15 @@
try:
from pydantic.v1.main import * # noqa: F403
except ImportError:
import typing
# It's currently impossible to support mypy for both pydantic v1 and v2 at once:
# https://github.com/pydantic/pydantic/issues/6022
#
# In the lint environment, pydantic is currently v1.
# When we upgrade it to pydantic v2, we'll need
# to replace this with `from pydantic.v1.main import *`.
if typing.TYPE_CHECKING:
from pydantic.main import * # noqa: F403
else:
try:
from pydantic.v1.main import * # noqa: F403
except ImportError:
from pydantic.main import * # noqa: F403

File diff suppressed because it is too large Load Diff

@ -5,12 +5,12 @@ import unittest
from typing import Type
from unittest import mock
import pydantic
import pytest
from langchain import OpenAI
from langchain.output_parsers import PydanticOutputParser
from langchain.prompts.prompt import PromptTemplate
from langchain_experimental import pydantic_v1 as pydantic
from langchain_experimental.cpal.base import (
CausalChain,
CPALChain,

Loading…
Cancel
Save