Skip to content

Add Anthropic/OpenAI adapters and Jev similarity evaluation - #700

Closed
xiaofan-luan wants to merge 5 commits into
zilliztech:mainfrom
xiaofan-luan:feat/adapters-and-jev
Closed

xiaofan-luan wants to merge 5 commits into
zilliztech:mainfrom
xiaofan-luan:feat/adapters-and-jev

Conversation

@xiaofan-luan

Copy link
Copy Markdown
Collaborator

Summary

Two additions to GPTCache:

  1. Modern OpenAI + Anthropic (Claude) adapters

    • gptcache/adapter/openai_client.py: adapter for the openai>=1.0 client interface (client.chat.completions.create).
    • gptcache/adapter/anthropic.py: Claude messages adapter (sync/async/streaming).
    • utils: import_anthropic/import_openai_client helpers + anthropic response extractors.
    • cache.set_anthropic_key().
  2. JevEvaluation for semantic cache-hit judgment

    • gptcache/similarity_evaluation/jev.py: uses TypeSafe's Jev model via five atomic noul checks (task identity, context, format, freshness, missing context).
    • Returns the minimum score across dimensions, so a cache entry is reused only when every condition passes similarity_threshold (AND semantics).
    • Registered via similarity_evaluation and adapter.api._get_eval("jev"|"typesafe").

Tests

  • tests/unit_tests/adapter/test_anthropic.py
  • tests/unit_tests/adapter/test_openai_client.py
  • tests/unit_tests/similarity_evaluation/test_jev.py

- gptcache/adapter/anthropic.py: Claude messages adapter (sync/async/streaming)
- gptcache/adapter/openai_client.py: adapter for openai>=1.0 client interface
- utils: import_anthropic/import_openai_client helpers + anthropic response extractors
- core: cache.set_anthropic_key()
Uses TypeSafe's Jev model via five atomic noul checks (task identity,
context, format, freshness, missing context). The score is the minimum
across dimensions, so a cache entry is reused only when every condition
passes the similarity threshold.
@sre-ci-robot
sre-ci-robot requested a review from cxie September 21, 2026 02:03
@sre-ci-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xiaofan-luan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@xiaofan-luan

Copy link
Copy Markdown
Collaborator Author

Superseded by #701 for the Anthropic/OpenAI adapters and JEV implementation, and #702 for the standalone reuse-compatibility benchmark, Codex labels, and evaluation results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants