Record Class ReflectionConfig

java.lang.Object
java.lang.Record
dev.agenor.core.reflection.ReflectionConfig
Record Components:
maxIterations - maximum number of revise cycles before returning the best result so far; must be >= 1
scoreThreshold - minimum CritiqueResult.score() for early stop; must be in [0.0, 1.0]
critiquePrompt - custom prompt template sent to the LLM during critique, or null to use the default template defined in DefaultReflectionStrategy

public record ReflectionConfig(int maxIterations, double scoreThreshold, String critiquePrompt) extends Record
Configuration for the Generate → Critique → Revise reflection loop.

Pass an instance of this record to ReflectionStrategy.critique(java.lang.String, java.lang.String, dev.agenor.core.reflection.ReflectionConfig) to control iteration limits, quality thresholds, and the critique prompt template.

Use defaults() for sensible out-of-the-box settings, or construct a custom instance when fine-grained control is needed:


 // Default: 2 iterations, threshold 0.8, built-in critique prompt
 ReflectionConfig config = ReflectionConfig.defaults();

 // Custom: stricter quality bar, more iterations, domain-specific prompt
 ReflectionConfig config = new ReflectionConfig(
     3,
     0.9,
     "Evaluate the following output for factual accuracy and completeness. " +
     "Reply with 'score: X.X' and detailed feedback.");
 
Since:
0.12.0
See Also:
  • Constructor Details

    • ReflectionConfig

      public ReflectionConfig(int maxIterations, double scoreThreshold, String critiquePrompt)
      Compact constructor — validates fields.
  • Method Details

    • defaults

      public static ReflectionConfig defaults()
      Returns a ReflectionConfig with sensible defaults:
      • maxIterations = 2
      • scoreThreshold = 0.8
      • critiquePrompt = null (uses built-in template)
      Returns:
      default configuration instance
    • hasCustomPrompt

      public boolean hasCustomPrompt()
      Returns true if a custom critique prompt has been provided.
      Returns:
      true when critiquePrompt is non-null and non-blank
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • maxIterations

      public int maxIterations()
      Returns the value of the maxIterations record component.
      Returns:
      the value of the maxIterations record component
    • scoreThreshold

      public double scoreThreshold()
      Returns the value of the scoreThreshold record component.
      Returns:
      the value of the scoreThreshold record component
    • critiquePrompt

      public String critiquePrompt()
      Returns the value of the critiquePrompt record component.
      Returns:
      the value of the critiquePrompt record component