ProgramEvolutionPromptOptions

Options & Configuration · AiDotNet.Configuration

Controls what a program-evolution prompt says, what it shows, and how large it is allowed to get.

For Beginners

This is the control panel for the message your search sends to the AI. The defaults are a good starting point: three high-scoring examples, two deliberately different ones, the last three attempts, and any output the program produced when it last ran. Turn sections off to make prompts cheaper, raise the counts to give the model more context, or replace any wording through TemplateOverrides or a folder of text files named by TemplateDirectory. Call Validate (the prompt builder does this for you) to have every setting checked before a run starts.

How It Works

These options cover the whole prompt surface: which wording is used, how many example programs and past attempts are quoted, whether execution output is included and how much of it, whether the model is asked for edits or a rewrite, and the hard ceilings that stop an untrusted response or a runaway archive from producing a prompt nobody intended to pay for. Nothing here starts a model call; the options are inert until a chat client is supplied.

Several settings exist because the reference OpenEvolve implementation has no equivalent. It has no ceiling on total prompt size, so a long parent plus five examples silently becomes an expensive request. Its evaluator_system_message is accepted from configuration and then never read, because the controller hard-codes its own. Its system message is treated as a template name when it happens to collide with one and as literal text otherwise, so a typo is sent to the model verbatim. Its diff-versus-rewrite choice is a boolean fixed for the whole run. Each of those is addressed here by MaxPromptChars, EvaluatorSystemMessage, SystemMessageMode, and AutoBySize respectively.

Constructors

Constructor Summary
ProgramEvolutionPromptOptions()

Properties

Property Summary
IDictionary<ProgramPromptFragmentKey, string> FragmentOverrides { get; set; } Gets or sets replacement text for individual phrases.
IDictionary<ProgramPromptTemplateKey, string> TemplateOverrides { get; set; } Gets or sets replacement text for individual templates.
IDictionary<string, IReadOnlyList<string>> TemplateVariations { get; set; } Gets or sets the alternative wordings each variation placeholder may be filled with.
IDictionary<string, string> CustomVariables { get; set; } Gets or sets extra named values any template may reference.
ProgramPromptEvolutionMode EvolutionMode { get; set; } Gets or sets whether the model is asked for edits, a rewrite, or either depending on program size.
ProgramPromptSystemMessageMode SystemMessageMode { get; set; } Gets or sets whether SystemMessage names a template or is the text itself.
bool ArtifactSecurityFilter { get; set; } Gets or sets whether artifact text is scrubbed of control sequences and credential-shaped values.
bool IncludeArtifacts { get; set; } Gets or sets whether execution output from the parent’s evaluation is quoted.
bool IncludeCoverageHints { get; set; } Gets or sets whether nearby unoccupied archive cells are suggested as targets.
bool IncludeDiagnostics { get; set; } Gets or sets whether bounded evaluation diagnostics are shown.
bool IncludeFeatureCoordinates { get; set; } Gets or sets whether the parent’s descriptor coordinates are shown.
bool IncludeInspirations { get; set; } Gets or sets whether the inspirations section is rendered.
bool IncludePreviousAttempts { get; set; } Gets or sets whether the previous-attempts section is rendered.
bool ProgramsAsChangesDescription { get; set; } Gets or sets whether programs are represented in prompts by their change descriptions.
bool UseTemplateStochasticity { get; set; } Gets or sets whether a placeholder in the user template may be filled from TemplateVariations.
double FitnessStableBand { get; set; } Gets or sets the absolute fitness difference treated as unchanged.
int AutoFullRewriteBelowChars { get; set; } Gets or sets the parent length below which AutoBySize asks for a rewrite.
int MaxArtifactBytes { get; set; } Gets or sets the maximum UTF-8 bytes of a single artifact that are quoted.
int MaxArtifactCount { get; set; } Gets or sets the maximum number of artifacts quoted.
int MaxDiagnostics { get; set; } Gets or sets the maximum number of diagnostics shown.
int MaxProgramSnippetChars { get; set; } Gets or sets the maximum characters of any one program quoted into the prompt.
int MaxPromptChars { get; set; } Gets or sets the maximum characters of the whole rendered user message.
int NumDiversePrograms { get; set; } Gets or sets how many additional programs are quoted for their difference rather than their score.
int NumPreviousAttempts { get; set; } Gets or sets how many earlier attempts are summarized.
int NumTopPrograms { get; set; } Gets or sets how many high-scoring programs are quoted as examples.
int ScoreDecimals { get; set; } Gets or sets the number of decimal places used when a score is rendered.
int? ComprehensiveImplementationMinLines { get; set; } Gets or sets the line count at or above which an example is labelled comprehensive, or null to skip the label.
int? ConciseImplementationMaxLines { get; set; } Gets or sets the line count at or below which an example is labelled concise, or null to skip the label.
int? IncludeChangesUnderChars { get; set; } Gets or sets the length under which an example’s change description is quoted, or null to never quote it.
int? SuggestSimplificationAfterChars { get; set; } Gets or sets the program length past which simplification is suggested, or null to never suggest it.
string EvaluatorSystemMessage { get; set; } Gets or sets the system message used when a model judges a program, or null for the default template.
string ExtraSystemText { get; set; } Gets or sets extra instructions appended to the system message, or null for none.
string InitialChangesDescription { get; set; } Gets or sets the description given to a program that has none yet; null means none.
string SystemMessage { get; set; } Gets or sets the system message, interpreted according to SystemMessageMode.
string TaskDescription { get; set; } Gets or sets a description of the task the program must accomplish, or null for none.
string TemplateDirectory { get; set; } Gets or sets a directory of <stem>.txt template overrides, or null for none.

Methods

Method Summary
ProgramEvolutionPromptOptions Clone() Creates an independent copy so a running builder is unaffected by later mutation.
ProgramPromptEvolutionMode ResolveEvolutionMode(int parentLength) Decides whether a parent of a given size is edited or rewritten.
ProgramPromptTemplateSet BuildTemplateSet() Builds the validated template set implied by the directory and the per-key overrides.
bool TryParseTemplateKey(string name, ProgramPromptTemplateKey key) Parses a template key from the file stem used for directory overrides.
void Validate() Validates every count, bound, and collection entry.