Expose content hashes on prepared runs
This commit is contained in:
@@ -22,9 +22,13 @@ func TestPreparedNotificationSelectionAndOrdering(t *testing.T) {
|
||||
}
|
||||
return &promptkit.GenerateResponse{Content: "ok"}, nil
|
||||
}))
|
||||
expected, err := engine.Prepare(context.Background(), promptkit.RunRequest{PromptID: "prompt"})
|
||||
if err != nil || expected.MessageContentHash == "" {
|
||||
t.Fatalf("preparation = %+v, %v", expected, err)
|
||||
}
|
||||
req := promptkit.RunRequest{PromptID: "prompt", OnPrepared: func(_ context.Context, details promptkit.PreparedRun) {
|
||||
calls++
|
||||
if details.PromptID != "prompt" || len(details.Messages) == 0 {
|
||||
if details.PromptID != "prompt" || len(details.Messages) == 0 || details.MessageContentHash != expected.MessageContentHash {
|
||||
t.Fatalf("details=%+v", details)
|
||||
}
|
||||
}}
|
||||
@@ -36,6 +40,9 @@ func TestPreparedNotificationSelectionAndOrdering(t *testing.T) {
|
||||
if calls != 0 {
|
||||
t.Fatal("preparation notified")
|
||||
}
|
||||
if handle.Details().MessageContentHash != expected.MessageContentHash {
|
||||
t.Fatal("prepared handle content hash differs")
|
||||
}
|
||||
req.OnPrepared = func(context.Context, promptkit.PreparedRun) { t.Fatal("selection changed") }
|
||||
_, err = engine.RunPrepared(context.Background(), handle)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user