pydantic-ai
pydantic-ai copied to clipboard
Stricter docstring usage
We should support explicitly setting the format to use, and raising a warning/error if not all parameters are documented set either on the decorator or on Agent __init__.
Currently we extract descriptions of individual parameters from the docstring by inferring the format of the docstring, then using griffe to pass the docstring.
It would be easy to think you're documenting each parameter, but actually use the wrong format, and it would behave wrongly silently.
We should add two kwargs to the tool decorator, and Tool dataclass:
docstring_format: Literal['google', 'numpy', 'sphinx', 'auto'] = 'auto'require_parameter_descriptions: bool = False