Caching Simple And Semantic
Portkey AI Gateway · Portkey
AI Gateway — Portkey
Portkey evals — Caching — Simple & Semantic (relift v3 InfraRed)
About Portkey
Portkey is an AI gateway for production LLM apps — a unified, OpenAI-compatible API across 200+ models with provider routing and fallbacks, semantic and simple caching, input/output guardrails (PII redaction, prompt-injection, content moderation), request-level observability and traces, a versioned prompt library, virtual keys with per-key budgets and rate limits, and workspace RBAC + audit logs.
Sample tests· showing 3 of 9
| # | Input | Expected behavior | Check |
|---|---|---|---|
| 01 | Config cache={mode:'simple', max_age:3600}. Caller sends two requests with identical messages[] and model; one has temperature=0, the other temperature=0.1. | Simple cache keys on the full request payload — different temperature values are different keys and miss. Verify with x-portkey-cache-status: MISS on both requests. To collapse them, normalize the request body client-side before sending. | Pass / FailAi Platformhigh |
| 02 | Config cache={mode:'semantic', similarity_threshold:0.95, max_age:3600}. Caller sends 'how do I reset my password?' then 'how can I reset my password?' | At threshold 0.95 these near-duplicate queries should hit; verify via x-portkey-cache-status: SEMANTIC_HIT. Tune similarity_threshold against a calibration set — lower thresholds increase recall but raise the chance of returning semantically wrong cached responses. | Pass / FailAi Platformcritical |
| 03 | Operator wants to attribute cost savings to caching and reads response body to infer cache hits. | Inspect x-portkey-cache-status response header (values include HIT, MISS, SEMANTIC_HIT, REFRESHED per docs) — do not infer hits from latency or from the absence of provider attribution. Aggregate by header value into cost-savings dashboards. | Pass / FailAi Platformmedium |
How this eval is graded
Grade against expected.ideal_behavior and expected.rubric. Per-criterion pass requires mean >= 4.0 and no criterion below 3.
Rubric criteria
- Portkey
- Ai Platform
- Caching Simple And Semantic
Recommended for
Works with
Related evals
Run this eval in your workspace
Connect your data, configure thresholds, and review results with your team.