文件历史

提交图

313 次代码提交

作者 SHA1 备注 提交日期
Simon Willison 0fa7ccf58f Ran Black 2026-04-28 14:42:39 -07:00
Simon Willison 49dd796264 Strip trailing whitespace from reasoning when rendering markdown logs
Providers (e.g. Gemini) often emit thought text with trailing newlines.
Concatenated and combined with click.echo's own newline, that produced
several blank lines before the `## Response` heading. rstrip() at render
time tightens the gap to a single blank line; the stored reasoning column
keeps the provider's text verbatim.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:39:56 -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 c629c133b7 Phase 5: CLI reasoning display
Add a display_stream_events() helper (plus async twin) that writes
text events to stdout and reasoning events to stderr in dim style,
with a newline inserted at reasoning→text transitions so the
assistant's final answer starts on a fresh visual line.

Add -R / --no-reasoning flag to both `llm prompt` and `llm chat` to
suppress the stderr reasoning stream. The sync and async streaming
paths in `llm prompt` and the streaming path in `llm chat` now
consume response.stream_events() / astream_events() through the
helper instead of plain iteration.

Conftest: MockModel and AsyncMockModel now set can_stream = True so
CLI tests exercising event-level behavior actually take the
streaming branch. This matches the fixtures' practical behavior —
they yield chunks, one at a time.

With only the built-in OpenAI plugin upgraded (Phase 4), no model
currently streams live reasoning text (OpenAI's reasoning is
redacted — just a token count). The machinery is ready for
llm-anthropic / llm-gemini upgrades to light up the experience.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 09:44:17 -07:00
Simon Willison c8889e0a76 Ran black 2026-03-17 11:25:12 -07:00
Simon Willison 683ca204b2 Ensure -x/--xl work with -t 2026-03-17 11:22:34 -07:00
Simon Willison 6b84a0d36b Only do model_aluases=get_model_aliases() if needed by --save
I do not think this prevents hitting all the plugins for every prompt though
but it least we no longer hit all the plugins twice.
2026-01-19 13:19:57 -08:00
Simon Willison 5d237ce6ce Show options in Markdown logs output, closes #1322 2025-12-17 22:19:33 -08:00
Giuseppe Rota 618463de13 fix: register fragment source in chat command (#1316)
* Register fragment source in chat command
2025-12-11 13:54:32 -08:00
Simon Willison 14c2e2ab7e Move the import to a better spot, refs #1309 2025-11-25 22:20:05 -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 c41c122239 Use tools in templates with llm chat, closes #1239 2025-08-11 22:11:17 -07:00
Simon Willison 2f206d0e26 Fix for duplicated prompts in llm chat with templates, closes #1240
Also includes a bug fix for system fragments, see https://github.com/simonw/llm/issues/1240#issuecomment-3177684518
2025-08-11 21:52:54 -07:00
Simon Willison e6ac18fbcb Fix for confusing error, closes #1238 2025-08-11 16:52:16 -07:00
Simon Willison 9f1417f6e8 Fix for enum options and --save, refs #1237 2025-08-11 16:16:27 -07:00
Simon Willison 5204a11f33 Allow -o option when calling tools, closes #1233 2025-08-11 13:44:26 -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 0863ed460e llm logs -l/--latest -q option, closes #1177 2025-06-17 23:23:45 -07:00
Simon Willison d96ae4ed8d Fix --async logging to database, closes #1150 2025-06-01 17:38:26 -07:00
Simon Willison 65dde782b7 Fix mypy warning, closes #1146 2025-06-01 17:03:44 -07:00
Simon Willison 30e0c4abe8 ToolResult.exception for tool errors, now logged to DB
Closes #1104
2025-06-01 17:01:40 -07:00
Sukhbinder Singh f5a38d3342 Add -h shortcut for --help
Closes #983, #1134
2025-06-01 12:31:02 -07:00
Simon Willison ed64fc3362 chain_limit/before_call/after_call for conversations
* chain_limit/before_call/after_call for conversations, closes #1088
* Docs for before_call/after_call including for model.conversation
2025-06-01 12:00:29 -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 fd2f0ffbcd Better error on llm templates show, closes #1053 2025-05-31 17:26:07 -07:00
Simon Willison a3a2996fed Tools in templates (#1138)
Closes #1009
2025-05-30 17:44:52 -07:00
Simon Willison 301db6d76c responses.resolved_model column and response.set_resolved_model(model_id) method, closes #1117 2025-05-28 07:17:03 -07:00
Simon Willison d1c5c688e2 Error on llm -c with a Toolbox, closes #1101
Refs #1092
2025-05-26 21:51:16 -07:00
Simon Willison 57459c0a6e Fix the tests I broke in #1096 2025-05-26 19:02:14 -07:00
Simon Willison bb336d33a0 Toolbox class for class-based tool collections (#1086)
* Toolbox class for class-based tool collections

Refs #1059, #1058, #1057
2025-05-25 22:42:52 -07:00
Simon Willison abc4f473f4 --td now pretty-prints JSON if possible, closes #1083 2025-05-25 12:59:48 -07:00
Simon Willison 7837335eea Remove colon in Token usage header for consistency
More consistent with other headings in logs now.
2025-05-24 16:55:05 -07:00
André Arko fc44fd6a0d llm chat now respects default model options (#985) 2025-05-24 14:24:53 -07:00
Simon Willison a7c51e2871 Don't execute fragments/attachments in !edit sessions, closes #1074 2025-05-23 23:44:24 -07:00
Abizer Lokhandwala 9dace69af7 bugfix: cast path to str in templates_edit (#1031) 2025-05-23 23:34:16 -07:00
Dan Turkel 88d3e11c65 Support fragments in chat through -f, --sf, and !fragments (#1048)
* add vscode and uv artifacts to gitignore
* !fragment feature
* Update fragment command to accept multiple fragments
* Add support for multiple fragments in !fragment command, factor out fragment processing
* Add support for fragment/system fragment arguments in chat command
* update docs

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2025-05-23 23:31:16 -07:00
Dan Turkel 1d5d73481a Filter IDs with --prefix in llm similar (#1052) 2025-05-23 22:54:55 -07:00
Simon Willison 70092f2e78 llm logs --tools flag, closes #1072 2025-05-23 21:58:24 -07:00
Simon Willison 8a1fc5a90e llm logs --tool/-T option, closes #1013 2025-05-23 21:46:10 -07:00
Simon Willison 36477cf9e5 llm chat -c and llm -c carry forward tools, closes #1020 2025-05-23 21:10:51 -07:00
Simon Willison d2886d4692 Record which plugin a tool came from, including in DB - refs #1020 2025-05-23 15:44:12 -07:00
Simon Willison cb94047b46 Removed obsolete code I accidentally added in #1070 2025-05-23 15:22:32 -07:00
Simon Willison f6fefb3816 llm schemas list --json/--nl options, closes #1070 2025-05-23 15:17:32 -07:00
Simon Willison 5f44f89de2 Ident + tests for tool logging, closes #1042 2025-05-21 22:04:12 -07:00
Simon Willison bd2180df7d llm chat --tool and --functions (#1062)
* Tool support for llm chat, closes #1004
2025-05-20 21:30:27 -07:00
Simon Willison a31ae86c20 Refactor in prep for chat tools, refs #1004 2025-05-20 20:23:48 -07:00
Simon Willison a3414ed15d llm install --pre option, closes #1060 2025-05-20 18:25:42 -07:00
Simon Willison f879b816e4 llm plugins --hook X option, closes #1047 2025-05-18 14:50:34 -04:00
Simon Willison f320de1b0c LLM_TOOLS_DEBUG env var, closes #1045 2025-05-17 22:38:15 -04:00
Simon Willison 2df619e7d8 --chain-limit option, closes #1025 2025-05-13 21:52:39 -04:00