Annotation Interface V


@Target(PARAMETER) @Retention(RUNTIME) public @interface V
When a parameter of a method in an AI Service is annotated with @V, it becomes a prompt template variable. Its value will be injected into prompt templates defined via @UserMessage, @SystemMessage and AiServices.systemMessageProvider(Function).

Example:

 @UserMessage("Hello, my name is {{name}}. I am {{age}} years old.")
 String chat(@V("name") String name, @V("age") int age);
 

This annotation is necessary only when the "-parameters" option is *not* enabled during Java compilation. If the "-parameters" option is enabled, parameter names can directly serve as identifiers, eliminating the need to define a value of @V annotation. Example:

 @UserMessage("Hello, my name is {{name}}. I am {{age}} years old.")
 String chat(@V String name, @V int age);
 

When using Spring Boot, defining the value of this annotation is not required.

See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Name of a variable (placeholder) in a prompt template.
  • Element Details

    • value

      String value
      Name of a variable (placeholder) in a prompt template.