fix: fixing missing Docstring Bug if no Docstring is provided in BaseModel class (#31608)

- **Description:** Ensure that the tool description is an empty string
when creating a Structured Tool from a Pydantic class in case no
description is provided
- **Issue:** Fixes #31606

---------

Co-authored-by: Mason Daugherty <mason@langchain.dev>
This commit is contained in:
Mohammad Mohtashim
2025-07-16 20:56:05 +05:00
committed by GitHub
parent 15103b0520
commit 96bf8262e2
2 changed files with 14 additions and 1 deletions

View File

@@ -701,6 +701,12 @@ def test_missing_docstring() -> None:
def search_api(query: str) -> str:
return "API result"
@tool
class MyTool(BaseModel):
foo: str
assert MyTool.description == "" # type: ignore[attr-defined]
def test_create_tool_positional_args() -> None:
"""Test that positional arguments are allowed."""