文件历史

提交图

100 次代码提交

作者 SHA1 备注 提交日期
Simon Willison 7bbf784277 Merge branch 'main' into annotations 2025-03-22 21:47:02 -07:00
giuli007 51db7afddb Support vision and audio for extra-openai-models.yaml (#843)
Add a vision option to enable OpenAI-compatible
models to receive image and audio attachments
2025-03-22 16:14:18 -07:00
adaitche de87d37c28 Add supports_schema to extra-openai-models (#819)
Recently support for structured output was added. But custom
OpenAI-compatible models didn't support the `supports_schema` property
in the config file `extra-openai-models.yaml`.
2025-03-21 16:59:34 -07:00
Simon Willison 563a4837f2 Annotations prototype, refs #716 2025-03-18 19:05:54 -07:00
Simon Willison 2cbe46304b PDF support for vision models, refs #834 2025-03-18 15:38:28 -07:00
Simon Willison efe265137d Only some OpenAI models support schemas, closes #794 2025-02-27 15:02:39 -08:00
Simon Willison 6bec92fd78 Assign gpt-4.5 default alias, refs #795 2025-02-27 14:51:09 -08:00
Simon Willison 801b08bf40 gpt-4.5-preview and gpt-4.5-preview-2025-02-27, refs #795 2025-02-27 12:25:04 -08:00
Kasper Primdal Lauritzen 6cb16a1d1a Allow "reasoning" for extra-openai-models.yaml (#766)
* Allow "reasoning" for extra-openai-models.yaml

Currently you get an error when trying to use `-o reasoning_effort high` with a model that has been defined in `extra-openai-models.yaml`. 
This allows a `reasoning` field.

* Mention reasoning: true in other OpenAI models docs

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2025-02-26 21:50:14 -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 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 b331b1e674 OpenAI model chatgpt-4o-latest, closes #752 2025-02-15 17:45:09 -08:00
Simon Willison eb0e1e761b o3-mini and reasoning_effort option, refs #728 2025-01-31 12:14:02 -08:00
Simon Willison 57d3baac42 Update embedding model names in docs, refs #654
Also ran Black.
2025-01-22 20:35:17 -08:00
web-sst 6f7ea406bf Register full embedding model names (#654)
Provide backward compatible aliases.
This makes available the same model names that ttok uses.
2025-01-22 20:14:03 -08:00
Simon Willison 38a7366d8e o1 cannot stream
https://github.com/simonw/llm/issues/676#issuecomment-2584932453
2025-01-10 16:03:09 -08:00
Simon Willison 6baf1f7d83 o1
Closes #676
2025-01-10 15:57:06 -08:00
Simon Willison 67d4a99645 llm prompt -x/--extract option, closes #681 2024-12-19 06:40:05 -08:00
Simon Willison 6305b86026 gpt-4o-mini-audio-preview, closes #677 2024-12-17 20:28:57 -08:00
Simon Willison 8898584ba6 New OpenAI audio models, closes #677 2024-12-17 11:14:42 -08:00
Simon Willison aa25ad1d54 o1-preview and o1-mini can stream now
Refs https://github.com/simonw/llm/issues/676#issuecomment-2549328154
2024-12-17 10:53:15 -08:00
Simon Willison 571f4b2a4d Fix for UTC warnings
Closes #672
2024-12-12 14:57:23 -08:00
Simon Willison 491dd9b437 Removed accidental comment 2024-12-05 13:45:50 -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 cfb10f4afd Log input tokens, output tokens and token details (#642)
* Store input_tokens, output_tokens, token_details on Response, closes #610
* llm prompt -u/--usage option
* llm logs -u/--usage option
* Docs on tracking token usage in plugins
* OpenAI default plugin logs usage
2024-11-19 20:21:59 -08:00
Simon Willison cf172cc70a response.text_or_raise() workaround
Closes https://github.com/simonw/llm/issues/632
2024-11-14 15:08:41 -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 7520671176 audio/wav not audio/wave, refs #603 2024-11-12 21:43:07 -08:00
Simon Willison 3352eb9f57 Serialize usage to JSON properly, closes #614 2024-11-06 03:27:25 -08:00
Chris Mungall 3b2e5263a3 Allow passing of can_stream in openai_models.py (#600)
* Allow passing of can_stream in openai_models.py

Fixes #599 

* Only set can_stream: false if it is false

Refs https://github.com/simonw/llm/pull/600#issuecomment-2458825866

* Docs for can_stream: false

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2024-11-05 23:04:13 -08:00
Simon Willison 12df1a3b2a Show attachment types in llm models --options, closes #612 2024-11-05 22:49:26 -08:00
Simon Willison 0cc4072bcd Support attachments without prompts, closes #611 2024-11-05 21:27:18 -08:00
Simon Willison 336ab1013d gpt-4o-audio-preview audio input, refs #608 2024-11-05 21:08:52 -08:00
Simon Willison 389acdf52c Track usage on OpenAI stream requests, closes #591 2024-10-28 17:40:40 -07:00
Simon Willison a68af9c8e6 Don't redact non-data URLs for OpenAI models
Refs #587
2024-10-28 15:41:34 -07:00
Simon Willison cd722f653b Redact base64 data from _prompt_json, refs #587 2024-10-28 15:41:34 -07:00
Simon Willison dff5b456fd Got llm --continue to work with images, refs #587 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 bfcfd2c91b o1-preview and o1-mini, refs #570 (#573) 2024-09-12 16:08:04 -07:00
Simon Willison e867e13d1b Use model_dump() instead of dict()
Closes #554
2024-08-18 17:39:09 -07:00
Simon Willison 24cc042e59 Use self.get_key() in OpenAI Chat class, refs #552 2024-08-18 17:01:28 -07:00
Simon Willison 963a5ba467 gpt-4o-mini with alias 4o-mini, refs #536 2024-07-18 11:53:00 -07:00
Simon Willison 9a3236db61 gpt-4-turbo model ID, closes #493
Test / test (ubuntu-latest, ==1.10.2, 3.9) (push) Has been cancelled
Test / test (ubuntu-latest, >=2.0.0, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, >=2.0.0, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, >=2.0.0, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, >=2.0.0, 3.8) (push) Has been cancelled
Test / test (ubuntu-latest, >=2.0.0, 3.9) (push) Has been cancelled
Test / test (windows-latest, ==1.10.2, 3.10) (push) Has been cancelled
Test / test (windows-latest, ==1.10.2, 3.11) (push) Has been cancelled
Test / test (windows-latest, ==1.10.2, 3.12) (push) Has been cancelled
Test / test (windows-latest, ==1.10.2, 3.8) (push) Has been cancelled
Test / test (windows-latest, ==1.10.2, 3.9) (push) Has been cancelled
Test / test (windows-latest, >=2.0.0, 3.10) (push) Has been cancelled
Test / test (windows-latest, >=2.0.0, 3.11) (push) Has been cancelled
Test / test (windows-latest, >=2.0.0, 3.12) (push) Has been cancelled
Test / test (windows-latest, >=2.0.0, 3.8) (push) Has been cancelled
Test / test (windows-latest, >=2.0.0, 3.9) (push) Has been cancelled
Test / test (macos-latest, ==1.10.2, 3.10) (push) Has been cancelled
Test / test (macos-latest, ==1.10.2, 3.11) (push) Has been cancelled
Test / test (macos-latest, ==1.10.2, 3.12) (push) Has been cancelled
Test / test (macos-latest, ==1.10.2, 3.8) (push) Has been cancelled
Test / test (macos-latest, ==1.10.2, 3.9) (push) Has been cancelled
Test / test (macos-latest, >=2.0.0, 3.10) (push) Has been cancelled
Test / test (macos-latest, >=2.0.0, 3.11) (push) Has been cancelled
Test / test (macos-latest, >=2.0.0, 3.12) (push) Has been cancelled
Test / test (macos-latest, >=2.0.0, 3.8) (push) Has been cancelled
Test / test (macos-latest, >=2.0.0, 3.9) (push) Has been cancelled
Test / test (ubuntu-latest, ==1.10.2, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, ==1.10.2, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, ==1.10.2, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, ==1.10.2, 3.8) (push) Has been cancelled
2024-05-13 13:37:23 -07:00
Simon Willison 73bbbec372 gpt-4o model, refs #490 2024-05-13 12:49:45 -07:00
Simon Willison a06bef8f83 default_headers, not headers - fixes llm-openrouter, refs #401 2024-01-26 13:42:34 -08:00
Simon Willison 0f8ffbfbbd Fix compatibility with llm-anyscale-endpoints, refs #401 2024-01-26 13:35:03 -08:00
Simon Willison 1f67f14cdb Re-implemented LLM_OPENAI_SHOW_RESPONSES against httpx
Closes #404
Refs #364
2024-01-26 10:33:03 -08:00
Simon Willison 214fcaaf86 Upgrade to run against OpenAI >= 1.0
* strategy: fail-fast: false - to help see all errors
* Apply latest Black

Refs #325
2024-01-25 22:00:44 -08:00