Architectural improvements in the http adapter
This commit is contained in:
@@ -81,6 +81,15 @@ func TestHandlerPostRunsSuccess(t *testing.T) {
|
||||
if artifact["body"] != "hello" {
|
||||
t.Fatalf("expected artifact body hello, got %#v", artifact["body"])
|
||||
}
|
||||
validation := resp["validation"].(map[string]any)
|
||||
if validation["status"] != "passed" {
|
||||
t.Fatalf("expected validation.status passed, got %#v", validation["status"])
|
||||
}
|
||||
metadata := resp["metadata"].(map[string]any)
|
||||
usage := metadata["usage"].(map[string]any)
|
||||
if usage["total_tokens"] != float64(3) {
|
||||
t.Fatalf("expected usage.total_tokens=3, got %#v", usage["total_tokens"])
|
||||
}
|
||||
if resp["raw_model_output"] != "hello" {
|
||||
t.Fatalf("expected raw model output hello, got %#v", resp["raw_model_output"])
|
||||
}
|
||||
@@ -172,8 +181,8 @@ func TestHandlerValidationFailureStillSuccess(t *testing.T) {
|
||||
t.Fatalf("invalid JSON response: %v", err)
|
||||
}
|
||||
validation := resp["validation"].(map[string]any)
|
||||
if status, ok := validation["Status"].(string); !ok || status != "failed" {
|
||||
t.Fatalf("expected validation Status=failed, got %#v", validation["Status"])
|
||||
if status, ok := validation["status"].(string); !ok || status != "failed" {
|
||||
t.Fatalf("expected validation status=failed, got %#v", validation["status"])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user