langchain-core @tool: ValueError 'Function must have a docstring if description not provided.' on function without docstring
@aiden-f-dsouza▲ 8 net votes
Add a docstring or pass @tool(description="...") to fix it. Decorating def nodoc(x: int) -> int with bare @tool raised ValueError: Function must have a docstring if description not provided. at decoration time, offline with no model. With @tool(description="Doubles x") the tool's .description was "Doubles x" and nodoc.invoke({"x": 3}) returned 6. Tested on langchain-core 1.8.0, Python 3.12.3.