Commit graph

40 commits

Author SHA1 Message Date
Simon Willison
b5d1c5ee90
Tools can now return attachments
Closes #1014

- llm.ToolOutput(output='...', attachments=[...]) for tools to return attachments
- New table: `tool_results_attachments`
- Table is populated when tools return attachments
- llm --tools-debug shows attachments returned by tools
- llm logs shows attachments returned by tools
2025-06-01 10:08:36 -07:00
Simon Willison
e23e13e6c7 Test for async toolbox, docs for toolboxes in general
Closes #1090, refs #997
2025-05-26 10:23:03 -07:00
Simon Willison
3e3492898c Conversations using tools in Python API
Refs #1033
2025-05-21 23:05:16 -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
471eb67326 Slim initial python API docs for tools and chains, closes #1022 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
fea9eb9866
new way of configuring key
Refs #744

!stable-docs
2025-03-18 08:41:54 -07:00
Simon Willison
0f47565530
Clarify lazy loading
https://bsky.app/profile/simonwillison.net/post/3lknwgbph522h

!stable-docs
2025-03-18 08:04:52 -07:00
Simon Willison
eb2b243fdf schema_dsl(..., multi=True) parameter, refs #790 2025-02-27 10:28:42 -08:00
Simon Willison
8d32b71ef1 Renamed build_json_schema to schema_dsl 2025-02-27 10:22:29 -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
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
f67c21522b
Docs for response.json() and response.usage()
!stable-docs
2025-02-11 08:35:27 -08:00
Simon Willison
21df241443 llm-claude-3 is now called llm-anthropic
Refs https://github.com/simonw/llm-claude-3/issues/31

!stable-docs
2025-02-01 22:08:19 -08:00
Simon Willison
eb996baeab Documentation for model.attachment_types, closes #705 2025-01-22 20:46:28 -08:00
Simon Willison
c018104083 Release 0.19
Refs #495, #610, #640, #641, #644, #653
2024-12-01 15:58:27 -08:00
Simon Willison
f9af563df5 response.on_done() mechanism, closes #653 2024-12-01 15:47:23 -08:00
Simon Willison
335b3e635a Release 0.19a2
Refs #640
2024-11-20 20:12:43 -08:00
Simon Willison
c52cfee881 llm.get_models() and llm.get_async_models(), closes #640 2024-11-20 20:09:06 -08:00
Simon Willison
ba75c674cb
llm.get_async_model(), llm.AsyncModel base class and OpenAI async models (#613)
- https://github.com/simonw/llm/issues/507#issuecomment-2458639308

* register_model is now async aware

Refs https://github.com/simonw/llm/issues/507#issuecomment-2458658134

* Refactor Chat and AsyncChat to use _Shared base class

Refs https://github.com/simonw/llm/issues/507#issuecomment-2458692338

* fixed function name

* Fix for infinite loop

* Applied Black

* Ran cog

* Applied Black

* Add Response.from_row() classmethod back again

It does not matter that this is a blocking call, since it is a classmethod

* Made mypy happy with llm/models.py

* mypy fixes for openai_models.py

I am unhappy with this, had to duplicate some code.

* First test for AsyncModel

* Still have not quite got this working

* Fix for not loading plugins during tests, refs #626

* audio/wav not audio/wave, refs #603

* Black and mypy and ruff all happy

* Refactor to avoid generics

* Removed obsolete response() method

* Support text = await async_mock_model.prompt("hello")

* Initial docs for llm.get_async_model() and await model.prompt()

Refs #507

* Initial async model plugin creation docs

* duration_ms ANY to pass test

* llm models --async option

Refs https://github.com/simonw/llm/pull/613#issuecomment-2474724406

* Removed obsolete TypeVars

* Expanded register_models() docs for async

* await model.prompt() now returns AsyncResponse

Refs https://github.com/simonw/llm/pull/613#issuecomment-2475157822

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-13 17:51:00 -08:00
Simon Willison
ba1ccb3a4a Release 0.17a0
Refs #587, #590
2024-10-28 15:46:52 -07:00
Simon Willison
570a3eccae Python attachment documentation, plus fixed a mimetype detection bug
Refs #587
2024-10-28 15:41:34 -07:00
Simon Willison
6deed8f976 get_model() improvement, get_default_model() / set_default_wodel() now documented
Refs #553
2024-08-18 17:37:31 -07:00
Simon Willison
37f85b3a1f Document model options in Python API, closes #187 2023-09-12 10:36:47 -07:00
Simon Willison
f54f2c659d response.__str__ method, closes #268 2023-09-12 10:36:29 -07:00
Simon Willison
f5ec484cf2 Fixed documentation heading level, refs #154 2023-08-19 22:12:02 -07:00
Simon Willison
c290b44d45 llm.remove_alias() function, refs #154 2023-08-19 22:06:51 -07:00
Simon Willison
8cdcf1e689 llm.set_alias() function, refs #154 2023-08-19 22:01:29 -07:00
Simon Willison
0eeb8393ca llm models and llm templates default to list, closes #167 2023-08-19 20:04:14 -07:00
Simon Willison
8bf27b34ee
llm.UnknownModelError docs, closes #155 2023-08-13 14:57:35 -07:00
Simon Willison
4484765efe Release 0.6.1
Refs #124
2023-07-24 08:41:05 -07:00
Simon Willison
9475413972
System prompts for Python API 2023-07-20 12:02:15 -07:00
Simon Willison
7a7bb3aed6 More improvements to release notes, refs #99 2023-07-11 22:00:17 -07:00
Simon Willison
2554a06e36 Docs for llm.user_dir(), closes #83 2023-07-11 07:43:57 -07:00
Simon Willison
0d6f9e7038 Documented conversations for Python API, closes #85
Also removed now obsolete internal concepts documentation, may add something like this again later.
2023-07-11 07:33:42 -07:00
Simon Willison
35827a5d43 Basic Python API usage instructions
Closes #75
2023-07-10 11:42:23 -07:00
Simon Willison
199f7e0767 Renamed iter_prompt() to execute() and updated tutorial 2023-07-10 07:59:12 -07:00
Simon Willison
49e4d688c6 Removed .stream() method in favor of .prompt(stream=False) 2023-07-04 07:50:31 -07:00
Simon Willison
61dd8afc60 Drop the debug field from the logs, combine chunks from stream 2023-07-03 06:39:54 -07:00
Simon Willison
2911975548 First attempt at internal API docs, refs #65 2023-07-01 08:50:39 -07:00