文件历史

提交图

45 次代码提交

作者 SHA1 备注 提交日期
Simon Willison 7bbf784277 Merge branch 'main' into annotations 2025-03-22 21:47:02 -07:00
Simon Willison 6c9a8efb50 register_template_loaders plugin hook, closes #809
* Moved templates CLI commands next to each other
* llm templates loaders command
* Template loader tests
* Documentation for template loaders
2025-03-21 16:46:44 -07:00
Simon Willison 563a4837f2 Annotations prototype, refs #716 2025-03-18 19:05:54 -07:00
Simon Willison 8d32b71ef1 Renamed build_json_schema to schema_dsl 2025-02-27 10:22:29 -08:00
Simon Willison 7bf1ea665e Made load_conversation() async_ aware, closes #742 2025-02-16 20:19:38 -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 b6be09aa28 Fix get_models() and get_async_models() duplicates bug
Closes #667, refs #640
2024-12-05 13:44:07 -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 330e171e86 Fix for not loading plugins during tests, refs #626 2024-11-12 21:42:49 -08:00
Simon Willison be2953e6ab Ruff and mypy fixes 2024-10-28 15:41:34 -07:00
Simon Willison 6df00f92ff First working prototype of new attachments feature, 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 ed5a535484 Apply Black, refs #378 2024-01-25 17:29:28 -08:00
Simon Willison d9d9bb38d7 Drop Python 3.7, add 3.8, fix pkg_resources warning, refs #378 2024-01-25 16:48:49 -08:00
Simon Willison 6c43948325 llm.user_dir() creates directory if needed, closes #275
Would have fixed this bug too:
- https://github.com/simonw/llm-sentence-transformers/issues/9
2023-09-13 15:58:18 -07:00
Simon Willison 6012f31e36 llm plugins --all option, closes #259 2023-09-10 14:18:16 -07:00
Simon Willison b84f6f9ffd Docs for LLM_LOAD_PLUGINS, closes #256 2023-09-10 14:12:37 -07:00
Simon Willison a54743f228 Fix to get embedding set_alias to work
Refs:
- https://github.com/simonw/llm-sentence-transformers/issues/4
- https://github.com/simonw/llm/issues/192
2023-09-03 18:15:45 -07:00
Simon Willison 0eda99e91c Default embedding model finishing touches, closes #222 2023-09-03 17:21:47 -07:00
Simon Willison 0ec516559a Collection.similar methods, refs #191 2023-09-01 16:26:58 -07:00
Simon Willison 6f761702dc Initial Collection class plus test, refs #191 2023-09-01 13:04:05 -07:00
Simon Willison 77cf56e54a Initial CLI support and plugin hook for embeddings, refs #185
* Embeddings plugin hook + OpenAI implementation
* llm.get_embedding_model(name) function
* llm embed command, for returning embeddings or saving them to SQLite
* Tests using an EmbedDemo embedding model
* llm embed-models list and emeb-models default commands
* llm embed-db path and llm embed-db collections commands
2023-08-27 22:24:10 -07:00
Simon Willison dff36f0edc Change of policy: keys.json over-rides environment variables, closes #158 2023-08-20 23:27:21 -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 d31d97e06f Refactor get_key() with docs and better varible names
The actual logic is unchanged, but it is a lot easier to understand what it does now.

Refs #158
2023-08-17 15:03:55 -07:00
Simon Willison 6a578c35cf mypy fix for new aliases code, refs #151 2023-08-12 09:17:29 -07:00
Simon Willison 458a59a8f4 Actually register aliases from aliases.json, closes #151 2023-08-12 09:15:17 -07:00
Simon Willison 7bef414de7 Nicer error message for unknown models with -c mode, closes #92 2023-07-11 19:29:54 -07:00
Simon Willison c7271dd6b4 llm.ModelError class, refs #96 2023-07-11 10:52:48 -07:00
Simon Willison 2554a06e36 Docs for llm.user_dir(), closes #83 2023-07-11 07:43:57 -07:00
Simon Willison 88d839fa85 Create conversations and responses tables and write to them, refs #91 2023-07-11 07:21:22 -07:00
Simon Willison b38b8314b9 Initial working implementation of conversations, refs #85 2023-07-10 22:37:45 -07:00
Simon Willison ae87f978bd Moved iter_prompt from Response to Model, moved a lot of other stuff
- Moved a whole bunch of things from llm/cli.py into llm/__init__.py
- Switched plugin listings to use importlib.metadata to avoid deprecation warning
- iter_prompt() is now a method on Model, not on Response
2023-07-10 07:45:11 -07:00
Simon Willison 04568115b8 Options base class is now llm.Options not Model.Options 2023-07-05 20:47:36 -07:00
Simon Willison 52add96ec1 Rough initial version of new logging, to log2 table 2023-07-02 16:35:36 -07:00
Simon Willison 13fb4c2966 Refactor Template into templates.py 2023-07-01 08:27:45 -07:00
Simon Willison 274126d9f8 WIP register_models() plugin hook, refs #53 2023-06-26 07:43:46 -07:00
Chris Mungall 482292b7d7 Add a defaults parameter to templates. (#57)
This allows default values to be filled for templates.

For example:
```yaml
prompt: Summarize this text in the voice of $voice
defaults:
  voice: GlaDOS
```
2023-06-17 23:49:27 +01:00
Simon Willison a396950f79 Initial plugin framework and register_commands(cli) hook, refs #49 2023-06-17 17:42:13 +01:00
Simon Willison 144ffc3f6b Prompt templates
Closes #23
2023-06-17 08:40:46 +01:00
Simon Willison 93ebb96cfa Rename back to llm, refs #1
Test / test (3.9) (push) Has been cancelled
Test / test (3.10) (push) Has been cancelled
Test / test (3.11) (push) Has been cancelled
Test / test (3.7) (push) Has been cancelled
Test / test (3.8) (push) Has been cancelled
2023-04-01 15:00:19 -07:00
Simon Willison c5c666867a Renamed package to llm-cli 2023-04-01 14:41:46 -07:00
Simon Willison 3f89cb9609 Initial prototype, refs #1 2023-04-01 14:28:24 -07:00