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 YAML, as this is hierarchical and token-efficient, as well as easy to generate using Jackson.
Author:
Florian Hotze - Initial contribution
  • Constructor Details

    • LLMItemSerializer

      public LLMItemSerializer()
  • Method Details

    • serialize

      public static String serialize(Collection<Item> items)
      Serializes a collection of items.
      Parameters:
      items - the items to serialize
      Returns:
      the serialized representation (YAML) of the items