Clarify prompt boundaries and enforce repair decisions
This commit is contained in:
@@ -9,9 +9,14 @@ import (
|
||||
|
||||
// RepairResponse is one model response for an original proposal reference.
|
||||
type RepairResponse struct {
|
||||
ProposalRef int `json:"proposal_ref"`
|
||||
Action string `json:"action"`
|
||||
Correction *StructuredCorrectionProposal `json:"correction"`
|
||||
ProposalRef int `json:"proposal_ref"`
|
||||
Decision RepairDecision `json:"decision"`
|
||||
}
|
||||
|
||||
// RepairDecision selects revision or withdrawal for the referenced proposal.
|
||||
type RepairDecision struct {
|
||||
Action string `json:"action"`
|
||||
Correction *StructuredCorrectionProposal `json:"correction"`
|
||||
}
|
||||
|
||||
// DecodeRepairResponse checks correspondence after structural schema validation.
|
||||
@@ -21,7 +26,7 @@ func DecodeRepairResponse(content []byte, expectedRef int) (RepairResponse, erro
|
||||
if err := json.Unmarshal(content, &response); err != nil {
|
||||
return RepairResponse{}, invalidRepairResponse(err)
|
||||
}
|
||||
if response.ProposalRef != expectedRef || (response.Action != "revise" || response.Correction == nil) && (response.Action != "withdraw" || response.Correction != nil) {
|
||||
if response.ProposalRef != expectedRef || (response.Decision.Action != "revise" || response.Decision.Correction == nil) && (response.Decision.Action != "withdraw" || response.Decision.Correction != nil) {
|
||||
return response, invalidRepairResponse(nil)
|
||||
}
|
||||
return response, nil
|
||||
|
||||
Reference in New Issue
Block a user