Harden model results with lossless isolated repair and scoped permissions
This commit is contained in:
@@ -30,13 +30,17 @@ func TestNativeSessionModelPermissionsGenerationAndAbort(t *testing.T) {
|
||||
w.Write([]byte(`{"id":"ses_native"}`))
|
||||
case "POST /session/ses_native/message":
|
||||
var body struct {
|
||||
Model map[string]string
|
||||
Parts []map[string]string
|
||||
Model map[string]string
|
||||
Parts []map[string]string
|
||||
Format map[string]any
|
||||
}
|
||||
json.NewDecoder(r.Body).Decode(&body)
|
||||
if body.Model["modelID"] != "model" || body.Parts[0]["text"] != "exact prompt" {
|
||||
t.Error("prompt or message model changed", body)
|
||||
}
|
||||
if body.Format["type"] != "json_schema" || body.Format["retryCount"] != float64(0) {
|
||||
t.Error("structured-output format or no-replay retry count lost", body.Format)
|
||||
}
|
||||
prompted = true
|
||||
w.Write([]byte(`{"info":{"role":"assistant","finish":"stop","time":{"completed":1}},"parts":[{"type":"text","text":"result"}]}`))
|
||||
case "GET /session/ses_native/message":
|
||||
@@ -58,7 +62,7 @@ func TestNativeSessionModelPermissionsGenerationAndAbort(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := c.Call(ctx, "post", "/api/session/ses_native/generate", map[string]string{"prompt": "exact prompt"})
|
||||
data, err := c.Call(ctx, "post", "/api/session/ses_native/generate", map[string]any{"prompt": "exact prompt", "format": map[string]any{"type": "json_schema", "schema": map[string]any{"type": "object"}, "retryCount": 0}})
|
||||
if err != nil || !strings.Contains(string(data), "result") {
|
||||
t.Fatal(string(data), err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user