mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
add compliance check functions to networking.tsx
This commit is contained in:
parent
a2d15dc7bd
commit
8c02138201
1 changed files with 67 additions and 0 deletions
|
|
@ -9235,3 +9235,70 @@ export const deleteClaudeCodePlugin = async (accessToken: string, pluginName: st
|
|||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// Compliance check types and functions
|
||||
|
||||
export interface ComplianceCheckResult {
|
||||
check_name: string;
|
||||
article: string;
|
||||
passed: boolean;
|
||||
detail: string;
|
||||
}
|
||||
|
||||
export interface ComplianceResponse {
|
||||
compliant: boolean;
|
||||
regulation: string;
|
||||
checks: ComplianceCheckResult[];
|
||||
}
|
||||
|
||||
export interface ComplianceCheckRequest {
|
||||
request_id: string;
|
||||
user_id?: string;
|
||||
model?: string;
|
||||
timestamp?: string;
|
||||
guardrail_information?: Record<string, any>[];
|
||||
}
|
||||
|
||||
export const checkEuAiActCompliance = async (
|
||||
accessToken: string,
|
||||
payload: ComplianceCheckRequest
|
||||
): Promise<ComplianceResponse> => {
|
||||
const url = proxyBaseUrl
|
||||
? `${proxyBaseUrl}/compliance/eu-ai-act`
|
||||
: `/compliance/eu-ai-act`;
|
||||
const response = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
if (!response.ok) {
|
||||
const errorData = await response.text();
|
||||
throw new Error(errorData);
|
||||
}
|
||||
return response.json();
|
||||
};
|
||||
|
||||
export const checkGdprCompliance = async (
|
||||
accessToken: string,
|
||||
payload: ComplianceCheckRequest
|
||||
): Promise<ComplianceResponse> => {
|
||||
const url = proxyBaseUrl
|
||||
? `${proxyBaseUrl}/compliance/gdpr`
|
||||
: `/compliance/gdpr`;
|
||||
const response = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
if (!response.ok) {
|
||||
const errorData = await response.text();
|
||||
throw new Error(errorData);
|
||||
}
|
||||
return response.json();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue