Repository navigation
0.5.0: cold-start shadow verdict + LangChain VerifiedCache - #6
Merged
Merged
Conversation
added 2 commits
October 24, 2026 15:08
The API returns a plain-language notice on cold-start calls, and now a 'shadow' verdict with what the shared stock model would have decided. The client dropped both, so a new account's first calls showed only approved=False. Both fields are optional and None when absent, so this works unchanged against servers that don't send them.
cacheverifier.integrations.langchain.VerifiedCache wraps any LangChain cache (typically a semantic one such as RedisSemanticCache). On a hit it calls /v1/verify with the user's question and the cached answer; a rejected hit becomes a miss, so the model is called as usual. For chat models the question is the last human message, not the serialized history. Writes and clears pass through. Optional extra: cacheverifier[langchain].
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.
Pairs with cacheverifier-service#102.
Shadow verdict
VerifyResult.notice: the cold-start explanation the API already returned but the client dropped.VerifyResult.shadow(a newShadowVerdict, exported): on a cold-start call, what the shared stock model would have decided. The call itself is still rejected.Nonewhen the server doesn't send them, so older servers keep working.LangChain integration
cacheverifier.integrations.langchain.VerifiedCache(inner_cache, api_key=...)wraps any LangChain cache, typically a semantic one such asRedisSemanticCache.fail_open=True.cacheverifier[langchain](langchain-core>=0.3), also added todevso CI tests and type-checks it.Docs: README sections and CHANGELOG 0.5.0.
Checks:
pytest46 passed, 1 skipped, ruff and mypy clean. The tests drive a realFakeListChatModel+InMemoryCachethroughinvoke().