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
  • Constructor Details

    • 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 Details

    • 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

    • 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 a SerializedPromptConfig instance.
      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 a SerializedPromptConfig instance.
      Returns:
      A new builder instance for a serialized prompt configuration.