feat: preserve Anthropic prompt cache controls
This commit is contained in:
1 parent
0300af6717
commit
c7846eeab9
5 files changed
+161
-31
No files matched your search
@@ -118,3 +118,16 @@ func TestStripFieldsMalformedSchema(t *testing.T) {
|
||||
assert.Equal(t, bad, out)
|
||||
assert.Empty(t, diags)
|
||||
}
|
||||
|
||||
func TestStripCacheKeyIncludesCacheControl(t *testing.T) {
|
||||
base := ToolDef{Name: "lookup", Parameters: json.RawMessage(`{"type":"object"}`)}
|
||||
fiveMinutes := base
|
||||
fiveMinutes.CacheControl = &CacheControl{Type: "ephemeral", TTL: "5m"}
|
||||
oneHour := base
|
||||
oneHour.CacheControl = &CacheControl{Type: "ephemeral", TTL: "1h"}
|
||||
assert.NotEqual(t, stripCacheKey([]ToolDef{fiveMinutes}, nil), stripCacheKey([]ToolDef{oneHour}, nil))
|
||||
|
||||
cloned := cloneToolDefs([]ToolDef{oneHour})
|
||||
cloned[0].CacheControl.TTL = "5m"
|
||||
assert.Equal(t, "1h", oneHour.CacheControl.TTL, "cached normalization results must not alias cache metadata")
|
||||
}
|
||||
Reference in new issue
Block a user