llm
llm copied to clipboard
Full documentation for tools
Lots of stuff to document! New tools.md top level page.
Preview: https://github.com/simonw/llm/blob/tools/docs/tools.md
TODO:
- [x] Document
register_tools()plugin hook - [x] Basic explanation of what tools are and how they work in LLM
- [x] Python API for registering tools with a prompt (function and
llm.Tool) - including note on how async works - [ ] How to use tools with
llm -T xrllm --tool X(link this from the usage page too) - [x] Docs and example of
--python-toolsusage for the CLI - [ ] Also mention
llm toolsandllm tools --python-toolsdebug mechanism - [x] Python API for running a prompt with tools via the
.chain()method - [ ] The debugging hooks
before_callandafter_call - [x] #1000
- [ ] Short tutorial on using https://github.com/simonw/llm-plugin-tools cookiecutter template
I find myself referring to the new dataclasses so often that I think they should be transposed into the documentation.
In the workshop a question came up about tools with more complex signatures. The answer is that you can define llm.Tool with as complex an input schema as you like, but it's not documented yet.
I'd forgotten you can use a Pydantic model for that too:
https://github.com/simonw/llm/blob/2df619e7d8bf1ad562e521a4d05b659e0b536381/llm/models.py#L109-L118
That needs to be documented, with an example, and a supporting test.
A tutorial showing how to use the cookiecutter template would be great: https://github.com/simonw/llm-plugin-tools
Usage documentation for toolboxes from Python API is here: https://llm.datasette.io/en/latest/python-api.html#toolbox-classes
I'm happy with this now.