-
Notifications
You must be signed in to change notification settings - Fork 19.2k
Labels
bugRelated to a bug, vulnerability, unexpected error with an existing featureRelated to a bug, vulnerability, unexpected error with an existing feature
Description
Checked other resources
- This is a bug, not a usage question.
- I added a clear and descriptive title that summarizes this issue.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
- This is not related to the langchain-community package.
- I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.
Example Code
The following code:
from langchain_core.tools import tool
Error Message and Stack Trace (if applicable)
Type checker pylance: strict mode) display the error message:
Type of "tool" is partially unknown
Type of "tool" is "Overload[(*, description: str | None = None, return_direct: bool = False, args_schema: type[BaseModel] | dict[str, Any] | None = None, infer_schema: bool = True, response_format: Literal['content', 'content_and_artifact'] = "content", parse_docstring: bool = False, error_on_invalid_docstring: bool = True) -> (((((...) -> Any) | Runnable[Any, Any])) -> BaseTool), (name_or_callable: str, runnable: Runnable[Unknown, Unknown], *, description: str | None = None, return_direct: bool = False, args_schema: type[BaseModel] | dict[str, Any] | None = None, infer_schema: bool = True, response_format: Literal['content', 'content_and_artifact'] = "content", parse_docstring: bool = False, error_on_invalid_docstring: bool = True) -> BaseTool, (name_or_callable: (...) -> Unknown, *, description: str | None = None, return_direct: bool = False, args_schema: type[BaseModel] | dict[str, Any] | None = None, infer_schema: bool = True, response_format: Literal['content', 'content_and_artifact'] = "content", parse_docstring: bool = False, error_on_invalid_docstring: bool = True) -> BaseTool, (name_or_callable: str, *, description: str | None = None, return_direct: bool = False, args_schema: type[BaseModel] | dict[str, Any] | None = None, infer_schema: bool = True, response_format: Literal['content', 'content_and_artifact'] = "content", parse_docstring: bool = False, error_on_invalid_docstring: bool = True) -> (((((...) -> Any) | Runnable[Any, Any])) -> BaseTool)]"Pylance[reportUnknownVariableType](https://github.com/microsoft/pylance-release/blob/main/docs/diagnostics/reportUnknownVariableType.md)
Description
I want to fix the tool decorator function type hints so it does not cause a type error when I import it using strict mode.
System Info
langchain_core: 0.3.69
Metadata
Metadata
Assignees
Labels
bugRelated to a bug, vulnerability, unexpected error with an existing featureRelated to a bug, vulnerability, unexpected error with an existing feature