Class AiContextUsage

java.lang.Object
org.netxms.client.ai.AiContextUsage

public class AiContextUsage extends Object
LLM context window usage by AI assistant chat
  • Method Details

    • createFromMessage

      public static AiContextUsage createFromMessage(NXCPMessage msg)
      Create context usage object from NXCP message.
      Parameters:
      msg - NXCP message
      Returns:
      context usage object or null if message does not contain context usage information
    • getTokens

      public long getTokens()
      Get number of tokens occupied in context window by last LLM call.
      Returns:
      number of tokens
    • getWindow

      public int getWindow()
      Get context window size of the model that served last LLM call.
      Returns:
      context window size in tokens or 0 if unknown
    • isWindowKnown

      public boolean isWindowKnown()
      Check if context window size is known.
      Returns:
      true if context window size is known
    • getUsagePercentage

      public int getUsagePercentage()
      Get context window usage in percents.
      Returns:
      context window usage in percents or -1 if context window size is unknown
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: