Keep checkpoints aligned with PromptKit profiles
This commit is contained in:
@@ -75,6 +75,28 @@ func TestScheduledClientPropagatesSchedulerError(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestScheduledClientPreservesCheckpointFingerprints(t *testing.T) {
|
||||
scheduler, err := NewScheduler(1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
inner := &fingerprintedStructuredClient{
|
||||
fingerprints: []CheckpointFingerprint{{Name: "profile_source", Value: "sha256:one"}},
|
||||
}
|
||||
client := NewScheduledClient(inner, scheduler)
|
||||
provider, ok := client.(CheckpointFingerprintProvider)
|
||||
if !ok {
|
||||
t.Fatalf("scheduled client %T does not preserve checkpoint fingerprints", client)
|
||||
}
|
||||
got, err := provider.LLMCheckpointFingerprints()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(got) != 1 || got[0] != inner.fingerprints[0] {
|
||||
t.Fatalf("checkpoint fingerprints = %#v, want %#v", got, inner.fingerprints)
|
||||
}
|
||||
}
|
||||
|
||||
type blockingStructuredClient struct {
|
||||
release chan struct{}
|
||||
inFlight int32
|
||||
@@ -110,6 +132,15 @@ type errorStructuredClient struct {
|
||||
err error
|
||||
}
|
||||
|
||||
type fingerprintedStructuredClient struct {
|
||||
errorStructuredClient
|
||||
fingerprints []CheckpointFingerprint
|
||||
}
|
||||
|
||||
func (c *fingerprintedStructuredClient) LLMCheckpointFingerprints() ([]CheckpointFingerprint, error) {
|
||||
return append([]CheckpointFingerprint(nil), c.fingerprints...), nil
|
||||
}
|
||||
|
||||
func (c *errorStructuredClient) CompleteStructured(ctx context.Context, req contracts.StructuredCompletionRequest, out any) (contracts.StructuredCompletionResponse, error) {
|
||||
return contracts.StructuredCompletionResponse{}, c.err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user