AI Prompts in Templates
With version 3.15.1 you can add AI prompts to your templates.
Examples
Example 1 (inside a template):
**Random Annual Goal:** <%- await NotePlan.ai("Return a bullet. Not just the first one, make it random", ["this year"]) %>
**Think:** <%- await NotePlan.ai("Return 3 stoic inspirational quotes") %>

How does it work?
The function definition:
/* * @param { String } * @param { String[] } * @param { Boolean } * @param { String } // from v3.16.3 * @return { Promise<String> } */ NotePlan.ai(prompt, filenames, useStrictFilenames, model)
async
It's async function, use it with await
. It sends a prompt to OpenAI and returns the result as text.
send regular notes
Optionally send the content of your notes by specifying them in the second argument 'filenames', as a list. For example ["note1.md", "folder/note2.md"]. This needs to be the exact path to the note. Your note extension might differ, the default is .txt, if you haven't changed it.
send calendar notes
For calendar notes, you can use YYYYMMDD.md
, like 20241101.md
, or 2024-W10.md
for weeks, etc. Natural language input is also supported like "this week", "today", "tomorrow", "this month", "next year", etc.
Use the third argument (adding 'true') if you don't want to use natural language processing like "this week" (in case you have a note that's called this).
send a series of calendar notes
If you need to send a relative list of calendar notes, every note of the "last 7 days", you can use exactly this as the filename. The structure is as followed:
1. use "next" or "last",
2. define a number, like "7",
3. define one of the timeframes: "days", "weeks", "months", "quarters", "years".
The timeframe also defines what kind of note is being accessed. Use "weeks" if you want to send weekly notes, "days" for daily notes etc.
(Note: available from v3.16.3)
send a folder of regular notes
You can also define a folder to send all the notes inside this folder. Use the path of the folder prefixed with "/", like "/Projects/Work".
(Note: available from v3.16.3)
define a model
If you are using your own Open AI API key, you can define a model, for example "o1", or "o3-mini". By default NotePlan uses GPT-4o.
(Note: available from v3.16.3)