Class Result<T>

java.lang.Object
dev.langchain4j.service.Result<T>
Type Parameters:
T - The type of the content. Can be of any return type supported by AI Services, such as String, Enum, MyCustomPojo, etc.

public class Result<T> extends Object
Represents the result of an AI Service invocation. It contains actual content (LLM response) and additional information associated with it, such as:
 - Aggregate TokenUsage over all calls to the ChatModel
 - FinishReason of the final ChatResponse
 - sources (Contents) retrieved during RAG retrieval
 - all executed tools (both requests and results)
 - all intermediate ChatResponses
 - final ChatResponse