Class LLMItemSerializer

java.lang.Object
org.openhab.core.voice.text.interpreter.llm.LLMItemSerializer

@NonNullByDefault public class LLMItemSerializer extends Object
LLMItemSerializer is a utility class to serialize a collection of items (both semantic and non-semantic) into a structured, hierarchical string representation for passing into the context of a Large Language Model (LLM) based HumanLanguageInterpreter. The output format is a custom format designed to be highly token-efficient.
Author:
Florian Hotze - Initial contribution
  • Constructor Details

    • LLMItemSerializer

      public LLMItemSerializer()
  • Method Details

    • serialize

      public static String serialize(Collection<Item> items, @Nullable Locale locale)
      Serializes a collection of items, localizing command options with the given locale if available.
      Parameters:
      items - the items to serialize
      locale - the locale to use for command options localization
      Returns:
      the serialized representation (YAML) of the items