Fix code style and javadoc
- update spring boot to 3.2.5. - fix Content's JavaDoc. - remove wildcard java imports.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -119,7 +119,7 @@
|
||||
|
||||
<!-- production dependencies -->
|
||||
<spring-cloud-function-context.version>4.1.1</spring-cloud-function-context.version>
|
||||
<spring-boot.version>3.2.4</spring-boot.version>
|
||||
<spring-boot.version>3.2.5</spring-boot.version>
|
||||
<spring-framework.version>6.1.4</spring-framework.version>
|
||||
<stringtemplate.version>4.0.2</stringtemplate.version>
|
||||
<azure-open-ai-client.version>1.0.0-beta.8</azure-open-ai-client.version>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 <T> 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<Media> getMedia();
|
||||
|
||||
/**
|
||||
* return Get the metadata associated with the content.
|
||||
*/
|
||||
Map<String, Object> getMetadata();
|
||||
|
||||
}
|
||||
|
||||
@@ -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<String, Object>` 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<ActorsFilms> beanOutputConverter =
|
||||
BeanOutputConverter<ActorsFilms> beanOutputConverter =
|
||||
new BeanOutputConverter<>(ActorsFilms.class);
|
||||
|
||||
String format = beanOutputConverter.getFormat();
|
||||
|
||||
Reference in New Issue
Block a user