-
Notifications
You must be signed in to change notification settings - Fork 237
Adding doc entry for AI Traits #2750
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
base: main
Are you sure you want to change the base?
Conversation
f1ea7c8
to
498e998
Compare
A complete example | ||
===================== | ||
|
||
The following example demonstrates creative prompt templates that enhance user experience with a weather service: |
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.
The following example demonstrates creative prompt templates that enhance user experience with a weather service: | |
The following example demonstrates creative prompt templates that enhance the user experience with a weather service: |
|
||
|
||
A complete example | ||
===================== |
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.
formatting: too many =
arguments: VacationPlannerInput | ||
} | ||
}) | ||
|
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.
remove line break
|
||
|
||
Use cases for prompts | ||
======================= |
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.
formatting: too many =
|
||
|
||
Template Placeholder Syntax | ||
============================ |
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.
formatting: too many =
Template Placeholder Syntax | ||
============================ | ||
|
||
Prompt templates use ``{{parameterName}}`` syntax to reference parameters from the associated ``arguments`` structure. This can be useful to reference and interpolate members of arguments when accepting user input for prompts in Model Context Protocol (MCP) servers. |
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.
any way to escape templates (e.g., what if a template is supposed to generate a mustache template that uses literal {{}}
)?
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.
Good point. I did a little test. Ideally, this becomes the responsibility of the processor which in our case is Smithy java MCP Server.
I tested with this example and it works well:
template_escape_example: {
description: "Example showing how to escape template literals"
template: "Generate mustache template for {{loginId}}: \\{{\\{{name\\}\\}}} works at \\{{\\{{company\\}\\}}}"
arguments: GetEmployeeDetailsInput
preferWhen: "User needs to generate templates with literal mustache syntax"
}
It handled it correctly in Q CLI:
> @template_escape_example yasmewad
> Here's a mustache template for yasmewad:
🛠️ Using tool: fs_write
⋮
● Path: /Volumes/workplace/smithy-java-2/yasmewad-template.mustache
+ 1: {{name}} works at {{company}}.
⋮
↳ Purpose: Create mustache template with name and company variables
It correctly applied the arguments yasmewad
to the {{login}}
and created a file with escaped text.
Background
adding AI Traits documentation page.
This will live under
Additional Specs
on our website.Links
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.