Repository navigation
0.8.0: integrations no longer switch the cache off during cold start - #14
Merged
Merged
Conversation
While a workspace has no model of its own, /v1/verify rejects every call. The integrations send every hit, so they rejected all of them and silently dropped the notice saying why. - VerifiedCache (LangChain): cold_start="serve" (default) serves cold-start hits exactly as the wrapped cache returned them; cold_start="reject" keeps the old behavior. The first cold-start verdict is logged once. - CacheVerifierEvaluation (GPTCache): fallback= takes the evaluator it replaces; during cold start its score divided by its range width is returned, so GPTCache's similarity_threshold accepts exactly the hits it did before. Without a fallback cold-start hits stay misses, with a warning. direct_hit= serves hits whose fallback score is at least that high without a verify call. similarity_score is deliberately not sent to verify, so it can't diverge from the raw scale report_feedback documents. - VerifyResult.cold_start property.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
While a workspace has no model of its own,
/v1/verifyruns fail-closed and rejects every call. Rejecting only gray-zone calls (the integration pattern in the docs) is cheap. But both integrations send every hit and dropped thenotice, so a new user's cache was silently switched off: hit rate went to zero, LLM spend went up, and nothing was protected that wasn't already being served before CacheVerifier was added.Change
VerifiedCache(LangChain): newcold_start="serve" | "reject". The default"serve"serves cold-start hits exactly as the wrapped cache returned them, the same as withoutVerifiedCache."reject"keeps the old behavior, which is right if the wrapped cache's threshold was loosened because a verifier would check its hits.CacheVerifierEvaluation(GPTCache): newfallback=for the evaluator it replaces (e.g.SearchDistanceEvaluation()). GPTCache appliessimilarity_thresholdto whatever the evaluator returns, so replacing the evaluator also drops its similarity check. During cold start the fallback's score divided by its range width is returned. GPTCache accepts a hit whenrank >= (max - min) * similarity_threshold, so this accepts exactly the hits it accepted before (exact for ranges starting at 0, which all built-in evaluators have). Without a fallback, cold-start hits stay misses, now with a warning saying how to keep them.direct_hit=serves hits whose rescaled fallback score is at least that high without a verify call.cacheverifier.integrations), including the service's notice.VerifyResult.cold_startproperty.Deliberately not done
similarity_scoreto verify.report_feedbackdocuments the raw vector-search score, so sending a different scale at verify time would make a fitted joint rule see a different scale in production than it was trained on.tau_highbypass:BaseCache.lookupdoesn't expose the similarity.Testing
pytest -q: 67 passed, 1 skipped. New tests cover serve / reject / warn-once, audit and stock-model rejections still falling through, the GPTCache rescale, the no-fallback case,direct_hitskipping the call, and argument validation.ruff check .andmypy cacheverifierpass.adapter.pythreshold code.