Package dev.agenor.core.reflection
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>= 1scoreThreshold- minimumCritiqueResult.score()for early stop; must be in[0.0, 1.0]critiquePrompt- custom prompt template sent to the LLM during critique, ornullto use the default template defined inDefaultReflectionStrategy
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 Summary
ConstructorsConstructorDescriptionReflectionConfig(int maxIterations, double scoreThreshold, String critiquePrompt) Compact constructor — validates fields. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecritiquePromptrecord component.static ReflectionConfigdefaults()Returns aReflectionConfigwith sensible defaults:maxIterations = 2scoreThreshold = 0.8critiquePrompt = null(uses built-in template)final booleanIndicates whether some other object is "equal to" this one.booleanReturnstrueif a custom critique prompt has been provided.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxIterationsrecord component.doubleReturns the value of thescoreThresholdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ReflectionConfig
Compact constructor — validates fields.
-
-
Method Details
-
defaults
Returns aReflectionConfigwith sensible defaults:maxIterations = 2scoreThreshold = 0.8critiquePrompt = null(uses built-in template)
- Returns:
- default configuration instance
-
hasCustomPrompt
public boolean hasCustomPrompt()Returnstrueif a custom critique prompt has been provided.- Returns:
truewhencritiquePromptis non-null and non-blank
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
maxIterations
public int maxIterations()Returns the value of themaxIterationsrecord component.- Returns:
- the value of the
maxIterationsrecord component
-
scoreThreshold
public double scoreThreshold()Returns the value of thescoreThresholdrecord component.- Returns:
- the value of the
scoreThresholdrecord component
-
critiquePrompt
Returns the value of thecritiquePromptrecord component.- Returns:
- the value of the
critiquePromptrecord component
-