文件历史

131 次代码提交

作者 SHA1 备注 提交日期
Simon Willison 9d9ecd0a73 Handle tool calls with empty arguments better, closes #1521 2026-07-09 09:02:50 -07:00
Simon Willison 706852ecea New image_detail low/high/auto/original option
Refs https://github.com/simonw/llm/issues/1418#issuecomment-4316983472
2026-04-24 16:22:43 -07:00
Simon Willison 87efea179d Cleaner dynamic self.Options building, refs #1418 2026-04-24 16:11:22 -07:00
Simon Willison 021a29d61a OpenAI verbosity option
Refs https://github.com/simonw/llm/issues/1418#issuecomment-4316867527
2026-04-24 16:08:26 -07:00
Simon Willison c9a3ac9fe0 New model: gpt-5.5 - refs #1418 2026-04-24 15:41:12 -07:00
Simon Willison cad03fb4f4 Register async models for extra-openai-models.yaml, closes #1395
Note that Completion models do not have an async class so will not be registered as async.
2026-04-04 07:07:14 -07:00
Simon Willison 07dccc00ef GPT-5.4, 5.4-mini, 5.4-nano
Closes #1376
2026-03-17 11:24:52 -07:00
Claude 947feaa0c9 Add gpt-5.4 and gpt-5.4-2026-03-05 model support
https://claude.ai/code/session_01HwqZ4WeDCrspfF8E7STiPA
2026-03-06 00:42:46 +00:00
Arjan Mossel 73548c479a Add type annotations for OpenAI Chat/AsyncChat/Completion execute methods (#1315)
* Add type annotations for OpenAI Chat/AsyncChat/Completion execute methods
* Add type hint for OpenAI _Shared class
* cast(Response) to make mypy happy

Co-authored-by: Simon Willison <swillison@gmail.com>
2025-12-11 14:17:17 -08:00
Simon Willison 1753eb74ee gpt-5.2, gpt-5.2-chat-latest - refs #1317 2025-12-11 11:50:08 -08:00
Simon Willison 0526abeeea gpt-5.1 and gpt-5.1-chat-latest, refs #1300 2025-11-13 11:35:14 -08:00
James Sanford 2a54939951 Fix streaming tool calls with tests for many variants. (#1218)
* Recorded instance of streaming tool response variant "a".

This is the typical response, where "arguments":"" arrives
first in the stream, followed by "arguments":"{}"

The response data is a real capture from the OpenRouter API,
however some request and header data may be from other test fixtures.

* Recorded instance of streaming tool response variant "b".

This is a streaming response where the first arguments
you get is a fully formed "arguments":"{}"

The response data is a real capture from the OpenRouter API,
however some request and header data may be from other test fixtures.

* Test cases for streaming tool responses.

Note that the replays are marked as "read-only", as they are variants
seen in the wild where the streaming tool call argument fragments
arrive in a specific order.

* Fix streaming tool response variant "b", where "arguments":"{}" is what arrives first.

The previous code erroneously caused the first "arguments" to be duplicated,
by using "+=" even when being initially set.

This went unnoticed as many models stream "arguments":"" first.

When a more fully formed "arguments" fragment arrived first, it was causing
"Error: Extra data: line 1 column 3 (char 2)"

* Recorded instance of streaming tool response variant "c".

This was failing with "Error: unsupported operand type(s) for +=: 'NoneType' and 'str'"

The response data is a real capture from the OpenRouter API,
however some request and header data may be from other test fixtures.

* Test case for streaming tool response variant "c".

* Fix streaming tool response variant "c".

However, I'm not sure why arguments was initially not present or seen as None.
2025-08-11 14:17:52 -07:00
Simon Willison cbd3aab511 GPT-5 model IDs, refs #1229 2025-08-11 13:23:36 -07:00
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 2bc6d7679c New default tool, llm_time, closes #1103 2025-05-26 23:00:18 -07:00
Simon Willison b4365ceb35 Move llm_version into llm.tools namespace 2025-05-26 21:44:33 -07:00
Simon Willison 9bbb37fae0 New default llm_version tool, closes #1096
Refs https://github.com/simonw/llm/issues/1095#issuecomment-2910574597
2025-05-26 13:30:47 -07:00
Mahesh Hegde d5f7bf9073 Support supports_tools parameters in openai compatible models (#1068) 2025-05-23 22:30:51 -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 ad7dc2ef71 Enable vision for o3 and o4-mini, closes #1037 2025-05-15 10:22:13 -04:00
Simon Willison bed617cd62 Enable tools for o3, o3-mini, o4-mini, refs #988 2025-05-13 17:19:30 -07:00
Simon Willison 88b806ae1a Got multi-tool OpenAI chat working, in no-stream mode too
Refs #1017, #1019
2025-05-13 17:19:30 -07:00
Simon Willison 0ff24b34c4 dict() is now model_dump() 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 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 c990578934 ToolCall.tool_call_id property, refs #937 2025-05-13 17:19:30 -07:00
Simon Willison 7bc2f78156 Capture tool calls from OpenAI streaming sync responses
Refs https://github.com/simonw/llm/issues/988#issuecomment-2869079084
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 8e68c5e2d9 o4-mini, closes #976 2025-05-04 16:04:28 -07:00
Kevin Burke 5d0a2bba59 llm/default_plugins: add o3 model (#945)
* llm/default_plugins: add o3 model

This is the newest model released by OpenAI and is available through
the API.

* Ran cog

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2025-05-04 16:01:55 -07:00
Abizer Lokhandwala 0b37123a38 Add GPT-4.1 model family to default OpenAI plugin (#965)
* openai: add gpt-4.1 models
* Refactor and run cog

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2025-05-04 10:27:12 -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 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