Commit graph

30 commits

Author SHA1 Message Date
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