fix(cache): skip embeddings in the response cache

Embeddings responses are large and rarely repeat. Each one was stored
for the cache TTL in the shared Redis. A burst of them raised memory
on the shared Dragonfly to its limit.

The cache now skips /v1/embeddings unless cache.cacheEmbeddings is
true. The default is false. Chat caching does not change.
This commit is contained in:
2026-10-28 20:34:48 +00:00
parent 52b5e60719
commit 6d3c8bf9b7
5 changed files with 94 additions and 3 deletions
+4
View File
@@ -473,6 +473,10 @@ type CacheConfig struct {
// budgets also bind repeated identical prompts. Defaults to false: a
// hit then adds only to the request counters.
AccountHits bool `json:"accountHits,omitempty"`
// CacheEmbeddings opts /v1/embeddings responses into the cache. Off by
// default: a vector body is large and rarely repeats, so it fills the
// shared Redis for little benefit.
CacheEmbeddings bool `json:"cacheEmbeddings,omitempty"`
}
// BreakerConfig configures the per-provider discovery circuit breaker