Document prepared message content hashes
This commit is contained in:
@@ -559,12 +559,17 @@ if err != nil {
|
||||
defer preparedExecution.Discard()
|
||||
|
||||
details := preparedExecution.Details()
|
||||
messageContentHash := details.MessageContentHash
|
||||
_ = messageContentHash // An opaque value available before model execution.
|
||||
// Inspect or persist an application-selected safe subset of details.
|
||||
|
||||
result, err := engine.RunPrepared(ctx, preparedExecution)
|
||||
```
|
||||
|
||||
Preparation does not call the model or reserve backend capacity.
|
||||
`MessageContentHash` compares the ordered message roles and text, whereas
|
||||
`RenderedPromptHash` also includes the session and cache-control hints. See
|
||||
the [`PreparedRun` GoDoc](../../types.go) for their contracts and compatibility.
|
||||
`RunPrepared` executes from the retained snapshot rather than reloading
|
||||
consumer sources. The handle is opaque in-process state, while `Details`
|
||||
contains rendered content and remains subject to the application's data
|
||||
|
||||
@@ -144,7 +144,7 @@ profile, or backend:
|
||||
3. render messages and the prompt-defined session;
|
||||
4. apply any direct session ID, then compose captured history, rendered
|
||||
definition messages, and already-normalized request messages in that order;
|
||||
5. hash the effective rendered prompt; and
|
||||
5. hash the effective rendered prompt and its ordered message content; and
|
||||
6. construct the prepared value and preparation timing.
|
||||
|
||||
`Prepare` runs both phases consecutively and never performs capacity admission.
|
||||
@@ -185,6 +185,12 @@ sequence. The rendered-prompt hash uses a versioned, length-framed SHA-256
|
||||
encoding of that session, every role and content value, and cache-control
|
||||
presence and values; its hexadecimal value is opaque.
|
||||
|
||||
The separate message-content hash is computed once after that same composition.
|
||||
It streams a versioned prefix, message count, and length-framed role and text
|
||||
bytes into SHA-256, excluding session and cache metadata. Fixed reference
|
||||
vectors protect the selected v1 scheme across refactors; the public
|
||||
[`PreparedRun` GoDoc](../../types.go) owns its compatibility contract.
|
||||
|
||||
The configuration snapshot is read-only after engine construction. Concurrent
|
||||
`Prepare` and `Run` calls use detached captured targets and keep invocation
|
||||
state local.
|
||||
|
||||
20
docs/releases/v0.24.0.md
Normal file
20
docs/releases/v0.24.0.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Promptkit v0.24.0
|
||||
|
||||
This feature release adds an opaque message-content hash to prepared results.
|
||||
It identifies the ordered prepared message roles and exact text independently
|
||||
of session identity, cache hints, and other metadata. The existing rendered
|
||||
prompt hash is unchanged. See the [prepared-result GoDoc](../../types.go) and
|
||||
[consumer guide](../consumers/pkg-promptkit.md#prepare-now-and-execute-the-same-snapshot-later).
|
||||
|
||||
## Compatibility And Upgrade
|
||||
|
||||
Prepared-result JSON now includes `message_content_hash`; older JSON without it
|
||||
decodes with an empty value. The new Go struct field is additive, though callers
|
||||
using positional `PreparedRun` literals may need to adjust them. No configuration
|
||||
migration is required. The Go consumer minimum and dependencies are unchanged.
|
||||
|
||||
```sh
|
||||
go get go.maximumdirect.net/promptkit@v0.24.0
|
||||
```
|
||||
|
||||
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.24.0/COPYRIGHT) | [LICENSE](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.24.0/LICENSE) | [ATTRIBUTION](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.24.0/docs/oss/attribution.md)
|
||||
@@ -187,6 +187,8 @@ in the feature roadmap has proportionate coverage at its owning boundary.
|
||||
|
||||
## Stage 4 — Document, Demonstrate, And Validate The End State
|
||||
|
||||
Status: complete.
|
||||
|
||||
Update these existing documentation owners:
|
||||
|
||||
- `docs/consumers/pkg-promptkit.md`: explain the narrower hash versus
|
||||
|
||||
Reference in New Issue
Block a user