Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 13 additions & 2 deletions .github/workflows/check_diffs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,19 @@ jobs:
echo "Running extended tests, installing dependencies with uv..."
uv venv
uv sync --group test
VIRTUAL_ENV=.venv uv pip install -r extended_testing_deps.txt
VIRTUAL_ENV=.venv make extended_tests
if [ "${{ matrix.job-configs.working-directory }}" = "libs/langchain_v1" ]; then
echo "Installing extended test dependencies for langchain_v1 using dependency groups"
uv sync --group extended_tests
# Run tests directly without make to avoid Docker service requirements in CI
VIRTUAL_ENV=.venv LANGGRAPH_TEST_FAST=0 uv run --group test pytest --disable-socket --allow-unix-socket --only-extended tests/unit_tests
elif [ -f "extended_testing_deps.txt" ]; then
echo "Installing extended test dependencies from file"
VIRTUAL_ENV=.venv uv pip install -r extended_testing_deps.txt
VIRTUAL_ENV=.venv make extended_tests
else
echo "No extended test dependencies found, running make extended_tests"
VIRTUAL_ENV=.venv make extended_tests
fi

- name: "🧹 Verify Clean Working Directory"
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion libs/core/langchain_core/tools/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def search_api(query: str) -> tuple[str, dict]:
return "partial json of results", {"full": "object of results"}
```

!!! version-added "Added in version 0.2.14"
.. versionadded:: 0.2.14

Parse Google-style docstrings:

Expand Down
49 changes: 49 additions & 0 deletions libs/core/tests/unit_tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,55 @@ def search_api(query: str) -> str:
assert search_api.invoke("test") == "API result"


def test_tool_decorator_type_annotations() -> None:
"""Test that tool decorator has proper type annotations for strict type checking."""
# This test verifies the fix for GitHub issue #33019
# Previously, importing tool in strict Pylance mode would show:
# "Type of 'tool' is partially unknown"

# Test basic decorator usage
@tool
def basic_tool(query: str) -> str:
"""Basic tool."""
return query

# Test decorator with custom name
@tool("custom_name")
def named_tool(x: int) -> str:
"""Named tool."""
return str(x)

# Test decorator with keyword arguments
@tool(description="Custom description")
def described_tool(value: float) -> str:
"""Described tool."""
return str(value)

# Test direct function conversion
def raw_func(data: str) -> str:
"""Raw function."""
return data

direct_tool = tool(raw_func)

# Verify all tools are created correctly
assert isinstance(basic_tool, BaseTool)
assert isinstance(named_tool, BaseTool)
assert isinstance(described_tool, BaseTool)
assert isinstance(direct_tool, BaseTool)

assert basic_tool.name == "basic_tool"
assert named_tool.name == "custom_name"
assert described_tool.name == "described_tool"
assert direct_tool.name == "raw_func"

# Test descriptions
assert basic_tool.description == "Basic tool."
assert named_tool.description == "Named tool."
assert described_tool.description == "Custom description"
assert direct_tool.description == "Raw function."


class _MockSchema(BaseModel):
"""Return the arguments directly."""

Expand Down
5 changes: 0 additions & 5 deletions libs/langchain_v1/extended_testing_deps.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def wrap_model_call(
try:
from langchain_anthropic import ChatAnthropic
except ImportError:
ChatAnthropic = None # noqa: N806
from typing import Any
ChatAnthropic: Any = None # type: ignore[no-redef] # noqa: N806

msg: str | None = None

Expand Down
10 changes: 10 additions & 0 deletions libs/langchain_v1/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ test = [
"langchain-text-splitters",
"langchain-openai"
]
extended_tests = [
"langchain-anthropic",
"langchain-fireworks",
"langchain-mistralai",
"langchain-groq"
]
lint = [
"ruff>=0.12.2,<0.13.0",
]
Expand All @@ -85,6 +91,10 @@ langchain-core = { path = "../core", editable = true }
langchain-tests = { path = "../standard-tests", editable = true }
langchain-text-splitters = { path = "../text-splitters", editable = true }
langchain-openai = { path = "../partners/openai", editable = true }
langchain-anthropic = { path = "../partners/anthropic", editable = true }
langchain-fireworks = { path = "../partners/fireworks", editable = true }
langchain-mistralai = { path = "../partners/mistralai", editable = true }
langchain-groq = { path = "../partners/groq", editable = true }

[tool.ruff]
exclude = ["tests/integration_tests/examples/non-utf8-encoding.py"]
Expand Down
156 changes: 133 additions & 23 deletions libs/langchain_v1/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading