Add a skill with cards
When. The person must see things of the tenant (products, slots, templates) as cards, with their name, price, image and link.
Steps
cognitive.objectivetells the model when to call the skill.invokenames the operation that returns the rows (method, a read). What the model gives is a parameter (params,set_by: [llm]), sent throughinvoke.argsunder the argument's name:args: {q: "$params.q"}.kindsmakes the rows items: one kind withoutwhentakes them all; several kinds each write theirwhenon a presented field ($fields.<name>).present.fieldsdeclares what each item carries:from(the tenant's field),typeandrole. Roles:title,billed(aprice),link(aurl),cadence,eyebrow(the line above the name),badge(a pill, several allowed),meta(the small line under the name),tile(an image or a text).render.component:carousel,cards,steps(a bundle) orreport(a figure).- For the person to choose, add a submit (Submit the selection); for them to fill something in, guards (A form and its guards).
The example
skill-with-cards.yaml
# A skill whose rows become cards: `invoke` reads the tenant's rows, `kinds` makes them items,
# `present` says which field plays which role on the card, `render` draws them. Nothing is filed
# here: the cards are to look at (a selection and its submit are the next recipes).
# Replace api.example.com and shop.example.com by the API and the site.
station:
id: book-corner
name: Book Corner
global:
language: en
currency: EUR
locale: en-GB
domain:
domain_type: retail
entity_name: book
entity_name_plural: books
voice:
tone: friendly
persona: "a bookseller who reads everything"
rules:
- "Never invent a book or a price: everything comes from the tool."
apis:
- name: books
openapi_url: https://api.example.com/openapi.json
base_url: https://api.example.com
operations:
- {id: searchBooks, access: read}
auth: {type: none}
profiles:
everyone:
when: "true"
grants: [books.searchBooks]
skills:
- name: find-books
cognitive:
objective: "show the books that match what the person asks for: a title, an author, a theme"
params:
q: {type: text, set_by: [llm]}
invoke:
method: searchBooks
args: {q: "$params.q"}
kinds: {book: {}} # one kind, no `when`: every row is a book
present:
fields:
name: {from: title, type: text, role: title} # `name` is the title's field
price: {from: price, type: price, role: billed} # `price` is the billed one
image_url: {from: cover, type: image} # the first image is the card's
author: {from: author, type: text, role: eyebrow} # the line above the name
genre: {from: genre, type: text, role: badge} # a pill; several badges may show
pages: {from: page_count, type: text, role: meta} # the small line under the name
summary: {from: summary, type: text} # in the card's details
page:
from: isbn
type: url
role: link
template: "https://shop.example.com/books/{value}" # `{value}` is the field's value
render: {component: carousel}
The pitfalls
- Three names are reserved:
nameis thetitlefield,pricethebilled,image_urlthe firstimage.code,slugandidare refused: Core writes the item's reference there. - One field per role (but
badge), of the right type:billedasks for aprice,linkaurl,tileanimageor atext. - Only what is declared is read. A key of the tenant's row missing from
presentreaches neither the card, nor awhen, nor a submit ($item.fields.<name>). - A link is never invented. Without a
role: linkfield, the card has no link. Itstemplateknows only{value}and{tenant_url}, and starts with{tenant_url}or an absolutehttp(s)address. - A price that is not a number (
"12,50",null): the row is not offered. - A parameter must be used. A
set_by: [llm]parameter thatinvoke.argsdoes not read is refused;required: falsegoes only on a model parameter withoutdefault. present,selectandsubmitgo withkinds: on a skill withoutkinds, they are refused. So iskindswithoutinvoke.renderhas a closed vocabulary: an unknown component refuses the station.
Reference: Skills, params and
invoke.args, Field
types.