diff --git a/pom.xml b/pom.xml index 0f21647f8..5401c1656 100644 --- a/pom.xml +++ b/pom.xml @@ -119,7 +119,7 @@ 4.1.1 - 3.2.4 + 3.2.5 6.1.4 4.0.2 1.0.0-beta.8 diff --git a/spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/transformer/PromptContext.java b/spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/transformer/PromptContext.java index e069491d6..7cfce9f89 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/transformer/PromptContext.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/transformer/PromptContext.java @@ -16,18 +16,22 @@ package org.springframework.ai.chat.prompt.transformer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + import org.springframework.ai.chat.prompt.Prompt; import org.springframework.ai.model.Content; -import java.util.*; - /** * The shared, at the moment, mutable, data structure that can be used to implement * ChatBot functionality. * * @author Mark Pollack * @author Christian Tzolov - * @since 1.0 M1 + * @since 1.0.0 */ public class PromptContext { diff --git a/spring-ai-core/src/main/java/org/springframework/ai/model/Content.java b/spring-ai-core/src/main/java/org/springframework/ai/model/Content.java index 7100f6797..a221d7f47 100644 --- a/spring-ai-core/src/main/java/org/springframework/ai/model/Content.java +++ b/spring-ai-core/src/main/java/org/springframework/ai/model/Content.java @@ -6,18 +6,29 @@ import java.util.List; import java.util.Map; /** - * A simple data structure that contains content and metadata. + * Data structure that contains content and metadata. Common parent for the + * {@link org.springframework.ai.document.Document} and the + * {@link org.springframework.ai.chat.messages.Message} classes. * - * @param the type of content in the node * @author Mark Pollack - * @since 1.0 M1 + * @author Christian Tzolov + * @since 1.0.0 */ public interface Content { + /** + * Get the content of the message. + */ String getContent(); + /** + * Get the media associated with the content. + */ List getMedia(); + /** + * return Get the metadata associated with the content. + */ Map getMetadata(); } diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/structured-output-converter.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/structured-output-converter.adoc index aa15e12cd..906010c73 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/structured-output-converter.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/structured-output-converter.adoc @@ -91,14 +91,12 @@ image::structured-output-hierarchy4.jpg[Structured Output Class Hierarchy, width * `MapOutputConverter` - Extends the functionality of `AbstractMessageOutputConverter` with a `FormatProvider` implementation that guides the AI Model to generate an RFC8259 compliant JSON response. Additionally, it incorporates a converter implementation that utilizes the provided `MessageConverter` to translate the JSON payload into a `java.util.Map` instance. * `ListOutputConverter` - Extends the `AbstractConversionServiceOutputConverter` and includes a `FormatProvider` implementation tailored for comma-delimited list output. The converter implementation employs the provided `ConversionService` to transform the model text output into a `java.util.List`. - == Using Converters The following sections provide guides how to use the available converters to generate structured outputs. === Bean Output Converter - The following example shows how to use `BeanOutputConverter` to generate the filmography for an actor. The target record representing actor's filmography: @@ -113,7 +111,7 @@ Here is how to apply the BeanOutputConverter: [source,java] ---- -BeanConverter beanOutputConverter = +BeanOutputConverter beanOutputConverter = new BeanOutputConverter<>(ActorsFilms.class); String format = beanOutputConverter.getFormat();