Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a defaults parameter to templates. #57

Merged
merged 1 commit into from
Jun 17, 2023
Merged

Conversation

cmungall
Copy link
Contributor

@cmungall cmungall commented Jun 17, 2023

This allows default values to be filled for templates.

For example:

prompt: Summarize this text in the voice of $voice
defaults:
  voice: GlaDOS

When running without -p it will choose the default:

curl -s 'https://til.simonwillison.net/macos/imovie-slides-and-audio' | \
  strip-tags -m | llm -t summarize

But you can override the defaults with -p:

curl -s 'https://til.simonwillison.net/macos/imovie-slides-and-audio' | \
  strip-tags -m | llm -t summarize -p voice Yoda

I got this:

Text, summarize in Yoda's voice, I will: "Hmm, young padawan. Summary of this text, you seek. Hmmm. ...

This allows default values to be filled for templates.

For example:

prompt: Summarize this text in the voice of $voice
defaults:
  voice: GlaDOS
@simonw
Copy link
Owner

simonw commented Jun 17, 2023

This is a really good idea. I love that your PR includes the tests and documentation.

@simonw simonw merged commit b5cd563 into simonw:main Jun 17, 2023
@simonw simonw added this to the 0.5 milestone Jun 17, 2023
@simonw simonw added the enhancement New feature or request label Jun 17, 2023
simonw added a commit that referenced this pull request Jun 17, 2023
simonw pushed a commit that referenced this pull request Jul 10, 2023
This allows default values to be filled for templates.

For example:
```yaml
prompt: Summarize this text in the voice of $voice
defaults:
  voice: GlaDOS
```
simonw added a commit that referenced this pull request Jul 10, 2023
@simonw simonw mentioned this pull request Jul 12, 2023
simonw added a commit that referenced this pull request Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants