Adapt corrections through PromptKit
This commit is contained in:
@@ -47,6 +47,32 @@ func TestDebugLLMPathsKeepDotIdentitiesDistinct(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDebugCompletionRequestOmitsCorrectionContent(t *testing.T) {
|
||||
const assistantResponse = `{"secret":"assistant response"}`
|
||||
const userGuidance = "secret user guidance"
|
||||
correction, err := contracts.NewSemanticCorrection([]byte(assistantResponse), userGuidance)
|
||||
if err != nil {
|
||||
t.Fatalf("NewSemanticCorrection() error = %v", err)
|
||||
}
|
||||
summary := debugCompletionRequest(contracts.StructuredCompletionRequest{
|
||||
Inputs: contracts.LLMInputSet{"source": contracts.NewLLMInputMaterial("source", "application/json", []byte(`{"source":true}`), "", "")},
|
||||
Vars: map[string]any{"custom": "value"},
|
||||
Correction: correction,
|
||||
})
|
||||
encoded, err := json.Marshal(summary)
|
||||
if err != nil {
|
||||
t.Fatalf("marshal completion summary: %v", err)
|
||||
}
|
||||
for _, secret := range []string{assistantResponse, userGuidance} {
|
||||
if strings.Contains(string(encoded), secret) {
|
||||
t.Fatalf("debug completion summary leaked %q: %s", secret, encoded)
|
||||
}
|
||||
}
|
||||
if summary.InputCount != 1 || summary.VariableCount != 1 || summary.Correction == nil {
|
||||
t.Fatalf("debug completion summary = %#v, want counts and correction metadata", summary)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDebugSourceDocumentPreservesUnitReferences(t *testing.T) {
|
||||
doc := validSourceDocument()
|
||||
envelope := debugSourceDocumentEnvelope(doc)
|
||||
|
||||
Reference in New Issue
Block a user