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 functionCallbacks); /** - * @return List of function names from the ChatModel registry to be used in the next - * chat completion requests. + * @return <@link Set> of function names from the ChatModel registry to be used in the + * next chat completion requests. */ Set getFunctions(); diff --git a/spring-ai-core/src/main/java/org/springframework/ai/observation/conventions/AiObservationMetricNames.java b/spring-ai-core/src/main/java/org/springframework/ai/observation/conventions/AiObservationMetricNames.java index fb8ca023a..4b9263ba3 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/observation/conventions/AiObservationMetricNames.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/observation/conventions/AiObservationMetricNames.java @@ -17,8 +17,9 @@ package org.springframework.ai.observation.conventions; /** - * Collection of metric names used in AI observations. Based on the OpenTelemetry Semantic - * Conventions for AI Systems. + * Enumeration of metric names used in AI observations. + *

+ * Based on OpenTelemetry's Semantic Conventions for AI systems. * * @author Thomas Vitale * @since 1.0.0 @@ -28,10 +29,7 @@ package org.springframework.ai.observation.conventions; */ public enum AiObservationMetricNames { -// @formatter:off - - OPERATION_DURATION("gen_ai.client.operation.duration"), - TOKEN_USAGE("gen_ai.client.token.usage"); + OPERATION_DURATION("gen_ai.client.operation.duration"), TOKEN_USAGE("gen_ai.client.token.usage"); private final String value; @@ -43,6 +41,4 @@ public enum AiObservationMetricNames { return this.value; } -// @formatter:on - } diff --git a/spring-ai-core/src/main/java/org/springframework/ai/vectorstore/observation/VectorStoreObservationContext.java b/spring-ai-core/src/main/java/org/springframework/ai/vectorstore/observation/VectorStoreObservationContext.java index 07da0990d..cf5454629 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/vectorstore/observation/VectorStoreObservationContext.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/vectorstore/observation/VectorStoreObservationContext.java @@ -152,11 +152,11 @@ public class VectorStoreObservationContext extends Observation.Context { public enum Operation { /** - * VectorStore delete operation. + * VectorStore add operation. */ ADD("add"), /** - * VectorStore add operation. + * VectorStore delete operation. */ DELETE("delete"), /** diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc index 872bfbd5b..e47b0ad5a 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc @@ -3,10 +3,11 @@ This section offers jumping off points for how to get started using Spring AI. -You should follow the steps in each of the following section according to your needs. +You should follow the steps in each of the following sections according to your needs. NOTE: Spring AI supports Spring Boot 3.2.x and 3.3.x +[[spring-initializr]] == Spring Initializr Head on over to https://start.spring.io/[start.spring.io] and select the AI Models and Vector Stores that you want to use in your new applications.