Annotation Interface Prompt


@Retention(RUNTIME) @Target(METHOD) public @interface Prompt
Annotates a business method of a CDI bean as an exposed prompt template.

The result of a "prompt get" operation is always represented as a PromptResponse. However, the annotated method can also return other types that are converted according to the following rules.

  • If the method returns a PromptMessage then the reponse has no description and contains the single message object.
  • If the method returns a List of PromptMessages then the reponse has no description and contains the list of messages.
  • The method may return a Uni that wraps any of the type mentioned above.
In other words, the return type must be one of the following list:
  • PromptResponse
  • PromptMessage
  • List<PromptMessage>
  • Uni<PromptResponse>
  • Uni<PromptMessage>
  • Uni<List<PromptMessage>>
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    An optional description.
    Each prompt must have a unique name.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Constant value for name() indicating that the annotated element's name should be used as-is.
  • Field Details

    • ELEMENT_NAME

      static final String ELEMENT_NAME
      Constant value for name() indicating that the annotated element's name should be used as-is.
      See Also:
  • Element Details

    • name

      String name
      Each prompt must have a unique name. By default, the name is derived from the name of the annotated method.
      Default:
      "<<element name>>"
    • description

      String description
      An optional description.
      Default:
      ""