Clarify semantic reconciliation candidate numbers
This commit is contained in:
@@ -65,12 +65,13 @@ const (
|
||||
|
||||
// Result owns the safe plan and neutral diagnostics from one call.
|
||||
type Result struct {
|
||||
disposition ResultDisposition
|
||||
plan Plan
|
||||
issues []Issue
|
||||
discardedGroupCount int
|
||||
candidateMappings []CandidateMapping
|
||||
modelCandidate *contracts.ModelCandidate
|
||||
disposition ResultDisposition
|
||||
plan Plan
|
||||
issues []Issue
|
||||
discardedGroupCount int
|
||||
candidateNumberRange CandidateNumberRange
|
||||
candidateMappings []CandidateMapping
|
||||
modelCandidate *contracts.ModelCandidate
|
||||
}
|
||||
|
||||
// Disposition returns the classified outcome.
|
||||
@@ -85,11 +86,27 @@ func (result Result) Issues() []Issue { return append([]Issue(nil), result.issue
|
||||
// DiscardedGroupCount returns the number of excluded proposal groups.
|
||||
func (result Result) DiscardedGroupCount() int { return result.discardedGroupCount }
|
||||
|
||||
// CandidateMappings returns the request-local handle mapping used for this call.
|
||||
// CandidateNumberRange returns the exact request-local range used for this call.
|
||||
func (result Result) CandidateNumberRange() CandidateNumberRange {
|
||||
return result.candidateNumberRange
|
||||
}
|
||||
|
||||
// CandidateMappings returns the request-local number mapping used for this call.
|
||||
func (result Result) CandidateMappings() []CandidateMapping {
|
||||
return append([]CandidateMapping(nil), result.candidateMappings...)
|
||||
}
|
||||
|
||||
// CorrectionDetails returns bounded model-facing descriptions of the result's
|
||||
// proposal issues using the exact candidate-number range for this call.
|
||||
func (result Result) CorrectionDetails() ([]string, error) {
|
||||
return CorrectionDetails(result.Issues(), result.candidateNumberRange)
|
||||
}
|
||||
|
||||
// CorrectionGuidance returns one bounded replacement request for this result.
|
||||
func (result Result) CorrectionGuidance(additionalDetails ...string) (string, error) {
|
||||
return CorrectionGuidance(result.Issues(), result.candidateNumberRange, additionalDetails...)
|
||||
}
|
||||
|
||||
// ModelCandidate returns an owned copy of the proposal response when a model
|
||||
// completion produced this result.
|
||||
func (result Result) ModelCandidate() *contracts.ModelCandidate {
|
||||
@@ -158,7 +175,10 @@ func (engine *Engine) Reconcile(ctx context.Context, request Request) (Result, e
|
||||
if err != nil {
|
||||
return Result{}, fmt.Errorf("semantic reconciliation %q: prepare materials: %w", request.StageName, err)
|
||||
}
|
||||
result := Result{candidateMappings: preparation.CandidateMappings()}
|
||||
result := Result{
|
||||
candidateNumberRange: preparation.CandidateNumberRange(),
|
||||
candidateMappings: preparation.CandidateMappings(),
|
||||
}
|
||||
switch preparation.Disposition() {
|
||||
case InsufficientCandidates:
|
||||
result.disposition = SkippedInsufficientCandidates
|
||||
|
||||
Reference in New Issue
Block a user