Fix grammar and minor typos in documentation as well as Javadoc.
Closes #1652
This commit is contained in:
committed by
Ilayaperumal Gopinathan
parent
9cf66333b5
commit
c93c6fd5b9
@@ -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");
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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.
|
||||
* <p/>
|
||||
* 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").
|
||||
*
|
||||
* <p/>
|
||||
* Key concepts: - Document: The context or grounding information against which the claim
|
||||
* is checked. - Claim: The statement to be verified against the document.
|
||||
*
|
||||
* <p/>
|
||||
* 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.
|
||||
*
|
||||
* <p/>
|
||||
* 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</a> and the research paper:
|
||||
* <a href="https://arxiv.org/pdf/2404.10774v1">MiniCheck: An Efficient Method for LLM
|
||||
* Hallucination Detection</a>
|
||||
*
|
||||
* <p/>
|
||||
* 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).
|
||||
*
|
||||
* <p/>
|
||||
* 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);
|
||||
|
||||
@@ -53,8 +53,8 @@ public interface FunctionCallingOptions extends ChatOptions {
|
||||
void setFunctionCallbacks(List<FunctionCallback> 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<String> getFunctions();
|
||||
|
||||
|
||||
@@ -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.
|
||||
* <p/>
|
||||
* 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
|
||||
|
||||
}
|
||||
|
||||
@@ -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"),
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user