文件历史

提交图

587 次代码提交

作者 SHA1 备注 提交日期
Simon Willison 926394aecd Tweaked some overly-promotional language
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (ubuntu-latest, 3.14) (push) Has been cancelled
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.14) (push) Has been cancelled
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (macos-latest, 3.14) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
2026-04-28 17:46:07 -07:00
Simon Willison 02c9af048f A bunch of documentation edits 2026-04-28 17:07:51 -07:00
Simon Willison 5789bc9e36 It's actually the 0.32 alpha 2026-04-28 16:59:11 -07:00
Simon Willison 35c7533c18 Edited the changelog for 0.32a0 2026-04-28 16:49:05 -07:00
Simon Willison 29e3787be5 Draft changelog for 0.32a0 2026-04-28 16:32:52 -07:00
Simon Willison b97a6902f5 Persist visible reasoning to logs and render in markdown
Adds a `reasoning` column to the responses table (migration m022)
populated from concatenated visible-reasoning text in the assembled
message. `llm logs --md` renders it under a `## Reasoning` heading
above the response when present.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:27:22 -07:00
Simon Willison 842ab2a93f response.messages is a method, matching .text() / .json() / .tool_calls()
Sync: response.messages() forces execution if not drained, so callers
no longer have to remember to call .text() first. Async: `await
response.messages()` awaits the force.

Internal sync paths (_response_to_dict, _chain_for_tool_results,
_build_full_chain, Response.reply, AsyncResponse.reply) use a new
private _messages_now() helper that assumes the response is already
drained, so they don't have to await on async responses.

Drops the now-obsolete "accessing .messages on un-awaited
AsyncResponse raises" parity test — that constraint goes away with
the method form.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:04:35 -07:00
Simon Willison f3a0962162 response.reply() auto-executes pending tool calls
Zero-arg sugar: when a response made tool calls and tool_results= is
not passed, reply() runs self.execute_tool_calls() and threads the
results into the next turn. Pass tool_results= explicitly to skip
the auto-execute path (e.g. for mutated or synthetic results). Also
forwards self.prompt.tools to the next turn so the model can call
the same tools again, mirroring Conversation.prompt's tools-or-self
rule.

AsyncResponse.reply() is now an awaitable coroutine — `await
response.reply(...)` — so the auto-execute path can `await
self.execute_tool_calls()` internally. This is a non-shipped API
break: existing async-reply callers in the test suite updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:51:13 -07:00
Simon Willison 3b0d0fa0a5 part_index is now (mostly) automatically assigned 2026-04-28 09:35:53 -07:00
Simon Willison 6567b60005 Merge remote-tracking branch 'origin/messages-refactor' into messages-refactor
# Conflicts:
#	docs/fragments.md
#	llm/default_plugins/openai_models.py
#	pyproject.toml
2026-04-28 07:34:02 -07:00
Simon Willison 13b10e097c Merge remote-tracking branch 'origin/main' into messages-refactor
# Conflicts:
#	llm/default_plugins/openai_models.py
2026-04-28 07:31:55 -07:00
Simon Willison 5ce40fd703 Release 0.31
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (macos-latest, 3.14) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (ubuntu-latest, 3.14) (push) Has been cancelled
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.14) (push) Has been cancelled
Refs #1418
2026-04-24 16:33:05 -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 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
github-actions[bot] eb45de6bfc Ran cog 2026-04-22 17:18:08 +00:00
Simon Willison d11b9a01c5 More documentation tweaks 2026-04-22 08:43:15 -07:00
Simon Willison 8c48dccc94 docs: advanced-model-plugins.md covers StreamEvent / prompt.messages / provider_metadata
Substantially expanded docs/plugins/advanced-model-plugins.md with
the plugin-author guide to the new machinery. Distilled from the
actual llm-anthropic and llm-gemini implementations so plugin
authors have a recipe that mirrors what real providers do.

New / updated sections (doc grew 317 → 663 lines):

- "Attachments from previous conversations" trimmed to a pointer at
  prompt.messages — the old pattern of walking conversation.responses
  is replaced by the canonical chain view.

- "Structured messages and streaming events"
  - StreamEvent contract, backward compat for plain-str plugins
  - Full field reference (type / chunk / part_index / tool_call_id /
    provider_metadata / server_executed / tool_name)
  - part_index allocation rules with two worked examples:
    block-keyed (Anthropic-style content_block_start events) and
    kind-tracking (Gemini-style chunk-per-part)
  - Reasoning: streamed text + opaque _reasoning_token_count, with
    the OpenAI-specific gotcha about reading reasoning_tokens BEFORE
    set_usage mutates the dict
  - Tool calls — tool_call_name + tool_call_args pattern, reminder
    that response.add_tool_call() is separately required for
    chain-execution
  - Server-side tools — server_executed=True on events, raw payload
    in provider_metadata for round-trip, post-stream emission for
    providers that don't stream tool-result contents
  - Opaque provider_metadata — Anthropic signature, Gemini
    thoughtSignature, OpenAI encrypted_content — with namespacing
    guidance
  - Non-streaming path — one event per content block

- "Consuming prompt.messages in build_messages"
  - The invariant: prompt.messages is always the full chain; don't
    walk conversation.responses (would double-emit)
  - Worked build_messages example that dispatches per Part subtype
  - Role mapping across OpenAI / Anthropic / Gemini conventions
  - Role-alternation merging

- "Restoring opaque metadata on subsequent requests"
  - How to read provider_metadata off prior-turn Parts and fold the
    signatures back into the outgoing request body

670 tests still green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 21:54:01 -07:00
Simon Willison 92f9359ba3 Documentation improvements 2026-04-21 21:24:50 -07:00
Simon Willison d4f3f242ce Unwrap wrapped text in docs 2026-04-21 20:17:39 -07:00
github-actions[bot] 1c317ab3fe Ran cog 2026-04-22 00:08:41 +00:00
Simon Willison 063564d34d Phase 6: client-side serialization round-trip test + docs
Lock in the "application does its own persistence without SQLite"
story with:

  - Five integration tests covering: Message.to_dict / from_dict
    round-trip, re-inflating messages and continuing a conversation,
    tool calls + results round-trip, redacted reasoning Parts
    round-trip, and provider_metadata round-trip.
  - A new "Structured messages and streaming events" section in
    docs/python-api.md walking users through messages=[...],
    stream_events(), response.messages, and the JSON round-trip
    pattern.

No new code — the machinery landed in Phases 1-3. This phase is
validation + documentation.

580 tests passing overall.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 09:45:50 -07:00
Simon Willison f2c7a2a807 Link to #1389 from changelog 2026-03-31 13:45:24 -07:00
Simon Willison 7169fe9085 Add Usage to llm/__init__ __all__ (to fix Ruff)
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.14) (push) Has been cancelled
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (macos-latest, 3.14) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (ubuntu-latest, 3.14) (push) Has been cancelled
2026-03-31 13:33:56 -07:00
Simon Willison 62b8864fda Release 0.30 2026-03-31 13:32:04 -07:00
Simon Willison 946e433698 More docstrings and autoclass embeds in docs 2026-03-31 13:12:32 -07:00
Simon Willison 1562a8f444 Added some more autoclass docs, with new doctrings 2026-03-31 12:54:00 -07:00
Simon Willison 49d4e54639 register_models() model_aliases parameter 2026-03-31 12:45:38 -07:00
Simon Willison 40f7b8f2fa Ran cog 2026-03-31 11:53:25 -07:00
Simon Willison c7cf7e506e Changelog for 0.29
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (macos-latest, 3.14) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (ubuntu-latest, 3.14) (push) Has been cancelled
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.14) (push) Has been cancelled
2026-03-17 12:23:43 -07:00
Simon Willison 07dccc00ef GPT-5.4, 5.4-mini, 5.4-nano
Closes #1376
2026-03-17 11:24:52 -07:00
Simon Willison 4766f47946 Note about just cog in release process
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (macos-latest, 3.14) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (ubuntu-latest, 3.14) (push) Has been cancelled
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.14) (push) Has been cancelled
See 8002325600
2025-12-12 12:01:37 -08:00
Simon Willison 8002325600 Cog for 0.28 release 2025-12-12 12:00:22 -08:00
Simon Willison 3a4f639536 Release 0.28
Refs #1300, #1308, #1309, #1313, #1315, #1316, #1317, #1318
2025-12-12 11:58:35 -08:00
Simon Willison abf77e40d8 Fix for cog 2025-12-11 13:20:06 -08:00
Simon Willison 1e3c7f0cfd uv and dependency-groups, refs #1318 2025-12-11 13:18:20 -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 a0ac68c452 Custom HTTP user-agent for llm -f URL, closes #1309 2025-11-25 22:07:11 -08:00
Simon Willison 921fae9a0a Release 0.27.1
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (macos-latest, 3.9) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (ubuntu-latest, 3.9) (push) Has been cancelled
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.9) (push) Has been cancelled
Refs #1237, #1238, #1239. #1240
2025-08-11 22:14:55 -07:00
Simon Willison e15e1ad717 Credit James Sanford in changelog, refs #1218, #1232
Test / test (macos-latest, 3.9) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (ubuntu-latest, 3.9) (push) Has been cancelled
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.9) (push) Has been cancelled
2025-08-11 14:29:35 -07:00
Simon Willison 4292fe9d21 Relase 0.27
Refs #1009, #1014, #1049, #1053, #1088, #1104, #1110, #1111, #1114, #1117, #1134, #1137, #1148, #1150, #1177, #1228, #1229, #1232
2025-08-11 13:55:05 -07:00
Simon Willison cbd3aab511 GPT-5 model IDs, refs #1229 2025-08-11 13:23:36 -07:00
Simon Willison 08094082f2 Toolbox.add_tool(), prepare() and prepare_async() methods
Closes #1111
2025-08-11 13:19:31 -07:00
Simon Willison ef3192b44d Better docs for OpenAI model options
!stable-docs

Closes #1228
2025-08-03 15:31:25 -07:00
Simon Willison 24f32fe7b4 Grant models the ability to execute tools 2025-06-19 13:21:03 -07:00
Simon Willison 0863ed460e llm logs -l/--latest -q option, closes #1177 2025-06-17 23:23:45 -07:00
Simon Willison 12b6ea6977 Fix grammar in attachments docs 2025-06-03 15:48:07 -07:00
Simon Willison 3a96d52895 Better handling of before_call cancellation, closes #1148 2025-06-01 18:36:55 -07:00
Simon Willison 30e0c4abe8 ToolResult.exception for tool errors, now logged to DB
Closes #1104
2025-06-01 17:01:40 -07:00
Simon Willison e6dcd414a5 note about async before_call/after_call 2025-06-01 12:36:28 -07:00