Package com.tnsai.llm

Record Class LLMResolver.LLMSpec

java.lang.Object
java.lang.Record
com.tnsai.llm.LLMResolver.LLMSpec
Record Components:
model - the model name
temperature - the sampling temperature (may be null)
All Implemented Interfaces:
LLMSpecSource
Enclosing class:
LLMResolver

public static record LLMResolver.LLMSpec(String model, Float temperature) extends Record implements LLMSpecSource
LLM configuration record for passing model settings.

This is a simple config holder that can be used in the resolution chain. For framework-agnostic config, see PortableLLMSpec in tnsai-integration.

Implements LLMSpecSource for interoperability with other config types.

  • Constructor Details

    • LLMSpec

      public LLMSpec(String model, Float temperature)
      Creates an instance of a LLMSpec record class.
      Parameters:
      model - the value for the model record component
      temperature - the value for the temperature record component
  • Method Details

    • of

      public static LLMResolver.LLMSpec of(String model)
      Creates a config with just a model name.
      Parameters:
      model - the model name
      Returns:
      new LLM config
    • of

      public static LLMResolver.LLMSpec of(String model, float temperature)
      Creates a config with model and temperature.
      Parameters:
      model - the model name
      temperature - the temperature
      Returns:
      new LLM config
    • hasTemperature

      public boolean hasTemperature()
      Description copied from interface: LLMSpecSource
      Checks if temperature is specified.
      Specified by:
      hasTemperature in interface LLMSpecSource
      Returns:
      true if temperature is not null
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • model

      public String model()
      Returns the value of the model record component.
      Specified by:
      model in interface LLMSpecSource
      Returns:
      the value of the model record component
    • temperature

      public Float temperature()
      Returns the value of the temperature record component.
      Specified by:
      temperature in interface LLMSpecSource
      Returns:
      the value of the temperature record component