zuplo 7.2.3 → 7.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/ai-gateway/integrations/ai-sdk.mdx +3 -2
- package/docs/ai-gateway/integrations/claude-code.mdx +3 -2
- package/docs/ai-gateway/integrations/codex.mdx +7 -5
- package/docs/ai-gateway/integrations/goose.mdx +4 -3
- package/docs/ai-gateway/integrations/langchain.mdx +3 -3
- package/docs/ai-gateway/integrations/openai.mdx +3 -3
- package/docs/ai-gateway/policies/overview.mdx +3 -17
- package/docs/ai-gateway/universal-api.mdx +4 -3
- package/docs/caching/custom-caching-policy.mdx +1 -1
- package/docs/caching/gateway-caching.mdx +3 -3
- package/docs/caching/overview.mdx +10 -10
- package/docs/dedicated/akamai/ai-powered-applications.mdx +2 -2
- package/docs/dev-portal/zudoku/configuration/search.md +5 -0
- package/docs/dev-portal/zudoku/openapi-extensions/x-mcp-server.md +30 -0
- package/docs/policies/_index.md +12 -7
- package/docs/policies/ai-gateway-auth-v2-inbound/doc.md +168 -0
- package/docs/policies/ai-gateway-auth-v2-inbound/intro.md +10 -0
- package/docs/policies/ai-gateway-auth-v2-inbound/schema.json +74 -0
- package/docs/policies/ai-gateway-configuration-executor-v2-inbound/doc.md +442 -0
- package/docs/policies/ai-gateway-configuration-executor-v2-inbound/intro.md +14 -0
- package/docs/policies/ai-gateway-configuration-executor-v2-inbound/schema.json +60 -0
- package/docs/policies/ai-gateway-configuration-loader-v2-inbound/doc.md +105 -0
- package/docs/policies/ai-gateway-configuration-loader-v2-inbound/intro.md +6 -0
- package/docs/policies/ai-gateway-configuration-loader-v2-inbound/schema.json +60 -0
- package/docs/policies/ai-gateway-dlp-inbound/doc.md +127 -0
- package/docs/policies/ai-gateway-dlp-inbound/intro.md +5 -0
- package/docs/policies/ai-gateway-dlp-inbound/schema.json +4050 -0
- package/docs/policies/ai-gateway-fallback-model-v2-inbound/doc.md +10 -2
- package/docs/policies/ai-gateway-fallback-model-v2-inbound/intro.md +2 -2
- package/docs/policies/ai-gateway-fallback-model-v2-inbound/schema.json +22 -8
- package/docs/policies/ai-gateway-metering-v2-inbound/doc.md +19 -16
- package/docs/policies/ai-gateway-metering-v2-inbound/intro.md +9 -0
- package/docs/policies/ai-gateway-metering-v2-inbound/schema.json +20 -24
- package/docs/policies/ai-gateway-model-filtering-v2-inbound/doc.md +6 -5
- package/docs/policies/ai-gateway-model-filtering-v2-inbound/intro.md +2 -2
- package/docs/policies/ai-gateway-model-filtering-v2-inbound/schema.json +17 -3
- package/docs/policies/ai-gateway-semantic-cache-v2-inbound/doc.md +72 -0
- package/docs/policies/ai-gateway-semantic-cache-v2-inbound/intro.md +9 -0
- package/docs/policies/ai-gateway-semantic-cache-v2-inbound/schema.json +120 -0
- package/docs/policies/akamai-ai-firewall-v2-inbound/doc.md +87 -0
- package/docs/policies/akamai-ai-firewall-v2-inbound/intro.md +10 -0
- package/docs/policies/{akamai-ai-firewall → akamai-ai-firewall-v2-inbound}/schema.json +36 -9
- package/docs/policies/akamai-firewall-for-ai-inbound/schema.json +1 -0
- package/docs/policies/akamai-firewall-for-ai-outbound/schema.json +1 -0
- package/docs/policies/amberflo-metering-inbound/schema.json +1 -0
- package/docs/policies/api-key-inbound/schema.json +1 -0
- package/docs/policies/audit-log-inbound/schema.json +1 -0
- package/docs/policies/auth0-jwt-auth-inbound/schema.json +1 -0
- package/docs/policies/authzen-inbound/schema.json +1 -0
- package/docs/policies/axiomatics-authz-inbound/schema.json +1 -0
- package/docs/policies/basic-auth-inbound/schema.json +1 -0
- package/docs/policies/bot-detection-inbound/schema.json +1 -0
- package/docs/policies/brownout-inbound/schema.json +1 -0
- package/docs/policies/caching-inbound/schema.json +1 -0
- package/docs/policies/cdn-cache-control-outbound/schema.json +1 -0
- package/docs/policies/change-method-inbound/schema.json +1 -0
- package/docs/policies/clear-headers-inbound/schema.json +1 -0
- package/docs/policies/clear-headers-outbound/schema.json +1 -0
- package/docs/policies/clerk-jwt-auth-inbound/schema.json +1 -0
- package/docs/policies/cognito-jwt-auth-inbound/schema.json +1 -0
- package/docs/policies/comet-opik-tracing-v2-inbound/doc.md +78 -0
- package/docs/policies/comet-opik-tracing-v2-inbound/intro.md +10 -0
- package/docs/policies/{comet-opik-tracing-inbound → comet-opik-tracing-v2-inbound}/schema.json +40 -5
- package/docs/policies/complex-rate-limit-inbound/schema.json +1 -0
- package/docs/policies/composite-inbound/schema.json +1 -0
- package/docs/policies/composite-outbound/schema.json +1 -0
- package/docs/policies/curity-phantom-token-inbound/schema.json +1 -0
- package/docs/policies/data-loss-prevention-inbound/doc.md +22 -6
- package/docs/policies/data-loss-prevention-inbound/schema.json +10 -1
- package/docs/policies/data-loss-prevention-outbound/doc.md +23 -6
- package/docs/policies/data-loss-prevention-outbound/schema.json +10 -1
- package/docs/policies/firebase-jwt-inbound/schema.json +1 -0
- package/docs/policies/formdata-to-json-inbound/schema.json +1 -0
- package/docs/policies/galileo-tracing-v2-inbound/doc.md +72 -0
- package/docs/policies/galileo-tracing-v2-inbound/intro.md +8 -0
- package/docs/policies/{galileo-tracing-inbound → galileo-tracing-v2-inbound}/schema.json +40 -5
- package/docs/policies/geo-filter-inbound/schema.json +1 -0
- package/docs/policies/graphql-analytics-outbound/schema.json +1 -0
- package/docs/policies/graphql-cache-inbound/schema.json +1 -0
- package/docs/policies/graphql-complexity-limit-inbound/schema.json +1 -0
- package/docs/policies/graphql-disable-introspection-inbound/schema.json +1 -0
- package/docs/policies/graphql-introspection-filter-outbound/schema.json +1 -0
- package/docs/policies/http-deprecation-outbound/schema.json +1 -0
- package/docs/policies/ip-address-restriction-inbound/schema.json +1 -0
- package/docs/policies/jwt-scopes-inbound/schema.json +1 -0
- package/docs/policies/ldap-auth-inbound/schema.json +1 -0
- package/docs/policies/mcp-auth0-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-capability-filter-inbound/schema.json +1 -0
- package/docs/policies/mcp-clerk-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-cognito-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-entra-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-google-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-keycloak-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-logto-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-okta-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-onelogin-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-ping-oauth-inbound/schema.json +1 -0
- package/docs/policies/mcp-token-exchange-inbound/schema.json +1 -0
- package/docs/policies/mcp-workos-oauth-inbound/schema.json +1 -0
- package/docs/policies/mock-api-inbound/schema.json +1 -0
- package/docs/policies/moesif-inbound/schema.json +1 -0
- package/docs/policies/monetization-inbound/schema.json +1 -0
- package/docs/policies/mtls-auth-inbound/schema.json +1 -0
- package/docs/policies/okta-fga-authz-inbound/schema.json +1 -0
- package/docs/policies/okta-jwt-auth-inbound/schema.json +1 -0
- package/docs/policies/open-id-jwt-auth-inbound/schema.json +1 -0
- package/docs/policies/openfga-authz-inbound/schema.json +1 -0
- package/docs/policies/openmeter-inbound/schema.json +1 -0
- package/docs/policies/prompt-injection-outbound/schema.json +1 -0
- package/docs/policies/propel-auth-jwt-inbound/schema.json +1 -0
- package/docs/policies/query-param-to-header-inbound/schema.json +1 -0
- package/docs/policies/quota-inbound/schema.json +1 -0
- package/docs/policies/rate-limit-inbound/schema.json +1 -0
- package/docs/policies/readme-metrics-inbound/schema.json +1 -0
- package/docs/policies/remove-headers-inbound/schema.json +1 -0
- package/docs/policies/remove-headers-outbound/schema.json +1 -0
- package/docs/policies/remove-query-params-inbound/schema.json +1 -0
- package/docs/policies/replace-string-outbound/schema.json +1 -0
- package/docs/policies/request-size-limit-inbound/schema.json +1 -0
- package/docs/policies/request-validation-inbound/schema.json +1 -0
- package/docs/policies/require-origin-inbound/schema.json +1 -0
- package/docs/policies/require-user-claims-inbound/schema.json +1 -0
- package/docs/policies/secret-masking-outbound/schema.json +1 -0
- package/docs/policies/semantic-cache-inbound/schema.json +3 -2
- package/docs/policies/set-body-inbound/schema.json +1 -0
- package/docs/policies/set-headers-inbound/schema.json +1 -0
- package/docs/policies/set-headers-outbound/schema.json +1 -0
- package/docs/policies/set-query-params-inbound/schema.json +1 -0
- package/docs/policies/set-status-outbound/schema.json +1 -0
- package/docs/policies/set-upstream-api-key-inbound/schema.json +1 -0
- package/docs/policies/sleep-inbound/schema.json +1 -0
- package/docs/policies/stripe-webhook-verification-inbound/schema.json +1 -0
- package/docs/policies/supabase-jwt-auth-inbound/schema.json +1 -0
- package/docs/policies/traffic-splitting-inbound/schema.json +1 -0
- package/docs/policies/upstream-aws-federated-auth-inbound/schema.json +1 -0
- package/docs/policies/upstream-aws-service-auth-inbound/schema.json +1 -0
- package/docs/policies/upstream-azure-ad-service-auth-inbound/schema.json +1 -0
- package/docs/policies/upstream-firebase-admin-auth-inbound/schema.json +1 -0
- package/docs/policies/upstream-firebase-user-auth-inbound/schema.json +1 -0
- package/docs/policies/upstream-gcp-federated-auth-inbound/schema.json +1 -0
- package/docs/policies/upstream-gcp-jwt-inbound/schema.json +1 -0
- package/docs/policies/upstream-gcp-service-auth-inbound/schema.json +1 -0
- package/docs/policies/upstream-oauth-client-credentials-inbound/schema.json +1 -0
- package/docs/policies/upstream-zuplo-jwt-auth-inbound/schema.json +1 -0
- package/docs/policies/validate-json-schema-inbound/schema.json +1 -0
- package/docs/policies/web-bot-auth-inbound/schema.json +1 -0
- package/docs/policies/xml-to-json-outbound/schema.json +1 -0
- package/package.json +5 -5
- package/docs/ai-gateway/policies/akamai-ai-firewall.mdx +0 -122
- package/docs/ai-gateway/policies/authentication.mdx +0 -43
- package/docs/ai-gateway/policies/comet-opik-tracing.mdx +0 -177
- package/docs/ai-gateway/policies/fallback-model.mdx +0 -40
- package/docs/ai-gateway/policies/galileo-tracing.mdx +0 -161
- package/docs/ai-gateway/policies/metering.mdx +0 -47
- package/docs/ai-gateway/policies/model-filtering.mdx +0 -49
- package/docs/ai-gateway/policies/semantic-cache.mdx +0 -48
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/akamai-ai-firewall.json",
|
|
3
|
+
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/akamai-ai-firewall-v2-inbound.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"title": "Akamai AI Firewall",
|
|
6
6
|
"isDeprecated": false,
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": true,
|
|
13
|
+
"policyType": "akamai-ai-firewall-v2",
|
|
13
14
|
"products": ["ai-gateway"],
|
|
14
15
|
"description": "Akamai AI Firewall Inbound Policy",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
"required": ["export", "module", "options"],
|
|
22
23
|
"properties": {
|
|
23
24
|
"export": {
|
|
24
|
-
"const": "
|
|
25
|
+
"const": "AkamaiAIFirewallV2InboundPolicy",
|
|
25
26
|
"description": "The name of the exported type"
|
|
26
27
|
},
|
|
27
28
|
"module": {
|
|
@@ -29,9 +30,16 @@
|
|
|
29
30
|
"description": "The module containing the policy"
|
|
30
31
|
},
|
|
31
32
|
"options": {
|
|
33
|
+
"x-zuplo-policy-type": "akamai-ai-firewall-v2",
|
|
32
34
|
"title": "AkamaiAIFirewallPolicyOptions",
|
|
33
35
|
"type": "object",
|
|
34
36
|
"description": "The options for the Akamai AI Firewall policy.",
|
|
37
|
+
"examples": [
|
|
38
|
+
{
|
|
39
|
+
"configurationId": "$env(AKAMAI_AI_FIREWALL_CONFIGURATION_ID)",
|
|
40
|
+
"api-key": "$env(AKAMAI_AI_FIREWALL_API_KEY)"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
35
43
|
"properties": {
|
|
36
44
|
"configurationId": {
|
|
37
45
|
"type": "string",
|
|
@@ -78,11 +86,33 @@
|
|
|
78
86
|
},
|
|
79
87
|
"additionalProperties": false
|
|
80
88
|
},
|
|
89
|
+
"endpoints": {
|
|
90
|
+
"type": "array",
|
|
91
|
+
"title": "Applicable Endpoints",
|
|
92
|
+
"x-advanced": true,
|
|
93
|
+
"description": "The endpoint shapes this policy applies to. Omit to apply to all (openai-chat, openai-responses, anthropic-messages).",
|
|
94
|
+
"items": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"enum": [
|
|
97
|
+
"openai-chat",
|
|
98
|
+
"openai-responses",
|
|
99
|
+
"anthropic-messages"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"onUnknownShape": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"title": "On Unknown Shape",
|
|
106
|
+
"x-advanced": true,
|
|
107
|
+
"description": "What to do when the request shape cannot be inspected. As a guardrail, this policy defaults to 'deny' (fail closed) so uninspectable content is never served.",
|
|
108
|
+
"enum": ["deny", "skip"],
|
|
109
|
+
"default": "deny"
|
|
110
|
+
},
|
|
81
111
|
"onError": {
|
|
82
112
|
"type": "string",
|
|
83
113
|
"title": "On Firewall Error",
|
|
84
114
|
"x-advanced": true,
|
|
85
|
-
"description": "What to do when the Akamai detect call itself fails (invalid API key, rate limit, outage). 'block' (the default) fails closed and returns a 502 so unverified content is never served; 'allow' fails open and lets the request through without inspection.
|
|
115
|
+
"description": "What to do when the Akamai detect call itself fails (invalid API key, rate limit, outage). 'block' (the default) fails closed and returns a 502 so unverified content is never served; 'allow' fails open and lets the request through without inspection.",
|
|
86
116
|
"enum": ["block", "allow"],
|
|
87
117
|
"default": "block"
|
|
88
118
|
}
|
|
@@ -93,14 +123,11 @@
|
|
|
93
123
|
},
|
|
94
124
|
"examples": [
|
|
95
125
|
{
|
|
96
|
-
"export": "
|
|
126
|
+
"export": "AkamaiAIFirewallV2InboundPolicy",
|
|
97
127
|
"module": "$import(@zuplo/runtime)",
|
|
98
128
|
"options": {
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"enabled": true,
|
|
102
|
-
"eventsInterval": 5
|
|
103
|
-
}
|
|
129
|
+
"configurationId": "$env(AKAMAI_AI_FIREWALL_CONFIGURATION_ID)",
|
|
130
|
+
"api-key": "$env(AKAMAI_AI_FIREWALL_API_KEY)"
|
|
104
131
|
}
|
|
105
132
|
}
|
|
106
133
|
]
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": true,
|
|
13
|
+
"policyType": "akamai-firewall-for-ai",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Inspects each incoming request with Akamai's Firewall for AI detect API and blocks the request if Akamai returns a `deny` rule. Useful in front of AI-powered APIs to filter prompt injection, jailbreaks, and other unsafe inputs before they reach the model.\n\nThe body, headers, URL, and query string sent to Akamai are configurable; by default only the request body is captured. Bodies are read from a clone so the upstream handler still sees the original.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": true,
|
|
13
|
+
"policyType": "akamai-firewall-for-ai",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Inspects each upstream response with Akamai's Firewall for AI detect API and replaces the response with a `403 Forbidden` if Akamai returns a `deny` rule. Useful behind AI-powered APIs to filter unsafe completions, sensitive data exposure, and toxic content before they reach the client.\n\nThe body, headers, URL, and query string sent to Akamai are configurable; by default only the response body is captured. Bodies are read from a clone so the client still receives the original.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "amberflo-metering-inbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Amberflo is a usage metering and billing service. This policy allows you to send metering calls for each API to their meter ingest endpoint.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "api-key-inbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Authenticates requests based on API Keys using Zuplo's built-in API key management. This policy validates API keys against Zuplo's key storage, caches results for performance, and automatically adds user information to authenticated requests.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "audit-log-inbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Capture detailed logs of requests for auditing purposes. The policy emits one structured CloudEvent per request, and user code can emit additional events via the static `log()` method.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "cdn-cache-control-outbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Sets the response headers that tell a CDN how long it may cache a response and which purge tags it belongs to, separately from what the browser is told.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "clear-headers-inbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Removes all headers from the incoming request except for those in the exclude list.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "clear-headers-outbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Removes all headers from the response except for those in the exclude list.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Comet Opik Tracing
|
|
2
|
+
|
|
3
|
+
The Comet Opik Tracing policy integrates
|
|
4
|
+
[Comet Opik](https://www.comet.com/docs/opik/) with the AI Gateway. It captures
|
|
5
|
+
LLM inputs, outputs, model information, token usage, request metadata, and
|
|
6
|
+
timing so you can debug applications, monitor production traffic, and evaluate
|
|
7
|
+
model output in Opik.
|
|
8
|
+
|
|
9
|
+
The policy supports Chat Completions, Responses, and Anthropic Messages. It
|
|
10
|
+
creates the top-level trace synchronously before forwarding the request, so Opik
|
|
11
|
+
API latency delays the provider request even when trace creation fails. The
|
|
12
|
+
response span is delivered in the background. For a streaming response, the
|
|
13
|
+
policy observes a clone of the original stream when it is still readable; the
|
|
14
|
+
client does not wait for response-span delivery. If an earlier response hook has
|
|
15
|
+
already consumed the original stream, output tracing is skipped and the client
|
|
16
|
+
response continues unchanged.
|
|
17
|
+
|
|
18
|
+
## Configure the policy
|
|
19
|
+
|
|
20
|
+
Create or select an Opik project and workspace, then generate an API key.
|
|
21
|
+
Declare the policy in `config/policies.json` and add it to each application
|
|
22
|
+
chain that should emit traces:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"name": "comet-opik-tracing-v2-inbound",
|
|
27
|
+
"policyType": "comet-opik-tracing-v2",
|
|
28
|
+
"handler": {
|
|
29
|
+
"export": "CometOpikTracingV2InboundPolicy",
|
|
30
|
+
"module": "$import(@zuplo/runtime)",
|
|
31
|
+
"options": {
|
|
32
|
+
"apiKey": "$env(COMET_OPIK_API_KEY)",
|
|
33
|
+
"projectName": "your-project-name",
|
|
34
|
+
"workspace": "your-workspace"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Place the policy near the end of the chain so the trace records request-body
|
|
41
|
+
changes made by earlier policies. The recorded model label comes from the app
|
|
42
|
+
configuration when available, then falls back to the request body. A model
|
|
43
|
+
selected through request-scoped routing is not included in this trace label.
|
|
44
|
+
|
|
45
|
+
## Options
|
|
46
|
+
|
|
47
|
+
| Option | Default | What it does |
|
|
48
|
+
| ---------------- | -------------------------------- | ------------------------------------------------------ |
|
|
49
|
+
| `apiKey` | Required | Authenticates to Comet Opik. |
|
|
50
|
+
| `projectName` | Required | Selects the Opik project that receives traces. |
|
|
51
|
+
| `workspace` | Required | Selects the Opik workspace. |
|
|
52
|
+
| `baseUrl` | `https://www.comet.com/opik/api` | Overrides the Opik API URL. |
|
|
53
|
+
| `endpoints` | All shapes | Limits tracing to selected AI Gateway endpoint shapes. |
|
|
54
|
+
| `onUnknownShape` | `skip` | Skips or denies a request whose shape cannot be read. |
|
|
55
|
+
|
|
56
|
+
As an observer, the policy fails open by default. A trace API failure is logged
|
|
57
|
+
but does not fail the AI request. Setting `onUnknownShape` to `deny` only
|
|
58
|
+
changes the behavior for an uninspectable request shape.
|
|
59
|
+
|
|
60
|
+
## Trace structure
|
|
61
|
+
|
|
62
|
+
The policy creates one top-level trace when the request begins and an LLM span
|
|
63
|
+
when the response completes. Records include:
|
|
64
|
+
|
|
65
|
+
- Prompt or input content and the model name.
|
|
66
|
+
- Completion text for streaming and non-streaming responses.
|
|
67
|
+
- Input, output, and total token counts when the provider reports them.
|
|
68
|
+
- Zuplo request ID and route for correlation.
|
|
69
|
+
- Temperature and maximum-token settings when present.
|
|
70
|
+
|
|
71
|
+
In Opik, you can annotate these traces, group them into datasets, run heuristic
|
|
72
|
+
or LLM-as-a-judge evaluations, compare model variants, and monitor quality and
|
|
73
|
+
cost trends.
|
|
74
|
+
|
|
75
|
+
## Additional resources
|
|
76
|
+
|
|
77
|
+
- [Comet Opik documentation](https://www.comet.com/docs/opik/)
|
|
78
|
+
- [Opik tracing guide](https://www.comet.com/docs/opik/tracing/log_traces)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
The Comet Opik Tracing policy sends AI Gateway requests, responses, token usage,
|
|
2
|
+
and timing data to Comet Opik for observability and evaluation. It supports
|
|
3
|
+
streaming and non-streaming traffic across all AI Gateway request shapes.
|
|
4
|
+
|
|
5
|
+
Place it near the end of the application policy chain so traces reflect the
|
|
6
|
+
request body after earlier policy changes. Creating the top-level trace is
|
|
7
|
+
synchronous, so the provider request waits for the Opik API call to finish,
|
|
8
|
+
including failed calls. Response-span delivery runs in the background and does
|
|
9
|
+
not modify the client response. Streaming output tracing is skipped if an
|
|
10
|
+
earlier response hook has already consumed the original stream.
|
package/docs/policies/{comet-opik-tracing-inbound → comet-opik-tracing-v2-inbound}/schema.json
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/comet-opik-tracing-inbound.json",
|
|
3
|
+
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/comet-opik-tracing-v2-inbound.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"title": "Comet Opik Tracing",
|
|
6
6
|
"isDeprecated": false,
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"isInternal": false,
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
|
-
"requiresAI":
|
|
12
|
+
"requiresAI": true,
|
|
13
|
+
"policyType": "comet-opik-tracing-v2",
|
|
13
14
|
"products": ["ai-gateway"],
|
|
14
15
|
"description": "Comet Opik Tracing Inbound Policy",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
"required": ["export", "module", "options"],
|
|
22
23
|
"properties": {
|
|
23
24
|
"export": {
|
|
24
|
-
"const": "
|
|
25
|
+
"const": "CometOpikTracingV2InboundPolicy",
|
|
25
26
|
"description": "The name of the exported type"
|
|
26
27
|
},
|
|
27
28
|
"module": {
|
|
@@ -29,9 +30,17 @@
|
|
|
29
30
|
"description": "The module containing the policy"
|
|
30
31
|
},
|
|
31
32
|
"options": {
|
|
33
|
+
"x-zuplo-policy-type": "comet-opik-tracing-v2",
|
|
32
34
|
"title": "Comet Opik Tracing",
|
|
33
35
|
"description": "Track AI Gateway requests and responses using Comet Opik's LLM observability platform.",
|
|
34
36
|
"type": "object",
|
|
37
|
+
"examples": [
|
|
38
|
+
{
|
|
39
|
+
"apiKey": "$env(COMET_OPIK_API_KEY)",
|
|
40
|
+
"projectName": "your-project-name",
|
|
41
|
+
"workspace": "your-workspace"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
35
44
|
"properties": {
|
|
36
45
|
"apiKey": {
|
|
37
46
|
"description": "The Comet Opik API key for authentication.",
|
|
@@ -49,6 +58,28 @@
|
|
|
49
58
|
"x-advanced": true,
|
|
50
59
|
"description": "The base URL for the Comet Opik API (optional, defaults to https://www.comet.com/opik/api).",
|
|
51
60
|
"type": "string"
|
|
61
|
+
},
|
|
62
|
+
"endpoints": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"title": "Applicable Endpoints",
|
|
65
|
+
"x-advanced": true,
|
|
66
|
+
"description": "The endpoint shapes this policy applies to. Omit to apply to all (openai-chat, openai-responses, anthropic-messages).",
|
|
67
|
+
"items": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"enum": [
|
|
70
|
+
"openai-chat",
|
|
71
|
+
"openai-responses",
|
|
72
|
+
"anthropic-messages"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"onUnknownShape": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"title": "On Unknown Shape",
|
|
79
|
+
"x-advanced": true,
|
|
80
|
+
"description": "What to do on a shape the policy cannot read. As an observer this defaults to 'skip' (fail open — pass through untraced).",
|
|
81
|
+
"enum": ["deny", "skip"],
|
|
82
|
+
"default": "skip"
|
|
52
83
|
}
|
|
53
84
|
},
|
|
54
85
|
"required": ["apiKey", "projectName", "workspace"],
|
|
@@ -57,9 +88,13 @@
|
|
|
57
88
|
},
|
|
58
89
|
"examples": [
|
|
59
90
|
{
|
|
60
|
-
"export": "
|
|
91
|
+
"export": "CometOpikTracingV2InboundPolicy",
|
|
61
92
|
"module": "$import(@zuplo/runtime)",
|
|
62
|
-
"options": {
|
|
93
|
+
"options": {
|
|
94
|
+
"apiKey": "$env(COMET_OPIK_API_KEY)",
|
|
95
|
+
"projectName": "your-project-name",
|
|
96
|
+
"workspace": "your-workspace"
|
|
97
|
+
}
|
|
63
98
|
}
|
|
64
99
|
]
|
|
65
100
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "complex-rate-limit-inbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "The Complex Rate Limiting policy is an advanced rate limiting policy that let's you set rate limits based on custom counters (not just requests)",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "composite-inbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Creates a composite, or group policy - composed of other inbound policies. For reuse across routes.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "composite-outbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Creates a composite, or group policy - composed of other outbound policies. For reuse across routes.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -33,7 +33,7 @@ identifiers, `secret-aws` enables both AWS entities. Two named groups (`pii`,
|
|
|
33
33
|
| `id` | `id-us-ssn`, `id-us-itin`, `id-us-passport`, `id-uk-nino`, `id-uk-nhs` (mod-11), `id-ca-sin` (Luhn), `id-au-abn`, `id-au-acn`, `id-au-tfn`, `id-au-medicare` (all checksummed), `id-in-aadhaar` (Verhoeff), `id-in-pan`, `id-sg-nric` (checksum), `id-es-nif` (checksum), `id-it-fiscal-code` (checksum), `id-pl-pesel` (checksum), `id-nl-bsn` (11-proef), `id-br-cpf` (checksum), `id-fr-nir` (mod-97) |
|
|
34
34
|
| `contact` | `contact-email`, `contact-phone` |
|
|
35
35
|
| `network` | `network-ipv4`, `network-ipv6`, `network-mac` |
|
|
36
|
-
| `pii` | `contact` + `id`
|
|
36
|
+
| `pii` | `contact` + `id` + `finance-credit-card` + `finance-iban` |
|
|
37
37
|
| Prefixes | `id-us`, `id-uk`, `id-au`, `id-ca`, `id-in`, `id-sg`, `id-es`, `id-it`, `id-pl`, `id-nl`, `id-br`, `id-fr`, `finance-us`, `secret-aws` — everything whose id starts with that prefix |
|
|
38
38
|
| `region-eu` | `id-es-nif`, `id-it-fiscal-code`, `id-pl-pesel`, `id-nl-bsn`, `id-fr-nir`, `finance-iban` |
|
|
39
39
|
|
|
@@ -50,9 +50,12 @@ For example, with the `id-uk-nhs` entity enabled, `{"nhsNumber": "9434765919"}`
|
|
|
50
50
|
is masked while the same digits in `{"orderId": "9434765919"}` pass through
|
|
51
51
|
untouched.
|
|
52
52
|
|
|
53
|
-
The threshold is configurable via `minConfidence` (default `0.5`)
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
The threshold is configurable via `minConfidence` (default `0.5`). Lowering it
|
|
54
|
+
surfaces context-dependent entities without their context words. Raising it is
|
|
55
|
+
not a precision filter: any recognizer whose base confidence falls below the
|
|
56
|
+
threshold stops matching except near its context words, and most
|
|
57
|
+
checksum-validated recognizers run at `0.85`, so high thresholds disable most
|
|
58
|
+
of the catalog. To narrow detection, scope the `entities` list instead.
|
|
56
59
|
|
|
57
60
|
## Custom patterns
|
|
58
61
|
|
|
@@ -62,11 +65,23 @@ JavaScript regular expression `pattern`, and optionally a `confidence` and
|
|
|
62
65
|
and skipped rather than failing the request. Remember to escape backslashes for
|
|
63
66
|
JSON (for example `\\d` to match a digit).
|
|
64
67
|
|
|
68
|
+
## Allowed values
|
|
69
|
+
|
|
70
|
+
Use `allowValues` to exempt specific values that would otherwise match — for
|
|
71
|
+
example the Stripe test card number `4242 4242 4242 4242` in a payments
|
|
72
|
+
sandbox, or a public support email address. Entries are compared against the
|
|
73
|
+
exact matched text (case-sensitive, separators included), so list every
|
|
74
|
+
written form you want to allow.
|
|
75
|
+
|
|
65
76
|
## Content types
|
|
66
77
|
|
|
67
78
|
Only text-based bodies (JSON, XML, form-encoded, and `text/*`) are scanned;
|
|
68
|
-
binary bodies pass through untouched.
|
|
69
|
-
`
|
|
79
|
+
binary bodies pass through untouched. Server-sent event streams
|
|
80
|
+
(`text/event-stream`) are excluded from the default allow-list: scanning
|
|
81
|
+
buffers the whole body, which would hold back every event until the stream
|
|
82
|
+
ends. Override the allow-list with the `contentTypes` option if you need to
|
|
83
|
+
scan a different set of content types (including `text/event-stream`, if you
|
|
84
|
+
accept the buffering).
|
|
70
85
|
|
|
71
86
|
## Configuration
|
|
72
87
|
|
|
@@ -79,6 +94,7 @@ binary bodies pass through untouched. Override the allow-list with the
|
|
|
79
94
|
- `action`: `mask`, `block`, or `log`. **Default:** `mask`
|
|
80
95
|
- `mask`: Replacement string used when `action` is `mask`. **Default:**
|
|
81
96
|
`[REDACTED]`
|
|
97
|
+
- `allowValues`: Exact matched-text values that are never reported
|
|
82
98
|
- `minConfidence`: Detection threshold (0-1). **Default:** `0.5`
|
|
83
99
|
- `contentTypes`: Override the scannable content-type allow-list
|
|
84
100
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"isBeta": false,
|
|
11
11
|
"isHidden": false,
|
|
12
12
|
"requiresAI": false,
|
|
13
|
+
"policyType": "data-loss-prevention-inbound",
|
|
13
14
|
"products": ["api-gateway"],
|
|
14
15
|
"description": "Scans the incoming request body for sensitive data — PII, secrets, and financial identifiers — using an extensible catalog of built-in recognizers plus any custom patterns, and takes a configurable action when a match is found.\n\nThe action is one of `mask` (redact matches before forwarding the request), `block` (reject with a `422` listing the detected entity names only), or `log` (record a warning and forward unchanged). Only text content types are inspected; binary bodies pass through untouched, and the body is read from a clone so the upstream still receives the original stream.",
|
|
15
16
|
"deprecatedMessage": "",
|
|
@@ -187,6 +188,14 @@
|
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
},
|
|
191
|
+
"allowValues": {
|
|
192
|
+
"type": "array",
|
|
193
|
+
"x-advanced": true,
|
|
194
|
+
"description": "Values that are never reported as findings, compared against the exact matched text (case-sensitive, separators included). Use this to exempt well-known non-sensitive values that share a sensitive shape — for example the Stripe test card number `4242 4242 4242 4242` in a payments sandbox, or a public support email address. List every written form you want to allow (a spaced and an unspaced card number are different matches).",
|
|
195
|
+
"items": {
|
|
196
|
+
"type": "string"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
190
199
|
"minConfidence": {
|
|
191
200
|
"type": "number",
|
|
192
201
|
"minimum": 0,
|
|
@@ -194,7 +203,7 @@
|
|
|
194
203
|
"default": 0.5,
|
|
195
204
|
"x-show-example": false,
|
|
196
205
|
"x-advanced": true,
|
|
197
|
-
"description": "Minimum confidence (0-1) a match must reach to count as a finding.
|
|
206
|
+
"description": "Minimum confidence (0-1) a match must reach to count as a finding. Every match starts at its recognizer's base confidence and gains a fixed boost of 0.45 when one of the recognizer's context words appears near it. Ambiguous shapes (for example `finance-us-bank-account` or `finance-cvv`) have a low base confidence and only cross the default threshold of 0.5 with that boost; lower the threshold to surface them without context. Raising the threshold is not a precision filter: any recognizer whose base confidence falls below it stops matching entirely except near its context words, and most checksum-validated recognizers run at 0.85, so values above 0.85 disable most of the catalog. To narrow detection, scope the `entities` list instead."
|
|
198
207
|
},
|
|
199
208
|
"contentTypes": {
|
|
200
209
|
"type": "array",
|