Package com.tnsai.prompt
Enum Class ModelFamily
- All Implemented Interfaces:
Serializable,Comparable<ModelFamily>,Constable
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)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAnthropic Claude lineage (haiku, sonnet, opus, all generations).Google Gemini lineage (gemini-pro, gemini-flash, gemini 2.x).OpenAI GPT lineage (gpt-3.5, gpt-4, gpt-4o, o1, ...).Meta Llama lineage including Llama-derived open-weight models.Unknown / unmapped. -
Method Summary
Modifier and TypeMethodDescriptionstatic ModelFamilyfromModelId(String modelId) Best-effort map from a model identifier string to a family.orElse(ModelFamily other) Returnsotherifprimary == OTHER, elseprimary.static ModelFamilyReturns the enum constant of this class with the specified name.static ModelFamily[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
GPT
OpenAI GPT lineage (gpt-3.5, gpt-4, gpt-4o, o1, ...). -
CLAUDE
Anthropic Claude lineage (haiku, sonnet, opus, all generations). -
GEMINI
Google Gemini lineage (gemini-pro, gemini-flash, gemini 2.x). -
LLAMA
Meta Llama lineage including Llama-derived open-weight models. -
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
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
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 nameNullPointerException- if the argument is null
-
fromModelId
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
OTHERfor null, blank, or unrecognised input — never throws. The caller can always pass the family explicitly if they know better. -
orElse
Returnsotherifprimary == OTHER, elseprimary. Used to chain a caller-supplied family with a derived default (ModelFamily.fromModelId(...).orElse(GPT)).
-