Custom AI actions
Turn your own prompts into buttons in the selection toolbar, such as a dictionary, a grammar explainer or a polite rewrite.
An AI action takes the text you select, sends it to an AI model with a prompt, and shows the answer in a card next to the selection. Duet Translate comes with three, and you can make your own.
Built-in actions
| Action | What it does | Shortcut |
|---|---|---|
| Dictionary | Definition, pronunciation, part of speech, level and the sentence it came from, with a translation | Alt + Shift + D |
| Sentence analysis | Breaks a sentence down and explains its grammar | Alt + Shift + G |
| Improve writing | Marks mistakes and awkward phrasing like a teacher, and fixes them | Alt + Shift + W |
Run an action from the selection toolbar, or select text and press its shortcut.
Make your own
Open Selection Toolbar → Custom AI Actions and click Add AI action. Start from a template or from Blank. A built-in action can’t be edited directly, but Customize makes an editable copy.
Each action has:
- Name and icon: what appears on the toolbar. Icons come from Iconify; paste a name such as
mdi:book-open-variant. - Provider: the AI model that runs it. It must support structured output, which most current models do. Free accounts can use the built-in AI here.
- System prompt and prompt: what you ask the model to do.
- Output schema: the fields the answer must have, such as Term, Definition and Example. The model fills them in, so the result is always in the same shape.
- Layout: how the card shows the fields.
Configure with AI copies a prompt you can paste into ChatGPT, Claude or another assistant; it asks what you want, then tells you what to put in each setting.
Prompt variables
| Variable | Becomes |
|---|---|
{{selection}} |
The text you selected |
{{paragraphs}} |
The paragraphs around the selection, up to 2,000 characters |
{{targetLanguage}} |
Your target language |
{{webTitle}} |
The page title |
{{webUrl}} |
The page’s full address |
{{webContent}} |
The page’s text, up to 2,000 characters |
For example, a prompt for an action that explains slang:
Explain what "{{selection}}" means in this passage, in {{targetLanguage}}.
Say whether it is slang, formal or neutral, and give one more example.
{{paragraphs}}
Layouts
The layout is HTML with Liquid tags, filled in while the answer streams in. Leave it empty to show the fields as a simple list, or start from one of the built-in cards with Restore default.
{{ ["Definition"] }}shows a field’s value. The Field button inserts it for you.{% if ["Example"] != blank %}…{% endif %}shows something only when the field has a value (If filled inserts it).- Clicking an element with
data-speak="{{ ["Term"] }}"reads that value aloud once the answer is done; adddata-speak-lang="es"to pick the voice’s language. The Speak button inserts a ready-made one. - A
<style>block styles this card only.
The preview on the right shows the card with sample data, in light and dark.