Commit graph

37 commits

Author SHA1 Message Date
Simon Willison
e48a5b9f11 Rename "echo" to "simple-echo", refs #1061 2025-05-20 20:55:54 -07:00
Simon Willison
4279df23a4 Allow -t and --system to be used together, refs #916 2025-04-13 20:27:41 -07:00
guspix
0cc26b3d4f
Allow escaping a dollar sign in templates by adding another dollar sign (#876)
* Allow escaping a dollar sign in templates by adding another dollar sign
* Docs for escaping $$ in template, refs #876, #904

Closes #904

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2025-04-08 20:33:39 -07:00
Simon Willison
0950ff360f More verbosity in tests in CI, refs #901 2025-04-08 19:37:42 -07:00
Simon Willison
56d7f2f13a llm prompt -t filepath.yaml support, closes #897 2025-04-08 13:36:48 -07:00
Simon Willison
631835ef71 If template has no $input variable prompt is still concatenated, closes #878 2025-04-07 07:31:28 -07:00
Simon Willison
388a4ea9a2 Attachment and attachment type support for templates, closes #826 2025-04-07 07:20:49 -07:00
Simon Willison
f740a5cbbd
Fragments (#859)
* WIP fragments: schema plus reading but not yet writing, refs #617
* Unique index on fragments.alias, refs #617
* Fragments are now persisted, added basic CLI commands
* Fragment aliases work now, refs #617
* Improved help for -f/--fragment
* Support fragment hash as well
* Documentation for fragments
* Better non-JSON display of llm fragments list
* llm fragments -q search option
* _truncate_string is now truncate_string
* Use condense_json to avoid duplicate data in JSON in DB, refs #617
* Follow up to 3 redirects for fragments
* Python API docs for fragments= and system_fragments=
* Fragment aliases cannot contain a : - this is to ensure we can add custom fragment loaders later on, refs https://github.com/simonw/llm/pull/859#issuecomment-2761534692
* Use template fragments when running prompts
* llm fragments show command plus llm fragments group tests
* Tests for fragments family of commands
* Test for --save with fragments
* Add fragments tables to docs/logging.md
* Slightly better llm fragments --help
* Handle fragments in past conversations correctly
* Hint at llm prompt --help in llm --help, closes #868
* llm logs -f filter plus show fragments in llm logs --json
* Include prompt and system fragments in llm logs -s
* llm logs markdown fragment output and tests, refs #617
2025-04-05 17:22:37 -07:00
Simon Willison
cc94111892 Skip invalid templates in llm templates list, closes #880 2025-04-05 11:32:35 -07:00
Simon Willison
9a24605996 Allow -t to take a URL to a template, closes #856 2025-03-27 20:36:58 -07:00
Simon Willison
1ad7bbd32a
Ability to store options in templates (#845)
* llm prompt --save option support, closes #830
* Fix for templates with just a system prompt, closes #844
* Tests for options from template, refs #830
* Test and bug fix for --save with options, refs #830
* Docs for template options support, refs #830
2025-03-22 17:24:02 -07:00
Simon Willison
bfbcc201b7 Don't require input if template does not use $input, closes #835 2025-03-15 19:17:36 -07:00
Simon Willison
bc692e1f19 Templates only require input if they use $input 2025-03-15 19:06:41 -07:00
Simon Willison
1bebf8b34a --schema t:template-name option, plus improved schema docs
Closes #799, refs #788
2025-02-27 17:25:31 -08:00
Simon Willison
b1fe2e9857 sort_keys=False in --save, closes #798 2025-02-27 16:51:43 -08:00
Simon Willison
a0845874ec
Schema template --save --schema support
* Don't hang on stdin if llm -t template-with-schema
* Docs on using schemas with templates
* Schema in template YAML file example
* Test for --save with --schema

Refs #778
2025-02-27 07:19:15 -08:00
Simon Willison
000e984def --extract support for templates, closes #681 2024-12-19 07:16:48 -08:00
Simon Willison
758ff9ac17 Upgrade to pytest-httpx>=0.33.0 2024-10-28 15:41:34 -07:00
Simon Willison
db1d77f486 assert_all_responses_were_requested=False 2024-10-28 15:41:34 -07:00
Andrew Wason
a466ddf3cd
Fix broken tests. Drop python 3.8. (#580)
* Fix broken tests.  Drop python 3.8.
* Test on Python 3.13 too

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2024-10-27 11:26:47 -07:00
Simon Willison
a83421607a Switch default model to gpt-4o-mini (from gpt-3.5-turbo), refs #536 2024-07-18 11:57:19 -07: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
Simon Willison
4d46ebaa32 OpenAI completion models including gpt-3.5-turbo-instruct, refs #284 2023-09-18 18:34:32 -07:00
Simon Willison
0eeb8393ca llm models and llm templates default to list, closes #167 2023-08-19 20:04:14 -07:00
Simon Willison
2d3ebe7fe1 llm logs now uses new DB schema, refs #91 2023-07-11 07:21:22 -07:00
Simon Willison
a421aab7f0 Renamed template.execute() to template.evaluate() and added type hints 2023-07-10 08:27:28 -07:00
Simon Willison
8f7450bd74 Fixed a test 2023-07-01 11:03:16 -07:00
Simon Willison
714b867e92 -s shortcut for --system, closes #69 2023-07-01 10:46:20 -07:00
Simon Willison
9f1085eece --save now stores -p as default parameters, closes #58 2023-06-23 07:51:50 -07:00
Sébastien De Revière
059bc1a5fe Handle error when no templates are found (#47)
Thanks, @sderev
2023-06-23 07:38:13 -07:00
Simon Willison
f4ce9ea77d Applied Black 2023-06-18 09:48:49 +01: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
0b65aefb6e llm prompt ... --save templatename shortcut, closes #55 2023-06-17 23:22:59 +01:00
Simon Willison
0e0be4db28 Better display of system and prompt, refs #44 2023-06-17 10:10:10 +01:00
Simon Willison
b573096d59 Show system prompts in llm templates list, closes #44 2023-06-17 10:08:30 +01:00
Simon Willison
19e6945dde Fix newline issue in llm templates list, closes #42 2023-06-17 09:51:16 +01:00
Simon Willison
144ffc3f6b Prompt templates
Closes #23
2023-06-17 08:40:46 +01:00