Repository navigation
Declare the name argument in the greet sample
#216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,17 +42,21 @@ This is [`prompts/greet.md`](https://github.com/cppalliance/runvil-harness/blob/ | |
| ````markdown | ||
| --- | ||
| name: greet | ||
| description: Greet the named input using a Lua-computed value | ||
| description: Greet a name using a Lua-computed value | ||
| runvil: 0 | ||
| args: | ||
| type: object | ||
| properties: | ||
| name: { type: string, description: The name to greet } | ||
| required: [name] | ||
| --- | ||
|
|
||
| Computes a greeting from the input in Lua, substitutes it into the prose, and | ||
| has the model echo it. | ||
| Computes a greeting for its `name` argument in Lua, substitutes it into the prose, and has the model echo it. | ||
|
|
||
| ## Main | ||
|
|
||
| ```lua | ||
| var.greeting = "Hello, " .. args .. "!" | ||
| var.greeting = "Hello, " .. args.name .. "!" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Read the parsed argument from The pinned Engine installs
|
||
| ``` | ||
|
|
||
| Repeat exactly, with no extra words: {{ var.greeting }} | ||
|
|
@@ -62,7 +66,7 @@ return models.infer(prose) | |
| ``` | ||
| ```` | ||
|
|
||
| The prompt declares no models, so `models.infer(prose)` runs on the Host's default model. Given the input `Ada`, the first block in `## Main` builds `Hello, Ada!`, the placeholder puts it into the prose, and `models.infer(prose)` sends that prose to the model. The model's reply is the run's result. A prompt can pick another of the five roles (`default`, `strong`, `small`, `fast`, `creative`) with `models.use(role)`, and the Host decides which model fills each role. The paragraph above `## Main` never reaches the model, because text before the first heading with no Lua block in it is a comment. | ||
| The `args:` key declares the one argument the prompt takes, a required string named `name`. The prompt declares no models, so `models.infer(prose)` runs on the Host's default model. Given the arguments `{"name":"Ada"}`, the first block in `## Main` builds `Hello, Ada!`, the placeholder puts it into the prose, and `models.infer(prose)` sends that prose to the model. The model's reply is the run's result. A prompt can pick another of the five roles (`default`, `strong`, `small`, `fast`, `creative`) with `models.use(role)`, and the Host decides which model fills each role. The paragraph above `## Main` never reaches the model, because text before the first heading with no Lua block in it is a comment. | ||
|
|
||
| ## How it fits together | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the Engine’s argument declaration format.
The pinned Engine expects
argsto map argument names directly to declarations. It rejectstype: objecthere before the prompt can run. Declarename: { type: string, description: The name to greet }directly underargs; arguments are required by default. (raw.githubusercontent.com)