diff --git a/spring-ai-core/src/main/java/org/springframework/ai/chat/ChatResponse.java b/spring-ai-core/src/main/java/org/springframework/ai/chat/ChatResponse.java index 0d0db865cc..2fb3dc45b4 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/chat/ChatResponse.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/chat/ChatResponse.java @@ -78,6 +78,15 @@ public Generation getResult() { return this.generations.get(0); } + /** + * Convenience method equivalent to {@code getResult().getOutput().getContent()}. + * @return The content from the output of the first {@link Generation} in the + * generations list. + */ + public String getContent() { + return getResult().getOutput().getContent(); + } + /** * @return Returns {@link ChatResponseMetadata} containing information about the use * of the AI provider's API.