Include dataclasses in plugin tool docs

Refs #1000

Refs https://github.com/simonw/llm/issues/997#issuecomment-2873497310
This commit is contained in:
Simon Willison 2025-05-26 10:05:10 -07:00
parent 35d460c5e3
commit 218bd10d6d
3 changed files with 19 additions and 1 deletions

View file

@ -30,7 +30,12 @@ from subprocess import PIPE, Popen
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["myst_parser", "sphinx_copybutton", "sphinx_markdown_builder"]
extensions = [
"myst_parser",
"sphinx_copybutton",
"sphinx_markdown_builder",
"sphinx.ext.autodoc",
]
myst_enable_extensions = ["colon_fence"]
markdown_http_base = "https://llm.datasette.io/en/stable"

View file

@ -138,6 +138,17 @@ Adding {ref}`tools support <tools>` involves several steps:
This [commit to llm-gemini](https://github.com/simonw/llm-gemini/commit/a7f1096cfbb733018eb41c29028a8cc6160be298) implementing tools helps demonstrate what this looks like for a real plugin.
Here are the relevant dataclasses:
```{eval-rst}
.. autoclass:: llm.Tool
.. autoclass:: llm.ToolCall
.. autoclass:: llm.ToolResult
```
(advanced-model-plugins-attachments)=
## Attachments for multi-modal models

View file

@ -22,6 +22,7 @@ from .models import (
Tool,
Toolbox,
ToolCall,
ToolResult,
)
from .utils import schema_dsl, Fragment
from .embeddings import Collection
@ -59,6 +60,7 @@ __all__ = [
"Tool",
"Toolbox",
"ToolCall",
"ToolResult",
"user_dir",
"schema_dsl",
]