Cameleer

AI Prompt component

The ai-prompt component turns a route into a prompt template an AI client can offer its user: the route renders the prompt from the arguments, and its body is the prompt text or a list of messages.

Scheme: ai-prompt: · Crate: cameleer-ai · Cargo feature: ai · Consumer: yes · Producer: yes · Apache Camel: no equivalent (Cameleer extension)

When to use it

  • Ship prompts that use live data: a review prompt that includes the style guide, a support prompt that includes the customer's open tickets.
  • Keep prompts versioned with the routes that serve the data they use.

URI format

text
ai-prompt:name[?options]

Example

yaml example: ai-prompt-code-review
- route:
    from:
      uri: ai-prompt:code-review
      parameters:
        description: Review code against our style guide
        argument.code.description: The code to review
        argument.code.required: true
        argument.language: The programming language
      steps:
        - setBody:
            simple: "Review this ${header.language} code against our style guide:\n${header.code}"

A body that is a list of messages sets the roles:

json
[{"role": "user", "content": "Summarise this ticket"}, {"role": "assistant", "content": "Which ticket?"}]

From Rust, AiRegistry::of(&ctx)?.get_prompt("code-review", &args)? returns the messages. From a route, to: ai-prompt:code-review with a JSON object of arguments as the body returns the messages as a list of {role, content} maps.

Options

optiondefaultdescription
titleA human-readable name
descriptionWhat the prompt is for
argument.NAMEDeclares an argument with this description
argument.NAME.descriptionThe argument's description
argument.NAME.requiredfalseWhether the argument is required
argument.NAME.valuesComma-separated completion values for the argument (MCP completion/complete)
tagsComma-separated tags

Message headers

headerdirectiondescription
each declared argument, by nameinThe argument values (undeclared ones are dropped)
CamelAiPromptNameinThe prompt's name

Behavior

  • A text body becomes one user message. A list of {role, content} maps (roles user and assistant) becomes those messages. A content that is an MCP content block (an image, an embedded resource) is passed on as it is.
  • A missing required argument fails before the route runs.
  • An unknown prompt fails with PromptNotFoundException.

Found a problem?

If something on this page doesn't match what Cameleer does, please open an issue, or fork the repository, fix it, add a test, run cargo test --workspace and open a pull request.

Edit this page on GitHub