Fields as Context
Fields as Placeholders in User Prompts
Context is key to a good user prompt. The more context you can provide, the better the AI can understand the user's intent.
Kirby Copilot provides all fields from the same Kirby model as placeholders in user prompts. This allows you to include additional information in the prompt. Wrap the field name in curly braces to use it as a placeholder: {field}
.
For example, suppose your page contains a writer
field with the main content and a textarea
field for the meta description:
fields:
content:
label: Content
type: writer
metaDescription:
label: Meta Description
type: textarea
buttons:
# Only allow the copilot button for this field
- copilot
In the example above, the only allowed button for the textarea
field is the Copilot prompt dialog:
When the user clicks the Copilot button, the value of the content
field can be used as a placeholder in the user prompt to generate a better meta description. The user prompt could look like this:
Before the user prompt above is sent to the AI model, the placeholder {content}
is replaced with the actual field value of the main content.
Encoding Field Values
If the field value is not a primitive (e.g. a string, number, or boolean), it will be encoded as JSON before being used as a placeholder. AI models are pretty good at understanding structured data like JSON.