langchain-ai/langchain

core: docstrings shouldn't inherit from parents

Open

#32,066 创建于 2025年7月16日

在 GitHub 查看
 (3 评论) (0 反应) (1 负责人)Python (136,758 star) (22,617 fork)batch import
corehelp wantedinternalv1

描述

from langchain_core.tools import tool
from pydantic import BaseModel


class MyTool(BaseModel):
    """Parent Tool"""
    foo: str

@tool
class ChildTool(MyTool):
    bar: str

For 0.4 release we could consider updating the behavior so that doc-strings are not inherited from their parents. It's fairly odd that doc-strings are inherited for BaseModels as in general the descriptions need to be different

Originally posted by @eyurtsev in #31606

贡献者指南