diff --git a/spring-ai-core/src/main/java/org/springframework/ai/chat/messages/MessageType.java b/spring-ai-core/src/main/java/org/springframework/ai/chat/messages/MessageType.java index 876b004ee..4ceb76b3a 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/chat/messages/MessageType.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/chat/messages/MessageType.java @@ -17,36 +17,36 @@ package org.springframework.ai.chat.messages; /** - * The MessageType enum represents the type of message in a chat application. It can be - * one of the following: USER, ASSISTANT, SYSTEM, FUNCTION. + * Enumeration representing types of {@link Message Messages} in a chat application. It + * can be one of the following: USER, ASSISTANT, SYSTEM, FUNCTION. */ public enum MessageType { /** - * A message of the type 'user' passed as input Messages with the user role are from - * the end-user or developer. + * A {@link Message} of type {@literal user}, having the user role and originating + * from an end-user or developer. * @see UserMessage */ USER("user"), /** - * A message of the type 'assistant' passed as input Messages with the message is - * generated as a response to the user. + * A {@link Message} of type {@literal assistant} passed in subsequent input + * {@link Message Messages} as the {@link Message} generated in response to the user. * @see AssistantMessage */ ASSISTANT("assistant"), /** - * A message of the type 'system' passed as input Messages with high level - * instructions for the conversation, such as behave like a certain character or - * provide answers in a specific format. + * A {@link Message} of type {@literal system} passed as input {@link Message + * Messages} containing high-level instructions for the conversation, such as behave + * like a certain character or provide answers in a specific format. * @see SystemMessage */ SYSTEM("system"), /** - * A message of the type 'function' passed as input Messages with a function content - * in a chat application. + * A {@link Message} of type {@literal function} passed as input {@link Message + * Messages} with function content in a chat application. * @see ToolResponseMessage */ TOOL("tool"); diff --git a/spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/ChatOptions.java b/spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/ChatOptions.java index e6623365d..205b736c0 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/ChatOptions.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/ChatOptions.java @@ -22,7 +22,8 @@ import org.springframework.ai.model.ModelOptions; import org.springframework.lang.Nullable; /** - * The ChatOptions represent the common options, portable across different chat models. + * {@link ModelOptions} representing the common options that are portable across different + * chat models. */ public interface ChatOptions extends ModelOptions { diff --git a/spring-ai-core/src/main/java/org/springframework/ai/evaluation/FactCheckingEvaluator.java b/spring-ai-core/src/main/java/org/springframework/ai/evaluation/FactCheckingEvaluator.java index 77bd676ed..c0d3676d7 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/evaluation/FactCheckingEvaluator.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/evaluation/FactCheckingEvaluator.java @@ -21,21 +21,21 @@ import java.util.Collections; import org.springframework.ai.chat.client.ChatClient; /** - * The FactCheckingEvaluator class implements a method for evaluating the factual accuracy - * of Large Language Model (LLM) responses against provided context. - * + * Implementation of {@link Evaluator} used to evaluate the factual accuracy of Large + * Language Model (LLM) responses against provided context. + *
* This evaluator addresses a specific type of potential error in LLM outputs known as * "hallucination" in the context of grounded factuality. It verifies whether a given * statement (the "claim") is logically supported by a provided context (the "document"). - * + * * Key concepts: - Document: The context or grounding information against which the claim * is checked. - Claim: The statement to be verified against the document. - * + * * The evaluator uses a prompt-based approach with a separate, typically smaller and more * efficient LLM to perform the fact-checking. This design choice allows for * cost-effective and rapid verification, which is crucial when evaluating longer LLM * outputs that may require multiple verification steps. - * + * * Implementation note: For efficient and accurate fact-checking, consider using * specialized models like Bespoke-Minicheck, a grounded factuality checking model * developed by Bespoke Labs and available in Ollama. Such models are specifically @@ -45,12 +45,12 @@ import org.springframework.ai.chat.client.ChatClient; * Hallucinations with Bespoke-Minicheck and the research paper: * MiniCheck: An Efficient Method for LLM * Hallucination Detection - * + * * Note: This evaluator is specifically designed to fact-check statements against given * information. It's not meant for other types of accuracy tests, like quizzing an AI on * obscure facts without giving it any reference material to work with (so-called 'closed * book' scenarios). - * + * * The evaluation process aims to determine if the claim is supported by the document, * returning a boolean result indicating whether the fact-check passed or failed. * @@ -79,7 +79,6 @@ public class FactCheckingEvaluator implements Evaluator { this.chatClientBuilder = chatClientBuilder; } - @Override /** * Evaluates whether the response content in the EvaluationRequest is factually * supported by the context provided in the same request. @@ -88,6 +87,7 @@ public class FactCheckingEvaluator implements Evaluator { * @return An EvaluationResponse indicating whether the claim is supported by the * document */ + @Override public EvaluationResponse evaluate(EvaluationRequest evaluationRequest) { var response = evaluationRequest.getResponseContent(); var context = doGetSupportingData(evaluationRequest); diff --git a/spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallingOptions.java b/spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallingOptions.java index 722d7f24f..f977a4ecf 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallingOptions.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallingOptions.java @@ -53,8 +53,8 @@ public interface FunctionCallingOptions extends ChatOptions { void setFunctionCallbacks(List