Expose content hashes on prepared runs
This commit is contained in:
@@ -91,6 +91,7 @@ func TestPreparedRunJSONContractRoundTripsAllFields(t *testing.T) {
|
||||
"input_hashes",
|
||||
"session_id",
|
||||
"rendered_prompt_hash",
|
||||
"message_content_hash",
|
||||
"messages",
|
||||
"start_time",
|
||||
"end_time",
|
||||
@@ -124,6 +125,13 @@ func TestPreparedRunJSONContractRoundTripsAllFields(t *testing.T) {
|
||||
t.Fatalf("marshal zero PreparedRun: %v", err)
|
||||
}
|
||||
zeroObject := decodeJSONObject(t, zeroPayload)
|
||||
if string(zeroObject["message_content_hash"]) != `""` {
|
||||
t.Fatalf("zero message content hash missing or nonempty: %s", zeroPayload)
|
||||
}
|
||||
var legacy promptkit.PreparedRun
|
||||
if err := json.Unmarshal([]byte(`{"messages":[]}`), &legacy); err != nil || legacy.MessageContentHash != "" {
|
||||
t.Fatalf("legacy prepared run = %+v, %v", legacy, err)
|
||||
}
|
||||
for _, field := range []string{
|
||||
"prompt_version",
|
||||
"prompt_hash",
|
||||
@@ -271,6 +279,7 @@ func fullyPopulatedPreparedRun() promptkit.PreparedRun {
|
||||
InputHashes: map[string]string{"first": "hash-1", "second": "hash-2"},
|
||||
SessionID: "session-prepared",
|
||||
RenderedPromptHash: "rendered-hash",
|
||||
MessageContentHash: "content-hash",
|
||||
Messages: []promptkit.RenderedMessage{
|
||||
{
|
||||
Role: "system",
|
||||
|
||||
Reference in New Issue
Block a user