From 0bbf4fa58cf3c0399b1a4e4eef1cc52c09102c7f Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 13 Feb 2026 19:35:04 -0800 Subject: [PATCH] Add testPipelineCall networking function --- .../src/components/networking.tsx | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index 55b97f5252f..885a62fab54 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -5673,6 +5673,37 @@ export const deletePolicyAttachmentCall = async (accessToken: string, attachment } }; +export const testPipelineCall = async ( + accessToken: string, + pipeline: any, + testMessages: Array<{role: string, content: string}> +) => { + try { + const url = proxyBaseUrl ? `${proxyBaseUrl}/policies/test-pipeline` : `/policies/test-pipeline`; + const response = await fetch(url, { + method: "POST", + headers: { + [globalLitellmHeaderName]: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + body: JSON.stringify({ pipeline, test_messages: testMessages }), + }); + + if (!response.ok) { + const errorData = await response.json(); + const errorMessage = deriveErrorMessage(errorData); + handleError(errorMessage); + throw new Error(errorMessage); + } + + const data = await response.json(); + return data; + } catch (error) { + console.error("Failed to test pipeline:", error); + throw error; + } +}; + export const getResolvedGuardrails = async (accessToken: string, policyId: string) => { try { const url = proxyBaseUrl