View Javadoc
1   package fr.tiogars.chat.domains.prompt.models;
2   
3   import io.swagger.v3.oas.annotations.media.Schema;
4   import jakarta.validation.constraints.NotBlank;
5   
6   /**
7    * Request model for sending a prompt to the AI.
8    */
9   @Schema(description = "Request to send a prompt to the AI")
10  public record PromptRequest(
11          @NotBlank
12          @Schema(description = "The user prompt", example = "Explain me Spring AI")
13          String prompt,
14  
15          @Schema(description = "Optional system prompt", example = "You are a helpful assistant")
16          String systemPrompt,
17  
18          @Schema(description = "Model to use for the AI response", defaultValue = "llama3.2")
19          String model,
20  
21          @Schema(description = "Temperature for AI response", defaultValue = "0.7")
22          Double temperature,
23  
24          @Schema(description = "Maximum tokens in response", defaultValue = "1024")
25          Integer maxTokens
26  ) {
27      public PromptRequest {
28          if (model == null) {
29              model = "llama3.2";
30          }
31          if (temperature == null) {
32              temperature = 0.7;
33          }
34          if (maxTokens == null) {
35              maxTokens = 1024;
36          }
37      }
38  }