PromptRequest.java
package fr.tiogars.chat.domains.prompt.models;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
/**
* Request model for sending a prompt to the AI.
*/
@Schema(description = "Request to send a prompt to the AI")
public record PromptRequest(
@NotBlank
@Schema(description = "The user prompt", example = "Explain me Spring AI")
String prompt,
@Schema(description = "Optional system prompt", example = "You are a helpful assistant")
String systemPrompt,
@Schema(description = "Model to use for the AI response", defaultValue = "llama3.2")
String model,
@Schema(description = "Temperature for AI response", defaultValue = "0.7")
Double temperature,
@Schema(description = "Maximum tokens in response", defaultValue = "1024")
Integer maxTokens
) {
public PromptRequest {
if (model == null) {
model = "llama3.2";
}
if (temperature == null) {
temperature = 0.7;
}
if (maxTokens == null) {
maxTokens = 1024;
}
}
}