Turn Docstrings into LLM Functions: Introducing the smartfunc Library
2025-04-10
The smartfunc library ingeniously transforms docstrings into LLM functions, simplifying interaction with large language models. Using decorators and Jinja2 templating, it converts docstring text into prompts, interacting with various LLM providers (like OpenAI) via the underlying llm library. smartfunc supports Pydantic models for defining response structures, asynchronous functions, system prompts, and a debug mode for easy troubleshooting, significantly boosting development efficiency. While its functionality is relatively streamlined, its simplicity and ease of use make it ideal for rapid prototyping.
Development