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

community[patch]: Skip broken unit test that depends on langchain-aws in env, fix pydantic_settings #26110

Closed
wants to merge 88 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 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
508c7a1
x
eyurtsev Sep 5, 2024
f48f80a
Fix unit test
eyurtsev Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 8 additions & 1 deletion .github/scripts/check_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"libs/experimental",
]

# for 0.3rc, we are ignoring core dependents
# in order to be able to get CI to pass for individual PRs.
IGNORE_CORE_DEPENDENTS = True

# ignored partners are removed from dependents
# but still run if directly edited
IGNORED_PARTNERS = [
Expand Down Expand Up @@ -104,7 +108,7 @@ def _get_configs_for_single_dir(job: str, dir_: str) -> List[Dict[str, str]]:
{"working-directory": dir_, "python-version": f"3.{v}"}
for v in range(8, 13)
]
min_python = "3.8"
min_python = "3.9"
max_python = "3.12"

# custom logic for specific directories
Expand Down Expand Up @@ -184,6 +188,9 @@ def _get_configs_for_multi_dirs(
# for extended testing
found = False
for dir_ in LANGCHAIN_DIRS:
if dir_ == "libs/core" and IGNORE_CORE_DEPENDENTS:
dirs_to_run["extended-test"].add(dir_)
continue
if file.startswith(dir_):
found = True
if found:
Expand Down
114 changes: 0 additions & 114 deletions .github/workflows/_dependencies.yml

This file was deleted.

15 changes: 1 addition & 14 deletions .github/workflows/check_diffs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,6 @@ jobs:
python-version: ${{ matrix.job-configs.python-version }}
secrets: inherit

dependencies:
name: cd ${{ matrix.job-configs.working-directory }}
needs: [ build ]
if: ${{ needs.build.outputs.dependencies != '[]' }}
strategy:
matrix:
job-configs: ${{ fromJson(needs.build.outputs.dependencies) }}
uses: ./.github/workflows/_dependencies.yml
with:
working-directory: ${{ matrix.job-configs.working-directory }}
python-version: ${{ matrix.job-configs.python-version }}
secrets: inherit

extended-tests:
name: "cd ${{ matrix.job-configs.working-directory }} / make extended_tests #${{ matrix.job-configs.python-version }}"
needs: [ build ]
Expand Down Expand Up @@ -149,7 +136,7 @@ jobs:
echo "$STATUS" | grep 'nothing to commit, working tree clean'
ci_success:
name: "CI Success"
needs: [build, lint, test, compile-integration-tests, dependencies, extended-tests, test-doc-imports]
needs: [build, lint, test, compile-integration-tests, extended-tests, test-doc-imports]
if: |
always()
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scheduled_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.11"
working-directory:
- "libs/partners/openai"
Expand Down
3 changes: 3 additions & 0 deletions libs/cli/langchain_cli/integration_template/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ integration_test integration_tests: TEST_FILE = tests/integration_tests/
test tests:
poetry run pytest --disable-socket --allow-unix-socket $(TEST_FILE)

test_watch:
poetry run ptw --snapshot-update --now . -- -vv $(TEST_FILE)

# integration tests are run without the --disable-socket flag to allow network calls
integration_test integration_tests:
poetry run pytest $(TEST_FILE)
Expand Down
1 change: 1 addition & 0 deletions libs/cli/langchain_cli/integration_template/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pytest = "^7.4.3"
pytest-asyncio = "^0.23.2"
pytest-socket = "^0.7.0"
langchain-core = { path = "../../core", develop = true }
pytest-watcher = "^0.3.4"

[tool.poetry.group.codespell]
optional = true
Expand Down
3 changes: 1 addition & 2 deletions libs/community/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ integration_tests:
poetry run pytest $(TEST_FILE)

test_watch:
poetry run ptw --disable-socket --allow-unix-socket --snapshot-update --now . -- -vv -x tests/unit_tests
poetry run ptw --disable-socket --allow-unix-socket --snapshot-update --now . -- -vv tests/unit_tests

check_imports: $(shell find langchain_community -name '*.py')
poetry run python ./scripts/check_imports.py $^
Expand All @@ -45,7 +45,6 @@ lint_tests: PYTHON_FILES=tests
lint_tests: MYPY_CACHE=.mypy_cache_test

lint lint_diff lint_package lint_tests:
./scripts/check_pydantic.sh .
./scripts/lint_imports.sh .
./scripts/check_pickle.sh .
[ "$(PYTHON_FILES)" = "" ] || poetry run ruff check $(PYTHON_FILES)
Expand Down
2 changes: 1 addition & 1 deletion libs/community/langchain_community/adapters/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
SystemMessage,
ToolMessage,
)
from langchain_core.pydantic_v1 import BaseModel
from pydantic import BaseModel
from typing_extensions import Literal


Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import annotations

from typing import TYPE_CHECKING, List, Literal, Optional
from typing import TYPE_CHECKING, Any, List, Literal, Optional

from langchain_core.pydantic_v1 import root_validator
from langchain_core.tools import BaseTool
from langchain_core.tools.base import BaseToolkit
from pydantic import ConfigDict, model_validator

from langchain_community.tools.ainetwork.app import AINAppOps
from langchain_community.tools.ainetwork.owner import AINOwnerOps
Expand Down Expand Up @@ -36,8 +36,9 @@ class AINetworkToolkit(BaseToolkit):
network: Optional[Literal["mainnet", "testnet"]] = "testnet"
interface: Optional[Ain] = None

@root_validator(pre=True)
def set_interface(cls, values: dict) -> dict:
@model_validator(mode="before")
@classmethod
def set_interface(cls, values: dict) -> Any:
"""Set the interface if not provided.

If the interface is not provided, attempt to authenticate with the
Expand All @@ -53,9 +54,10 @@ def set_interface(cls, values: dict) -> dict:
values["interface"] = authenticate(network=values.get("network", "testnet"))
return values

class Config:
arbitrary_types_allowed = True
validate_all = True
model_config = ConfigDict(
arbitrary_types_allowed=True,
validate_all=True,
)

def get_tools(self) -> List[BaseTool]:
"""Get the tools in the toolkit."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from typing import TYPE_CHECKING, List, Optional

from langchain_core.language_models import BaseLanguageModel
from langchain_core.pydantic_v1 import Field
from langchain_core.tools import BaseTool
from langchain_core.tools.base import BaseToolkit
from pydantic import ConfigDict, Field

from langchain_community.tools.amadeus.closest_airport import AmadeusClosestAirport
from langchain_community.tools.amadeus.flight_search import AmadeusFlightSearch
Expand All @@ -26,8 +26,9 @@ class AmadeusToolkit(BaseToolkit):
client: Client = Field(default_factory=authenticate)
llm: Optional[BaseLanguageModel] = Field(default=None)

class Config:
arbitrary_types_allowed = True
model_config = ConfigDict(
arbitrary_types_allowed=True,
)

def get_tools(self) -> List[BaseTool]:
"""Get the tools in the toolkit."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from typing import List

from langchain_core.pydantic_v1 import Field
from langchain_core.tools import BaseTool
from langchain_core.tools.base import BaseToolkit
from pydantic import ConfigDict, Field

from langchain_community.tools.cassandra_database.tool import (
GetSchemaCassandraDatabaseTool,
Expand All @@ -24,8 +24,9 @@ class CassandraDatabaseToolkit(BaseToolkit):

db: CassandraDatabase = Field(exclude=True)

class Config:
arbitrary_types_allowed = True
model_config = ConfigDict(
arbitrary_types_allowed=True,
)

def get_tools(self) -> List[BaseTool]:
"""Get the tools in the toolkit."""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import List
from typing import Any, List

from langchain_core.pydantic_v1 import root_validator
from langchain_core.tools import BaseTool
from langchain_core.tools.base import BaseToolkit
from pydantic import model_validator

from langchain_community.tools.connery import ConneryService

Expand All @@ -23,8 +23,9 @@ def get_tools(self) -> List[BaseTool]:
"""
return self.tools

@root_validator(pre=True)
def validate_attributes(cls, values: dict) -> dict:
@model_validator(mode="before")
@classmethod
def validate_attributes(cls, values: dict) -> Any:
"""
Validate the attributes of the ConneryToolkit class.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import annotations

from typing import Dict, List, Optional, Type
from typing import Any, Dict, List, Optional, Type

from langchain_core.pydantic_v1 import root_validator
from langchain_core.tools import BaseTool, BaseToolkit
from langchain_core.utils.pydantic import get_fields
from pydantic import model_validator

from langchain_community.tools.file_management.copy import CopyFileTool
from langchain_community.tools.file_management.delete import DeleteFileTool
Expand Down Expand Up @@ -63,8 +63,9 @@ class FileManagementToolkit(BaseToolkit):
selected_tools: Optional[List[str]] = None
"""If provided, only provide the selected tools. Defaults to all."""

@root_validator(pre=True)
def validate_tools(cls, values: dict) -> dict:
@model_validator(mode="before")
@classmethod
def validate_tools(cls, values: dict) -> Any:
selected_tools = values.get("selected_tools") or []
for tool_name in selected_tools:
if tool_name not in _FILE_TOOLS_MAP:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from typing import List

from langchain_core.pydantic_v1 import Field
from langchain_core.tools import BaseTool
from langchain_core.tools.base import BaseToolkit
from pydantic import ConfigDict, Field

from langchain_community.tools.financial_datasets.balance_sheets import BalanceSheets
from langchain_community.tools.financial_datasets.cash_flow_statements import (
Expand All @@ -31,8 +31,9 @@ def __init__(self, api_wrapper: FinancialDatasetsAPIWrapper):
super().__init__()
self.api_wrapper = api_wrapper

class Config:
arbitrary_types_allowed = True
model_config = ConfigDict(
arbitrary_types_allowed=True,
)

def get_tools(self) -> List[BaseTool]:
"""Get the tools in the toolkit."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from typing import Dict, List

from langchain_core.pydantic_v1 import BaseModel, Field
from langchain_core.tools import BaseTool
from langchain_core.tools.base import BaseToolkit
from pydantic import BaseModel, Field

from langchain_community.tools.github.prompt import (
COMMENT_ON_ISSUE_PROMPT,
Expand Down
Loading
Loading