Repository navigation
feat: add provider compliance policies #2701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a6514f8
46ee611
b5dcf0f
06aa366
72498cc
b85045f
b2f7fab
4bd213a
dd596a1
4f99033
66d9f31
8b4abea
d3ad1c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,7 @@ import { z } from "zod"; | |||||||||||||||||||||||||||||||||||
| import { userHasOrganizationAccess } from "@/utils/authorization.js"; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| import { db } from "@llmgateway/db"; | ||||||||||||||||||||||||||||||||||||
| import { buildSignedGatewayVideoLogContentUrl } from "@llmgateway/shared/video-access"; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| import type { ServerTypes } from "@/vars.js"; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -42,6 +43,15 @@ const videoJobResponseSchema = z.object({ | |||||||||||||||||||||||||||||||||||
| details: z.unknown().optional(), | ||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||
| .nullable(), | ||||||||||||||||||||||||||||||||||||
| content: z | ||||||||||||||||||||||||||||||||||||
| .array( | ||||||||||||||||||||||||||||||||||||
| z.object({ | ||||||||||||||||||||||||||||||||||||
| type: z.literal("video"), | ||||||||||||||||||||||||||||||||||||
| url: z.string(), | ||||||||||||||||||||||||||||||||||||
| mime_type: z.string().nullable().optional(), | ||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| .optional(), | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const getVideoStatus = createRoute({ | ||||||||||||||||||||||||||||||||||||
|
|
@@ -92,6 +102,29 @@ video.openapi(getVideoStatus, async (c) => { | |||||||||||||||||||||||||||||||||||
| throw new HTTPException(404, { message: "Video not found" }); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let content: | ||||||||||||||||||||||||||||||||||||
| | { type: "video"; url: string; mime_type?: string | null }[] | ||||||||||||||||||||||||||||||||||||
| | undefined; | ||||||||||||||||||||||||||||||||||||
| if (job.status === "completed") { | ||||||||||||||||||||||||||||||||||||
| const log = await db.query.log.findFirst({ | ||||||||||||||||||||||||||||||||||||
| where: { | ||||||||||||||||||||||||||||||||||||
| requestId: { eq: job.requestId }, | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+110
to
+112
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For completed jobs this query finds the first log with the same Useful? React with 👍 / 👎. |
||||||||||||||||||||||||||||||||||||
| columns: { | ||||||||||||||||||||||||||||||||||||
| id: true, | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+109
to
+116
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scope the log lookup to the same project (or organization), not only
Suggested fix const log = await db.query.log.findFirst({
where: {
requestId: { eq: job.requestId },
+ projectId: { eq: job.projectId },
},
columns: {
id: true,
},
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| if (log) { | ||||||||||||||||||||||||||||||||||||
| content = [ | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| type: "video" as const, | ||||||||||||||||||||||||||||||||||||
| url: buildSignedGatewayVideoLogContentUrl(log.id), | ||||||||||||||||||||||||||||||||||||
| mime_type: job.contentType ?? null, | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| return c.json( | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| id: job.id, | ||||||||||||||||||||||||||||||||||||
|
|
@@ -107,6 +140,7 @@ video.openapi(getVideoStatus, async (c) => { | |||||||||||||||||||||||||||||||||||
| completed_at: toUnixTimestamp(job.completedAt), | ||||||||||||||||||||||||||||||||||||
| expires_at: toUnixTimestamp(job.expiresAt), | ||||||||||||||||||||||||||||||||||||
| error: job.error ?? null, | ||||||||||||||||||||||||||||||||||||
| content, | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| 200, | ||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| title: Compliance | ||
| description: Restrict routing to providers that meet your compliance requirements (SOC 2, ISO 27001, GDPR, no prompt training, no prompt logging) | ||
| icon: BadgeCheck | ||
| --- | ||
|
|
||
| import { Callout } from "fumadocs-ui/components/callout"; | ||
|
|
||
| # Provider Compliance Policies | ||
|
|
||
| Provider compliance policies let you guarantee that requests are only ever routed to providers that meet your organization's regulatory requirements. When a request would be routed to a provider that doesn't meet the policy, the gateway blocks it **before any data leaves the gateway**. | ||
|
|
||
| <Callout type="info"> | ||
| Provider compliance policies are available on the [**Enterprise | ||
| plan**](https://llmgateway.io/enterprise) for organization owners and admins. | ||
| </Callout> | ||
|
|
||
| ## Requirements | ||
|
|
||
| Enable a policy under **Settings → Compliance** in the dashboard and toggle the requirements you need: | ||
|
|
||
| | Requirement | A provider is allowed when… | | ||
| | -------------------------- | ----------------------------------- | | ||
| | **SOC 2 (Type 2)** | it holds a SOC 2 certification | | ||
| | **ISO 27001** | it holds an ISO 27001 certification | | ||
| | **SOC 2 or ISO 27001** | it holds either SOC 2 or ISO 27001 | | ||
| | **GDPR compliant** | it is GDPR compliant | | ||
| | **No training on prompts** | it does not train on API prompts | | ||
| | **No prompt logging** | it does not log prompts | | ||
|
|
||
| Every requirement is **fail-closed**: a provider passes only if its published data policy explicitly satisfies the requirement. If an attribute is unknown for a provider, that provider is treated as non-compliant. | ||
|
|
||
| The settings page shows a live preview of which providers are allowed and which are blocked under the current policy, so you can see the impact before saving. | ||
|
|
||
| ## Enforcement | ||
|
|
||
| When no available provider for a model meets the policy — or a pinned provider is non-compliant — the gateway returns a `403`: | ||
|
|
||
| ```json | ||
| { | ||
| "error": { | ||
| "message": "This request was blocked by your organization's provider compliance policy. No available provider for deepseek-v3.2 meets the required certifications. Contact your LLMGateway admin to adjust the policy." | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| This applies to both routing modes: | ||
|
|
||
| - **Automatic routing** — non-compliant providers are removed from the candidate set, and the request is blocked if none remain. | ||
| - **Pinned providers** — a request such as `deepseek/deepseek-v3.2` is blocked when that specific provider does not meet the policy. | ||
|
|
||
| Each block is recorded as a **security event** so administrators can review what was rejected and why. | ||
|
|
||
| ## Access Control | ||
|
|
||
| Only organization **owners** and **admins** can view and change the compliance policy. | ||
|
|
||
| ## Related | ||
|
|
||
| - [Data Retention](/features/data-retention) — control whether request and response payloads are stored. | ||
| - [Guardrails](/features/guardrails) — detect and block harmful or sensitive content. | ||
|
|
||
| ## Get Started | ||
|
|
||
| Provider compliance policies are an Enterprise feature. [Contact us](https://llmgateway.io/enterprise) to enable Enterprise for your organization. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -88,12 +88,52 @@ const anthropicMessageSchema = z.object({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const anthropicToolSchema = z.object({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Standard Anthropic "custom" tools: a name plus a JSON schema describing the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // parameters the model should produce. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const anthropicCustomToolSchema = z.object({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: z.literal("custom").optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: z.string(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: z.string(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: z.string().optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| input_schema: z.record(z.unknown()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cache_control: z | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .object({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: z.enum(["ephemeral"]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ttl: z.enum(["5m", "1h"]).optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .nullish(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Anthropic server-side tools (e.g. web_search_20250305, code_execution_*). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // These are executed by Anthropic, carry a versioned `type` instead of an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // `input_schema`, and must not be validated as custom tools. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const anthropicServerToolSchema = z.object({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: z.string(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+109
to
+110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because this server-tool schema accepts any string Useful? React with 👍 / 👎. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: z.string(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| max_uses: z.number().optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| allowed_domains: z.array(z.string()).optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| blocked_domains: z.array(z.string()).optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+113
to
+114
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add mutual-exclusion validation for Anthropic server tool domain filters Line 113 and Line 114 currently permit both Suggested fix-const anthropicServerToolSchema = z.object({
- type: z.string(),
- name: z.string(),
- max_uses: z.number().optional(),
- allowed_domains: z.array(z.string()).optional(),
- blocked_domains: z.array(z.string()).optional(),
- user_location: z
- .object({
- type: z.literal("approximate").optional(),
- city: z.string().optional(),
- region: z.string().optional(),
- country: z.string().optional(),
- timezone: z.string().optional(),
- })
- .optional(),
- cache_control: z
- .object({
- type: z.enum(["ephemeral"]),
- ttl: z.enum(["5m", "1h"]).optional(),
- })
- .nullish(),
-});
+const anthropicServerToolSchema = z
+ .object({
+ type: z.string(),
+ name: z.string(),
+ max_uses: z.number().optional(),
+ allowed_domains: z.array(z.string()).optional(),
+ blocked_domains: z.array(z.string()).optional(),
+ user_location: z
+ .object({
+ type: z.literal("approximate").optional(),
+ city: z.string().optional(),
+ region: z.string().optional(),
+ country: z.string().optional(),
+ timezone: z.string().optional(),
+ })
+ .optional(),
+ cache_control: z
+ .object({
+ type: z.enum(["ephemeral"]),
+ ttl: z.enum(["5m", "1h"]).optional(),
+ })
+ .nullish(),
+ })
+ .superRefine((tool, ctx) => {
+ if (tool.allowed_domains && tool.blocked_domains) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message:
+ "allowed_domains and blocked_domains are mutually exclusive",
+ path: ["allowed_domains"],
+ });
+ }
+ });📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| user_location: z | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .object({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: z.literal("approximate").optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| city: z.string().optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| region: z.string().optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| country: z.string().optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timezone: z.string().optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cache_control: z | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .object({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: z.enum(["ephemeral"]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ttl: z.enum(["5m", "1h"]).optional(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .nullish(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const anthropicToolSchema = z.union([ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| anthropicCustomToolSchema, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| anthropicServerToolSchema, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const anthropicRequestSchema = z.object({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| model: z.string().openapi({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: "The model to use for completion", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -522,17 +562,49 @@ anthropic.openapi(messages, async (c) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Transform tools if provided | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Transform tools if provided. Custom tools map to OpenAI function tools; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Anthropic server-side tools (e.g. web_search_20250305) carry a versioned | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // `type` and no `input_schema`, so they're translated to the internal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // `web_search` tool the chat completions endpoint understands. Server tools | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // we can't represent are dropped (with a warning) rather than rejected. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let openaiTools; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (anthropicRequest.tools) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| openaiTools = anthropicRequest.tools.map((tool) => ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "function", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: tool.name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: tool.description, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parameters: tool.input_schema, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| openaiTools = anthropicRequest.tools | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map((tool) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ("input_schema" in tool) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "function", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: tool.name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: tool.description, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parameters: tool.input_schema, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (tool.type.startsWith("web_search")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "web_search", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...(tool.max_uses !== undefined ? { max_uses: tool.max_uses } : {}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...(tool.user_location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? { user_location: tool.user_location } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : {}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...(tool.allowed_domains | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? { allowed_domains: tool.allowed_domains } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : {}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...(tool.blocked_domains | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? { blocked_domains: tool.blocked_domains } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : {}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.warn("Dropping unsupported Anthropic server tool", { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: tool.type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: tool.name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .filter((tool): tool is NonNullable<typeof tool> => tool !== null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Build OpenAI request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -544,7 +616,7 @@ anthropic.openapi(messages, async (c) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stream: anthropicRequest.stream, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (openaiTools) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (openaiTools && openaiTools.length > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| openaiRequest.tools = openaiTools; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saving the new policy through this route updates the organization with the uncached
dbclient, while the gateway reads organizations through the cachedcdbpath infindOrganizationById; only cached-client mutations triggerRedisCache.onMutateand SWR invalidation. If an admin enables a stricter policy after the org was cached, the gateway can continue using the oldproviderCompliancePolicyuntil the cache expires, allowing non-compliant traffic during that window.Useful? React with 👍 / 👎.