Simon Willison
a87e4505ff
Remove obsolete details: mechanism from ChainResults, closes #1087
2025-05-25 22:43:45 -07:00
Simon Willison
bb336d33a0
Toolbox class for class-based tool collections ( #1086 )
...
* Toolbox class for class-based tool collections
Refs #1059 , #1058 , #1057
2025-05-25 22:42:52 -07:00
Arjan Mossel
5d6f96a908
Provide response_json type hint ( #1077 )
2025-05-24 13:46:36 -07:00
Simon Willison
36477cf9e5
llm chat -c and llm -c carry forward tools, closes #1020
2025-05-23 21:10:51 -07:00
Simon Willison
d2886d4692
Record which plugin a tool came from, including in DB - refs #1020
2025-05-23 15:44:12 -07:00
Simon Willison
3e3492898c
Conversations using tools in Python API
...
Refs #1033
2025-05-21 23:05:16 -07:00
Simon Willison
e172e9e52d
Clean up one more comment
2025-05-21 21:42:46 -07:00
Simon Willison
3cb875fa3d
Async tool support ( #1063 )
...
* Sync models can now call async tools, refs #987
* Test for async tool functions in sync context, refs #987
* Test for asyncio tools, plus test that they run in parallel
* Docs for async tool usage
2025-05-21 21:42:19 -07:00
Simon Willison
bd2180df7d
llm chat --tool and --functions ( #1062 )
...
* Tool support for llm chat, closes #1004
2025-05-20 21:30:27 -07:00
Simon Willison
2df619e7d8
--chain-limit option, closes #1025
2025-05-13 21:52:39 -04:00
Simon Willison
c81f0560e0
Fixed remaining mypy problems, refs #1023
...
Refs https://github.com/simonw/llm/pull/996#issuecomment-2878191352
2025-05-13 17:19:30 -07:00
Simon Willison
96f910bb30
Fix for TypeError: 'coroutine' object is not iterable
2025-05-13 17:19:30 -07:00
Simon Willison
a029e0b70c
AsyncModel.chain() raises NotImplementedError, closes #1021
2025-05-13 17:19:30 -07:00
Simon Willison
5ae20bd549
Guard against chunk=None from models
...
Bug that I encountered while working on #1019
2025-05-13 17:19:30 -07:00
Simon Willison
1efb14f294
Upgrade condense-json
...
Refs https://github.com/simonw/llm/issues/1003#issuecomment-2873322525
Refs https://github.com/simonw/condense-json/issues/5
2025-05-13 17:19:30 -07:00
Simon Willison
a50de8b57a
ChainResponse.log_to_db() method and test, refs #1017 , #1003
2025-05-13 17:19:30 -07:00
Simon Willison
5162cabbe1
First test for tools, plus vcr+syrupy, refs #1017
2025-05-13 17:19:30 -07:00
Simon Willison
9650c5de10
Removed obsolete details() method, closes #1007
2025-05-13 17:19:30 -07:00
Simon Willison
e319069503
Initial implementation of --td and --ta, refs #1005
...
Uses new mechanism from #1007
2025-05-13 17:19:30 -07:00
Simon Willison
ea4df34563
New response.excute_tool_calls(), refs #1007
2025-05-13 17:19:30 -07:00
Simon Willison
387f89d88b
Load tool stuff from database, refs #1010
2025-05-13 17:19:30 -07:00
Simon Willison
db642d3013
Ensure all responses have a ULID
2025-05-13 17:19:30 -07:00
Simon Willison
f994196b32
tool_calls_or_raise()
...
Refs #992 , #998 , #999
2025-05-13 17:19:30 -07:00
Simon Willison
32cab986ea
Log tool stuff to the database, refs #1003
2025-05-13 17:19:30 -07:00
Simon Willison
4ae6d45f3a
First working prototype of llm -T toolname
...
Refs https://github.com/simonw/llm/issues/990#issuecomment-2870630946
2025-05-13 17:19:30 -07:00
Simon Willison
8a3c461e46
model.chain() method, tools=[func1, func2]
...
Also fixed mypy errors, but had to drop AsyncResponse for the moment.
Refs https://github.com/simonw/llm/issues/937#issuecomment-2870479021
2025-05-13 17:19:30 -07:00
Simon Willison
619daa6ff2
.chain().details() debug method
...
https://github.com/simonw/llm/issues/937#issuecomment-2870465951
2025-05-13 17:19:30 -07:00
Simon Willison
7dbf0b8586
Got a tool call to run through OpenAI
...
Refs https://github.com/simonw/llm/issues/937#issuecomment-2870434157
2025-05-13 17:19:30 -07:00
Simon Willison
c0ef4f4da1
Enforce chain limit of 5
...
Refs https://github.com/simonw/llm/issues/937#issuecomment-2870390330
2025-05-13 17:19:30 -07:00
Simon Willison
3b37854c26
Initial Conversation.chain() and ChainResponse
...
Refs https://github.com/simonw/llm/issues/937#issuecomment-2870365809
2025-05-13 17:19:30 -07:00
Simon Willison
c990578934
ToolCall.tool_call_id property, refs #937
2025-05-13 17:19:30 -07:00
Simon Willison
290c311ce1
prompt.tools and prompt.tool_results no longer optional
...
They will always be at least an empty list
2025-05-13 17:19:30 -07:00
Simon Willison
7e574e59b7
Prompt.tool_results property
...
Refs https://github.com/simonw/llm/issues/937#issuecomment-2869124983
2025-05-13 17:19:30 -07:00
Simon Willison
6ad5e7936f
ToolResult dataclass
...
Refs https://github.com/simonw/llm/issues/937#issuecomment-2869123620
2025-05-13 17:19:30 -07:00
Simon Willison
8b57c2b226
Dropped Tool.output_schema
...
Refs https://github.com/simonw/llm/issues/935#issuecomment-2869120546
2025-05-13 17:19:30 -07:00
Simon Willison
8c2393f909
Stash function in tool.implementation
...
Refs https://github.com/simonw/llm/issues/935#issuecomment-2869084490
2025-05-13 17:19:30 -07:00
Simon Willison
5aac6b76f0
response.tool_calls() methods
...
Refs https://github.com/simonw/llm/issues/936#issuecomment-2869082672
2025-05-13 17:19:30 -07:00
Simon Willison
7b450c8215
Response.add_tool_call() method and ToolCall class
...
Refs https://github.com/simonw/llm/issues/936#issuecomment-2869064678
2025-05-13 17:19:30 -07:00
Simon Willison
84ab4cd409
supports_tools Model property, Tool.function(..., name=) option
...
Refs https://github.com/simonw/llm/issues/935#issuecomment-2869042481
2025-05-13 17:19:30 -07:00
Simon Willison
fc76048b37
Pass tools around a bit
...
Refs https://github.com/simonw/llm/issues/935#issuecomment-2869032532
2025-05-13 17:19:30 -07:00
Simon Willison
51e2c714d1
WIP Tool definition class
...
Refs https://github.com/simonw/llm/issues/935#issuecomment-2869002227
2025-05-13 17:19:30 -07:00
Simon Willison
f740a5cbbd
Fragments ( #859 )
...
* WIP fragments: schema plus reading but not yet writing, refs #617
* Unique index on fragments.alias, refs #617
* Fragments are now persisted, added basic CLI commands
* Fragment aliases work now, refs #617
* Improved help for -f/--fragment
* Support fragment hash as well
* Documentation for fragments
* Better non-JSON display of llm fragments list
* llm fragments -q search option
* _truncate_string is now truncate_string
* Use condense_json to avoid duplicate data in JSON in DB, refs #617
* Follow up to 3 redirects for fragments
* Python API docs for fragments= and system_fragments=
* Fragment aliases cannot contain a : - this is to ensure we can add custom fragment loaders later on, refs https://github.com/simonw/llm/pull/859#issuecomment-2761534692
* Use template fragments when running prompts
* llm fragments show command plus llm fragments group tests
* Tests for fragments family of commands
* Test for --save with fragments
* Add fragments tables to docs/logging.md
* Slightly better llm fragments --help
* Handle fragments in past conversations correctly
* Hint at llm prompt --help in llm --help, closes #868
* llm logs -f filter plus show fragments in llm logs --json
* Include prompt and system fragments in llm logs -s
* llm logs markdown fragment output and tests, refs #617
2025-04-05 17:22:37 -07:00
Simon Willison
f35ac31c21
llm logs --schema, --data, --data-array and --data-key options ( #785 )
...
* llm logs --schema option, refs #782
* --data and --data-array and --data-key options, refs #782
* Tests for llm logs --schema options, refs #785
* Also implemented --schema ID lookup, refs #780
* Using --data-key implies --data
* Docs for llm logs --schema and --data etc
2025-02-26 21:51:08 -08:00
Simon Willison
9922d5bb6a
model.prompt(prompt= is now optional, closes #784
2025-02-26 19:31:38 -08:00
Simon Willison
62c90dd472
llm prompt --schema X option and model.prompt(..., schema=) parameter ( #777 )
...
Refs #776
* Implemented new llm prompt --schema and model.prompt(schema=)
* Log schema to responses.schema_id and schemas table
* Include schema in llm logs Markdown output
* Test for schema=pydantic_model
* Initial --schema CLI documentation
* Python docs for schema=
* Advanced plugin docs on schemas
2025-02-26 16:58:28 -08:00
Simon Willison
849c65fe9d
Upgrade to Pydantic v2 ( #775 )
...
* Upgrade to Pydantic v2
* Stop testing against Pydantic v1
Closes #520
2025-02-26 10:05:54 -08:00
Simon Willison
7bf1ea665e
Made load_conversation() async_ aware, closes #742
2025-02-16 20:19:38 -08:00
Simon Willison
24b250506b
Better __repr__ and __str__ for conversation and model
...
Inspired by work on #752
2025-02-16 15:45:08 -08:00
Simon Willison
6c6b100f3e
KeyModel and AsyncKeyModel classes for models that taken keys ( #753 )
...
* New KeyModel and AsyncKeyModel classes for models that taken keys - closes #744
* llm prompt --key now uses new mechanism, including for async
* use new key mechanism in llm chat command
* Python API tests for llm.KeyModel and llm.AsyncKeyModel
* Python API docs for for prompt(... key="")
* Mention await model.prompt() takes other parameters, reorg sections
* Better title for the model tutorial
* Docs on writing model plugins that take a key
2025-02-16 14:38:51 -08:00
Simon Willison
20c18a716d
-q multiple option for llm models and llm embed-models
...
Refs #748
2025-02-13 15:35:18 -08:00