DavidSouther / ailly

Your AI Writing Ally
Other
10 stars 6 forks source link

Prompt Templates #14

Closed DavidSouther closed 7 months ago

DavidSouther commented 7 months ago

Pass prompts through templates. Provide a library of common snippets (eg: common instructions for telling models to user certain output formats, prefer certain thinking styles, or ignore types of information). Allow plugin and user defined additional parameters, for instance, project "You are a..." prompts.

  1. Include ESM mustache
  2. Pass content through mustache on load.
  3. Load template view object by shallow merging, in order (later overrides earlier): a. Default global view with documented formatting control snippets b. Additional Engine view with documented model-specific snippets c. Additional Plugin view for project plugins to provide snippets d. --template repeated command line flag to provide additional snippets in JSON (YAML?) format e. template: key in .aillyrc grey matter
  4. Suppress template expansion with template: false in greymatter (inherited through .aillyrc) or --no-template command line flag

Example:

.aillyrc

{{project.user}}
{{project.overview}}
In this task, we are brainstorming for a corporate branding.
The brand is a new line of seltzer.

10_overview.md

{{output.format.ad_json}}

Create an an ad spot for this product.

with the view:

{
  project: {
    user: "You are a corporate marketing consultant.",
    project: "The group works as an embedded team and views the clients' success as their own."
  },
  output: {
    prose: "Your output should be prose, with no additional formatting.",
    markdown: "Your output should use full markdown syntax.",
    python: "Your output should only contain Python code, within a markdown code fence:\n\n```py\n#<your code>\n```"
    ad_json: "Your output will be a JSON document with fields 'campaign_id' and 'ad_copy'."
  }
}

Would fill out:

System:
You are a...
The group works as…
In this task…
The brand...

Human:
Your output will be...
Create an an ad spot for this product.