Skip to content

0.5.0: cold-start shadow verdict + LangChain VerifiedCache - #6

Merged
imxinchengyou merged 2 commits into
mainfrom
feat/shadow-verdict
Oct 24, 2026
Merged

imxinchengyou merged 2 commits into
mainfrom
feat/shadow-verdict

Conversation

@imxinchengyou

@imxinchengyou imxinchengyou commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Pairs with cacheverifier-service#102.

Shadow verdict

  • VerifyResult.notice: the cold-start explanation the API already returned but the client dropped.
  • VerifyResult.shadow (a new ShadowVerdict, exported): on a cold-start call, what the shared stock model would have decided. The call itself is still rejected.
  • Both are optional and None when 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 as RedisSemanticCache.
  • On a hit it verifies (user question, cached answer); a rejected hit becomes a miss, so the model is called as usual.
  • For chat models it verifies against the last human message (including multimodal text blocks), not the serialized history.
  • Sync and async; writes and clears pass straight through. Fails closed on verifier outage unless fail_open=True.
  • New extra cacheverifier[langchain] (langchain-core>=0.3), also added to dev so CI tests and type-checks it.

Docs: README sections and CHANGELOG 0.5.0.

Checks: pytest 46 passed, 1 skipped, ruff and mypy clean. The tests drive a real FakeListChatModel + InMemoryCache through invoke().

xin 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].
@imxinchengyou imxinchengyou changed the title VerifyResult: add notice and the cold-start shadow verdict (0.5.0) 0.5.0: cold-start shadow verdict + LangChain VerifiedCache Oct 24, 2026
@imxinchengyou
imxinchengyou merged commit 983aa29 into main Oct 24, 2026
7 checks passed
@imxinchengyou
imxinchengyou deleted the feat/shadow-verdict branch October 24, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant