Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eugene/v0.3 wut #26233

Closed
wants to merge 115 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
8590b42
infra: ignore core dependents for 0.3rc (#25980)
efriis Sep 3, 2024
5a0e82c
infra: fix 0.3rc ci check (#25988)
efriis Sep 3, 2024
ae5a574
core[major]: Upgrade langchain-core to pydantic 2 (#25986)
eyurtsev Sep 3, 2024
29413a2
infra: also run lint/test on rc (#25992)
efriis Sep 3, 2024
0da201c
core: fix lint 0.3rc (#25993)
efriis Sep 3, 2024
8e4bae3
core[major]: Drop python 3.8 support (#25996)
eyurtsev Sep 3, 2024
91e09ff
merge master (#25997)
baskaryan Sep 3, 2024
241b6d2
Revert "merge master (#25997)" (#25998)
baskaryan Sep 3, 2024
9a9ab65
merge master correctly (#25999)
baskaryan Sep 3, 2024
615f8b0
openai[major]: switch to pydantic v2
baskaryan Sep 3, 2024
5f5287c
fmt
baskaryan Sep 3, 2024
6777106
fmt
baskaryan Sep 3, 2024
5fc1104
fmt
baskaryan Sep 3, 2024
9399df7
fmt
baskaryan Sep 3, 2024
ec9e8eb
fmt
baskaryan Sep 4, 2024
559d8a4
fireworks[major]: switch to pydantic v2
baskaryan Sep 4, 2024
6aac2ee
fmt
baskaryan Sep 4, 2024
5616348
fmt
baskaryan Sep 4, 2024
02f8720
standard-tests[major]: use pydantic v2
baskaryan Sep 4, 2024
2c742cc
standard-tests[major]: use pydantic v2 (#26005)
baskaryan Sep 4, 2024
99348e1
Merge branch 'v0.3rc' into bagatur/openai_attempt_2
baskaryan Sep 4, 2024
6ad515d
Merge branch 'v0.3rc' into bagatur/fireworks_0.3
baskaryan Sep 4, 2024
954abcc
infra: remove pydantic v1 tests
baskaryan Sep 4, 2024
0529c99
rm
baskaryan Sep 4, 2024
5f98975
core[patch]: Fix injected args in tool signature (#25991)
eyurtsev Sep 4, 2024
a976f20
Merge branch 'v0.3rc' into bagatur/rm_pydantic_v1_ci
baskaryan Sep 4, 2024
dd4418a
rm requires
baskaryan Sep 4, 2024
2888e34
infra: remove pydantic v1 tests (#26006)
baskaryan Sep 4, 2024
b787645
Merge branch 'v0.3rc' into bagatur/openai_attempt_2
baskaryan Sep 4, 2024
5ad2b8c
Merge branch 'v0.3rc' into bagatur/fireworks_0.3
baskaryan Sep 4, 2024
a91bd27
Update libs/partners/fireworks/langchain_fireworks/chat_models.py
baskaryan Sep 4, 2024
d0cc9b0
Update libs/partners/fireworks/langchain_fireworks/chat_models.py
baskaryan Sep 4, 2024
49a1f5d
Update libs/partners/openai/langchain_openai/chat_models/azure.py
baskaryan Sep 4, 2024
5e31cd9
Update libs/partners/openai/langchain_openai/chat_models/azure.py
baskaryan Sep 4, 2024
5199555
Update libs/partners/openai/langchain_openai/chat_models/base.py
baskaryan Sep 4, 2024
78c454c
Update libs/partners/openai/langchain_openai/chat_models/base.py
baskaryan Sep 4, 2024
d072d59
Update libs/partners/openai/langchain_openai/embeddings/azure.py
baskaryan Sep 4, 2024
179aaa4
Update libs/partners/openai/langchain_openai/embeddings/azure.py
baskaryan Sep 4, 2024
c0448f2
Update libs/partners/openai/langchain_openai/embeddings/base.py
baskaryan Sep 4, 2024
76572f9
Update libs/partners/openai/langchain_openai/embeddings/base.py
baskaryan Sep 4, 2024
78468de
Update libs/partners/openai/langchain_openai/llms/azure.py
baskaryan Sep 4, 2024
54d6808
Update libs/partners/openai/langchain_openai/llms/azure.py
baskaryan Sep 4, 2024
c1ff616
Update libs/partners/openai/langchain_openai/llms/base.py
baskaryan Sep 4, 2024
4c7afb0
Update libs/partners/openai/langchain_openai/llms/base.py
baskaryan Sep 4, 2024
f9d91e1
fireworks[major]: switch to pydantic v2 (#26004)
baskaryan Sep 4, 2024
5adeaf0
openai[major]: switch to pydantic v2 (#26001)
baskaryan Sep 4, 2024
b27bfa6
pinecone[major]: Update to pydantic v2
baskaryan Sep 4, 2024
88065d7
fmt
baskaryan Sep 4, 2024
4799ad9
core[patch]: remove warnings from protected namespaces on RunnableSer…
ccurme Sep 4, 2024
7cee7fb
mistralai: update pydantic (#25995)
ccurme Sep 4, 2024
163d6fe
anthropic: update pydantic (#26000)
ccurme Sep 4, 2024
51c6899
groq[major]: upgrade pydantic (#26036)
ccurme Sep 4, 2024
be7cd07
ollama[major]: upgrade pydantic (#26044)
ccurme Sep 4, 2024
f785cf0
pinecone[major]: Update to pydantic v2 (#26039)
baskaryan Sep 4, 2024
63ba12d
milvus: drop support for python 3.8 (#26051)
ccurme Sep 4, 2024
ed771f2
huggingface[major]: upgrade pydantic (#26048)
ccurme Sep 4, 2024
0a6c67c
nomic: drop support for python 3.8 (#26055)
ccurme Sep 4, 2024
efa10c8
core[minor]: Add message chunks to AnyMessage (#26057)
eyurtsev Sep 4, 2024
b924c61
qdrant[major]: drop support for python 3.8 (#26061)
ccurme Sep 4, 2024
1d2a503
standard-tests[patch]: add Ser/Des test
baskaryan Sep 4, 2024
40634d4
make
baskaryan Sep 4, 2024
e409a85
fmt
baskaryan Sep 4, 2024
c88b75c
fmt
baskaryan Sep 4, 2024
caf4ae3
fmt
baskaryan Sep 4, 2024
5557b86
fmt
baskaryan Sep 4, 2024
7f0dd4b
fmt
baskaryan Sep 4, 2024
88e9e6b
core,standard-tests[patch]: add Ser/Des test and update serialization…
baskaryan Sep 4, 2024
1fce554
poetry lock
baskaryan Sep 4, 2024
f9cafcb
pinecone[patch]: rm pydantic lint script (#26052)
baskaryan Sep 4, 2024
c72a762
cherry-pick 88e9e6b (#26063)
baskaryan Sep 4, 2024
9379613
langchain[major]: Upgrade langchain to be pydantic 2 compatible (#26050)
eyurtsev Sep 4, 2024
923ce84
robocorp[major]: upgrade pydantic (#26062)
ccurme Sep 4, 2024
567a4ce
box[major]: use pydantic v2 (#26067)
baskaryan Sep 4, 2024
fd1f3ca
exa[major]: use pydantic v2 (#26069)
baskaryan Sep 4, 2024
6e85350
voyageai[major]: upgrade pydantic (#26070)
ccurme Sep 4, 2024
c5d4dfe
prompty[major]: upgrade pydantic (#26056)
ccurme Sep 4, 2024
79c4631
couchbase[patch]: rm pydantic usage (#26068)
baskaryan Sep 4, 2024
e5aa0f9
mongo[major]: upgrade pydantic (#26053)
ccurme Sep 5, 2024
3c598d2
core[minor]: Add get_input_jsonschema, get_output_jsonschema, get_con…
eyurtsev Sep 5, 2024
e358846
core[patch]: add bedrock to load.mapping (#26094)
ccurme Sep 5, 2024
8da2ace
openai[patch]: update snapshots (#26098)
baskaryan Sep 5, 2024
a267da6
core[minor]: Add type overload for secret_from_env factory (#26091)
eyurtsev Sep 5, 2024
1c51e16
core[patch]: Fix issue with adapter utility for pydantic repr (#26099)
eyurtsev Sep 5, 2024
76564ed
openai[patch]: update configurable model dumps (#26101)
baskaryan Sep 5, 2024
1ad66e7
text-splitters[major]: update core dep + drop support for python 3.8 …
ccurme Sep 5, 2024
8516a03
langchain-community[major]: Upgrade community to pydantic 2 (#26011)
hwchase17 Sep 5, 2024
9e72226
core: reduce warnings (#26108)
ccurme Sep 5, 2024
a111098
community[patch]: Remove usage of deprecated pydantic config option (…
eyurtsev Sep 5, 2024
6e1b0d0
community[patch]: Skip unit test that depends on langchain-aws and fi…
eyurtsev Sep 5, 2024
0cc6584
community[patch]: Resolve more linting issues (#26115)
eyurtsev Sep 5, 2024
e02b093
community[patch]: Fix more issues (#26116)
eyurtsev Sep 5, 2024
5bbd536
core[patch]: call RunnableConfigurableFields.model_rebuild() (#26118)
ccurme Sep 5, 2024
1ecaffa
core[patch]: Fix regression in core (#26121)
eyurtsev Sep 5, 2024
f4e7cb3
core[patch]: Ignore pydantic deprecation warnings in validate_argumen…
eyurtsev Sep 5, 2024
6fd4ac4
core[patch]: Replace @validator with @model_validator in length based…
eyurtsev Sep 5, 2024
40b43b0
core[patch]: Remove some usage of .copy() in favor of .model_copy() (…
eyurtsev Sep 5, 2024
776d01d
infra: remove fail fast in v0.3rc branch (#26127)
efriis Sep 6, 2024
8a3a9c8
core[patch]: concrete prompt value test (#26128)
baskaryan Sep 6, 2024
b74546a
core[patch]: add google genai to serialization (#26154)
ccurme Sep 6, 2024
1b77063
openai[patch]: set protected namespaces on embeddings (#26155)
ccurme Sep 6, 2024
c27703a
core[patch]: resolve warnings (#26157)
ccurme Sep 6, 2024
81f8c2f
infra: add pydantic to min version testing (#26152)
efriis Sep 6, 2024
ae24f73
multiple: version bumps (#26159)
efriis Sep 6, 2024
6405e7f
infra: ignore docs build in v0.3rc branch (#25990)
efriis Sep 6, 2024
bccc546
v0.3 dev releases (#26096)
baskaryan Sep 6, 2024
b664b33
multiple: merge master into v0.3rc branch (#26163)
efriis Sep 6, 2024
6df9360
core[patch]: remove v1_repr (#26165)
baskaryan Sep 6, 2024
b2c8f2d
core[patch]: fix ChatPromptValueConcrete typing (#26106)
baskaryan Sep 6, 2024
b2ba4f4
core[patch]: fix deprecated pydantic code (#26161)
baskaryan Sep 6, 2024
61087b0
core[patch]: Fix changes to pydantic schema due to pydantic 2.8.2 -> …
eyurtsev Sep 6, 2024
15466d8
infra: core remove 3.8 (#26172)
efriis Sep 6, 2024
9f482f4
cherry langsmith cache fix (#26169)
baskaryan Sep 6, 2024
6e2a72c
core[patch]: Add missing cache for create_model (#26173)
eyurtsev Sep 6, 2024
0319ccd
core[patch]: only support pydantic >= 2.9 for now (#26176)
eyurtsev Sep 6, 2024
760ce59
qxqxqx
eyurtsev Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -16,10 +16,10 @@
)
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.pydantic_v1 import BaseModel, Field
from langchain_core.tools import tool
from pydantic import BaseModel as RawBaseModel
from pydantic import Field as RawField
from pydantic import BaseModel, Field
from pydantic.v1 import BaseModel as BaseModelV1
from pydantic.v1 import Field as FieldV1

from langchain_standard_tests.unit_tests.chat_models import (
ChatModelTests,
@@ -28,8 +28,8 @@
from langchain_standard_tests.utils.pydantic import PYDANTIC_MAJOR_VERSION


class MagicFunctionSchema(RawBaseModel):
input: int = RawField(..., gt=-1000, lt=1000)
class MagicFunctionSchema(BaseModel):
input: int = Field(..., gt=-1000, lt=1000)


@tool(args_schema=MagicFunctionSchema)
@@ -240,14 +240,11 @@ def test_structured_output(self, model: BaseChatModel) -> None:
if not self.has_tool_calling:
pytest.skip("Test requires tool calling.")

from pydantic import BaseModel as BaseModelProper
from pydantic import Field as FieldProper

class Joke(BaseModelProper):
class Joke(BaseModel):
"""Joke to tell user."""

setup: str = FieldProper(description="question to set up a joke")
punchline: str = FieldProper(description="answer to resolve the joke")
setup: str = Field(description="question to set up a joke")
punchline: str = Field(description="answer to resolve the joke")

# Pydantic class
# Type ignoring since the interface only officially supports pydantic 1
@@ -280,11 +277,11 @@ def test_structured_output_pydantic_2_v1(self, model: BaseChatModel) -> None:
if not self.has_tool_calling:
pytest.skip("Test requires tool calling.")

class Joke(BaseModel): # Uses langchain_core.pydantic_v1.BaseModel
class Joke(BaseModelV1): # Uses langchain_core.pydantic_v1.BaseModel
"""Joke to tell user."""

setup: str = Field(description="question to set up a joke")
punchline: str = Field(description="answer to resolve the joke")
setup: str = FieldV1(description="question to set up a joke")
punchline: str = FieldV1(description="answer to resolve the joke")

# Pydantic class
chat = model.with_structured_output(Joke)
@@ -439,7 +436,7 @@ def test_anthropic_inputs(self, model: BaseChatModel) -> None:
if not self.supports_anthropic_inputs:
return

class color_picker(BaseModel):
class color_picker(BaseModelV1):
"""Input your fav color and get a random fact about it."""

fav_color: str
Original file line number Diff line number Diff line change
@@ -9,6 +9,15 @@
from langchain_core.runnables import RunnableBinding
from langchain_core.tools import tool
from pydantic import BaseModel, Field, SecretStr
from pydantic.v1 import (
BaseModel as BaseModelV1,
)
from pydantic.v1 import (
Field as FieldV1,
)
from pydantic.v1 import (
ValidationError as ValidationErrorV1,
)

from langchain_standard_tests.base import BaseStandardTests
from langchain_standard_tests.utils.pydantic import PYDANTIC_MAJOR_VERSION
@@ -25,27 +34,24 @@ def generate_schema_pydantic_v1_from_2() -> Any:
"""Use to generate a schema from v1 namespace in pydantic 2."""
if PYDANTIC_MAJOR_VERSION != 2:
raise AssertionError("This function is only compatible with Pydantic v2.")
from pydantic.v1 import BaseModel, Field

class PersonB(BaseModel):
class PersonB(BaseModelV1):
"""Record attributes of a person."""

name: str = Field(..., description="The name of the person.")
age: int = Field(..., description="The age of the person.")
name: str = FieldV1(..., description="The name of the person.")
age: int = FieldV1(..., description="The age of the person.")

return PersonB


def generate_schema_pydantic() -> Any:
"""Works with either pydantic 1 or 2"""
from pydantic import BaseModel as BaseModelProper
from pydantic import Field as FieldProper

class PersonA(BaseModelProper):
class PersonA(BaseModel):
"""Record attributes of a person."""

name: str = FieldProper(..., description="The name of the person.")
age: int = FieldProper(..., description="The age of the person.")
name: str = Field(..., description="The name of the person.")
age: int = Field(..., description="The age of the person.")

return PersonA

@@ -199,9 +205,7 @@ def test_with_structured_output(
assert model.with_structured_output(schema) is not None

def test_standard_params(self, model: BaseChatModel) -> None:
from langchain_core.pydantic_v1 import BaseModel, ValidationError

class ExpectedParams(BaseModel):
class ExpectedParams(BaseModelV1):
ls_provider: str
ls_model_name: str
ls_model_type: Literal["chat"]
@@ -212,7 +216,7 @@ class ExpectedParams(BaseModel):
ls_params = model._get_ls_params()
try:
ExpectedParams(**ls_params)
except ValidationError as e:
except ValidationErrorV1 as e:
pytest.fail(f"Validation error: {e}")

# Test optional params
@@ -222,5 +226,5 @@ class ExpectedParams(BaseModel):
ls_params = model._get_ls_params()
try:
ExpectedParams(**ls_params)
except ValidationError as e:
except ValidationErrorV1 as e:
pytest.fail(f"Validation error: {e}")