Package de.xima.fc.prompt.service
Class SerializedPromptConfig
- java.lang.Object
-
- de.xima.fc.prompt.service.SerializedPromptConfig
-
public final class SerializedPromptConfig extends Object
Represents a serialized prompt configuration, with plain text and binary values. Each value is identified by a unique key.Instances of this class are immutable.
- Since:
- 8.5.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSerializedPromptConfig.BuilderA builder for creating instances ofSerializedPromptConfig.
-
Constructor Summary
Constructors Constructor Description SerializedPromptConfig(Map<String,List<String>> textData, Map<String,List<IPromptBinaryData>> binaryData)Creates a new serialized prompt configuration with the given text and binary data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,List<IPromptBinaryData>>binaryData()Gets the binary data, indexed by their keys.List<IPromptBinaryData>binaryData(String key)Returns the binary data associated with the given key, or null if no such value exists.static SerializedPromptConfig.Builderbuilder()Creates a new builder for configuring aSerializedPromptConfiginstance.SerializedPromptConfig.Builderderive()static SerializedPromptConfigempty()Returns an empty serialized prompt configuration with no data.IPromptBinaryDatafirstBinaryData(String key)Gets the first binary data associated with the given key, or null if no such value exists.StringfirstTextData(String key)Gets the first text data associated with the given key, or null if no such value exists.static SerializedPromptConfig.BuilderserializedPromptConfigBuilder()Creates a new builder for configuring aSerializedPromptConfiginstance.Map<String,List<String>>textData()Gets the text data, indexed by their keys.List<String>textData(String key)Gets the text data associated with the given key, or an empty list if no such value exists.
-
-
-
Constructor Detail
-
SerializedPromptConfig
public SerializedPromptConfig(Map<String,List<String>> textData, Map<String,List<IPromptBinaryData>> binaryData)
Creates a new serialized prompt configuration with the given text and binary data.- Parameters:
textData- The text data, indexed by their keys. Each key maps to a list of strings, allowing for multiple values. If null, it will be treated as an empty map.binaryData- The binary data, indexed by their keys. Each key maps to a list of binary data objects, allowing for multiple values. If null, it will be treated as an empty map.
-
-
Method Detail
-
binaryData
public List<IPromptBinaryData> binaryData(String key)
Returns the binary data associated with the given key, or null if no such value exists.- Parameters:
key- The key to look up.- Returns:
- The file value associated with the key, or null if not found.
-
binaryData
public Map<String,List<IPromptBinaryData>> binaryData()
Gets the binary data, indexed by their keys. Each key maps to a list of binary data objects, allowing for multiple values.- Returns:
- A map with all binary data, where the key is the file key.
-
derive
public SerializedPromptConfig.Builder derive()
-
firstBinaryData
public IPromptBinaryData firstBinaryData(String key)
Gets the first binary data associated with the given key, or null if no such value exists.- Parameters:
key- The key to look up.- Returns:
- The first binary data associated with the key, or null if not found.
-
firstTextData
public String firstTextData(String key)
Gets the first text data associated with the given key, or null if no such value exists.- Parameters:
key- The key to look up.- Returns:
- The first text data associated with the key, or null if not found.
-
textData
public Map<String,List<String>> textData()
Gets the text data, indexed by their keys. Each key maps to a list of strings, allowing for multiple values.- Returns:
- A map with all text data, where the key is the text key.
-
textData
public List<String> textData(String key)
Gets the text data associated with the given key, or an empty list if no such value exists.- Parameters:
key- The key to look up.- Returns:
- A list with the text data associated with the key, or an empty list if not found.
-
builder
public static SerializedPromptConfig.Builder builder()
Creates a new builder for configuring aSerializedPromptConfiginstance.- Returns:
- A new builder instance for a serialized prompt configuration.
-
empty
public static SerializedPromptConfig empty()
Returns an empty serialized prompt configuration with no data.- Returns:
- An empty instance with no data.
-
serializedPromptConfigBuilder
public static SerializedPromptConfig.Builder serializedPromptConfigBuilder()
Creates a new builder for configuring aSerializedPromptConfiginstance.- Returns:
- A new builder instance for a serialized prompt configuration.
-
-