Skip to content

Conversation

yasmewad
Copy link
Contributor

Background

adding AI Traits documentation page.

This will live under Additional Specs on our website.

Links

  • Links to additional context, if necessary
  • Issue #, if applicable (see here for a list of keywords to use for linking issues)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@yasmewad yasmewad requested a review from a team as a code owner August 20, 2025 20:06
@yasmewad yasmewad requested a review from sugmanue August 20, 2025 20:06
@yasmewad yasmewad changed the title Ai traits doc Adding doc entry for AI Traits Aug 20, 2025
A complete example
=====================

The following example demonstrates creative prompt templates that enhance user experience with a weather service:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
=====================
Copy link
Member

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
}
})

Copy link
Member

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
=======================
Copy link
Member

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
============================
Copy link
Member

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.
Copy link
Member

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 {{}})?

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants