Class SerializedPromptConfig.Builder
java.lang.Object
de.xima.fc.prompt.service.SerializedPromptConfig.Builder
- Enclosing class:
SerializedPromptConfig
A builder for creating instances of
SerializedPromptConfig.
Example usage:
SerializedPromptConfig config = SerializedPromptConfig.builder()
.addBinaryData("fileKey", promptBinaryData)
.addTextData("textKey", "Some text")
.build();
- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptionaddBinaryData(String key, IPromptBinaryData value) Adds a single binary data object to the existing binary data map for the specified key.addBinaryData(String key, List<IPromptBinaryData> values) Adds a list of binary data objects to the existing binary data map for the specified key.addBinaryData(Map<String, List<IPromptBinaryData>> binaryData) Adds binary data to the existing binary data map.addTextData(String key, String value) Adds a single text value to the existing text data map for the specified key.addTextData(String key, List<String> value) Adds a list of text values to the existing text data map for the specified key.addTextData(Map<String, List<String>> textData) Adds text data to the existing text data map.binaryData(String key) Gets the binary data associated with the given key, or an empty list if no such value exists.binaryData(String key, IPromptBinaryData value) Sets the binary data for the specified key to a single value.binaryData(String key, List<IPromptBinaryData> values) Sets the binary data for the specified key to a list of values.binaryData(Map<String, List<IPromptBinaryData>> binaryData) Clears all existing binary data and replaces it with the provided binary data.Gets the keys of all binary data entries in this builder.build()Builds a newSerializedPromptConfiginstance with the current state of this builder.firstBinaryData(String key) Gets the first binary data associated with the given key, or null if no such value exists.firstTextData(String key) Gets the first text data associated with the given key, or null if no such value exists.Gets the text data associated with the given key, or an empty list if no such value exists.Sets the text data for the specified key to a single value.Sets the text data for the specified key to a list of values.Clears all existing text data and replaces it with the provided text data.Gets the keys of all text data entries in this builder.
-
Method Details
-
addBinaryData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder addBinaryData(Map<String, List<IPromptBinaryData>> binaryData) Adds binary data to the existing binary data map. If values exists already for a key, the new data is appended to the existing values.- Parameters:
binaryData- The binary data to add.- Returns:
- This builder instance for method chaining.
-
addBinaryData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder addBinaryData(String key, IPromptBinaryData value) Adds a single binary data object to the existing binary data map for the specified key. If the key already has values, the new value is appended to the existing list.- Parameters:
key- The key for which to store the binary data. If null or empty, it will be ignored.value- The binary data object to add. If null, it will be ignored.- Returns:
- This builder instance for method chaining.
-
addBinaryData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder addBinaryData(String key, List<IPromptBinaryData> values) Adds a list of binary data objects to the existing binary data map for the specified key. If the key already has values, the new values are appended to the existing list.- Parameters:
key- The key for which to store the binary data. If null or empty, it will be ignored.values- The list of binary data objects to add. If null, it will be ignored.- Returns:
- This builder instance for method chaining.
-
addTextData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder addTextData(Map<String, List<String>> textData) Adds text data to the existing text data map. If values exists already for a key, the new data is appended to the existing values.- Parameters:
textData- The text data to add.- Returns:
- This builder instance for method chaining.
-
addTextData
Adds a single text value to the existing text data map for the specified key. If the key already has values, the new value is appended to the existing list.- Parameters:
key- The key for which to store the text value. If null or empty, it will be ignored.value- The text value to add. If null, it will be ignored.- Returns:
- This builder instance for method chaining.
-
addTextData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder addTextData(String key, List<String> value) Adds a list of text values to the existing text data map for the specified key. If the key already has values, the new values are appended to the existing list.- Parameters:
key- The key for which to store the text values. If null or empty, it will be ignored.value- The list of text values to add. If null, it will be ignored.- Returns:
- This builder instance for method chaining.
-
binaryData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder binaryData(String key, List<IPromptBinaryData> values) Sets the binary data for the specified key to a list of values. If values already exist for the key, they are cleared and replaced with the new values.- Parameters:
key- The key for which to set the binary data. If null or empty, it will be ignored.values- The list of binary data objects to set. If null, sets the key to an empty list.- Returns:
- This builder instance for method chaining.
-
binaryData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder binaryData(String key, IPromptBinaryData value) Sets the binary data for the specified key to a single value. If values already exist for the key, they are cleared and replaced with the new value.- Parameters:
key- The key for which to set the binary data. If null or empty, it will be ignored.value- The binary data object to set. If null, sets the key to an empty list.- Returns:
- This builder instance for method chaining.
-
binaryData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder binaryData(Map<String, List<IPromptBinaryData>> binaryData) Clears all existing binary data and replaces it with the provided binary data.- Parameters:
binaryData- The new binary data to set.- Returns:
- This builder instance for method chaining.
-
binaryData
Gets the binary 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 binary data associated with the key, or an empty list if not found.
-
binaryDataKeys
-
build
Builds a newSerializedPromptConfiginstance with the current state of this builder. Subsequent modifications to this builder will not affect the created instance.- Returns:
- A new instance of serialized prompt configuration with the current data.
-
firstBinaryData
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
-
textData
-
textData
Sets the text data for the specified key to a single value. If values already exist for the key, they are cleared and replaced with the new value.- Parameters:
key- The key for which to set the text value. If null or empty, it will be ignored.value- The text value to set. If null, sets the key to an empty list.- Returns:
- This builder instance for method chaining.
-
textData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder textData(String key, List<String> values) Sets the text data for the specified key to a list of values. If values already exist for the key, they are cleared and replaced with the new values.- Parameters:
key- The key for which to set the text data. If null or empty, it will be ignored.values- The list of text values to set. If null, sets the key to an empty list.- Returns:
- This builder instance for method chaining.
-
textData
@CanIgnoreReturnValue public SerializedPromptConfig.Builder textData(Map<String, List<String>> textData) Clears all existing text data and replaces it with the provided text data.- Parameters:
textData- The new text data to set.- Returns:
- This builder instance for method chaining.
-
textDataKeys
-