Enum Class ModelFamily

java.lang.Object
java.lang.Enum<ModelFamily>
com.tnsai.prompt.ModelFamily
All Implemented Interfaces:
Serializable, Comparable<ModelFamily>, Constable

public enum ModelFamily extends Enum<ModelFamily>
Coarse-grained classification of LLM model families for prompt shading (issue #13). Different families respond to different enforcement registers — Claude over-indexes on imperatives, GPT and Gemini benefit from explicit MUST framings, Llama / open-weight models sit in between.

AgentPromptBuilder consumes this enum to vary specific sections (currently the tool-usage block); the rest of the prompt is family-agnostic. The default path — when callers don't pass a family — uses OTHER, which preserves the historical language exactly.

Since:
0.5.0 (issue #13)
  • Enum Constant Details

    • GPT

      public static final ModelFamily GPT
      OpenAI GPT lineage (gpt-3.5, gpt-4, gpt-4o, o1, ...).
    • CLAUDE

      public static final ModelFamily CLAUDE
      Anthropic Claude lineage (haiku, sonnet, opus, all generations).
    • GEMINI

      public static final ModelFamily GEMINI
      Google Gemini lineage (gemini-pro, gemini-flash, gemini 2.x).
    • LLAMA

      public static final ModelFamily LLAMA
      Meta Llama lineage including Llama-derived open-weight models.
    • OTHER

      public static final ModelFamily OTHER
      Unknown / unmapped. Default for callers that don't classify their model. The prompt builder uses the historical neutral language for this value, so existing call sites get exactly today's prompt.
  • Method Details

    • values

      public static ModelFamily[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ModelFamily valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromModelId

      public static ModelFamily fromModelId(String modelId)
      Best-effort map from a model identifier string to a family. Uses substring matching on a lower-cased copy — not regex — because the goal is to catch common naming conventions (claude-opus-4-7, openai/gpt-4o-mini, gemini-2.5-pro), not exhaustively classify every model the world ships.

      Returns OTHER for null, blank, or unrecognised input — never throws. The caller can always pass the family explicitly if they know better.

    • orElse

      public ModelFamily orElse(ModelFamily other)
      Returns other if primary == OTHER, else primary. Used to chain a caller-supplied family with a derived default (ModelFamily.fromModelId(...).orElse(GPT)).