Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Merge remote-tracking branch 'berri/litellm_internal_staging' into litellm_playground_shadcn

mubashir1osmani136ef345da4b
diff --cc ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx
index 7c2fc47bd63,0c487af213e..9c102c0526c
--- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx
@@@ -1,5 -1,5 +1,6 @@@
- import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";
+ import { act, fireEvent, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+ import { renderWithProviders as render } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
import ChatUI from "./ChatUI";
import * as fetchModelsModule from "@/components/llm_calls/fetch_models";
diff --cc ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.tsx
index b0f43456a7c,0241ef8a77e..384d10fd91b
--- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.tsx
@@@ -1674,31 -1654,36 +1676,33 @@@ const ChatUI: React.FC<ChatUIProps> = (
/>
</div>
- <div>
- <div className="mb-2 flex items-center gap-1 text-sm font-medium text-gray-700">
- <Shield className="mr-1 size-4" aria-hidden="true" /> Policies
- <Tooltip>
- <TooltipTrigger aria-label="About policies">
- <Info className="size-3.5 text-gray-400" />
- </TooltipTrigger>
- <TooltipContent className="max-w-xs">
- Select policy/policies to apply to this LLM API call. Policies define which guardrails are
- applied based on conditions. You can set up your policies{" "}
- <a href="?page=policies" className="text-blue-500 underline">
- here
- </a>
- .
- </TooltipContent>
- </Tooltip>
+ {canViewPolicies && (
+ <div>
- <Text className="font-medium block mb-2 text-gray-700 flex items-center">
- <SafetyOutlined className="mr-2" /> Policies
- <Tooltip
- className="ml-1"
- title={
- <span>
- Select policy/policies to apply to this LLM API call. Policies define which guardrails are
- applied based on conditions. You can set up your policies{" "}
- <a href="?page=policies" style={{ color: "#1890ff" }}>
- here
- </a>
- .
- </span>
- }
- >
- <InfoCircleOutlined />
++ <div className="mb-2 flex items-center gap-1 text-sm font-medium text-gray-700">
++ <Shield className="mr-1 size-4" aria-hidden="true" /> Policies
++ <Tooltip>
++ <TooltipTrigger aria-label="About policies">
++ <Info className="size-3.5 text-gray-400" />
++ </TooltipTrigger>
++ <TooltipContent className="max-w-xs">
++ Select policy/policies to apply to this LLM API call. Policies define which guardrails are
++ applied based on conditions. You can set up your policies{" "}
++ <a href="?page=policies" className="text-blue-500 underline">
++ here
++ </a>
++ .
++ </TooltipContent>
+ </Tooltip>
- </Text>
++ </div>
+ <PolicySelector
+ value={selectedPolicies}
+ onChange={setSelectedPolicies}
+ className="mb-4"
+ accessToken={accessToken || ""}
+ />
</div>
- <PolicySelector
- value={selectedPolicies}
- onChange={setSelectedPolicies}
- className="mb-4"
- accessToken={accessToken || ""}
- />
- </div>
+ )}
- {/* Code Interpreter Toggle - Only for Responses endpoint */}
{endpointType === EndpointType.RESPONSES && (
<div>
<CodeInterpreterTool
diff --cc ui/litellm-dashboard/src/components/policies/PolicySelector.tsx
index 1e565d938d7,69816fafc50..135aa0bc49f
--- a/ui/litellm-dashboard/src/components/policies/PolicySelector.tsx
+++ b/ui/litellm-dashboard/src/components/policies/PolicySelector.tsx
@@@ -1,7 -1,8 +1,8 @@@
import React, { useEffect, useState } from "react";
-import { Select } from "antd";
+ import useCan from "@/app/(dashboard)/hooks/useCan";
import { Policy } from "./types";
import { getPoliciesList } from "../networking";
+import { MultiSelect } from "@/components/shared/MultiSelect";
/** Prefix for policy version IDs in request body; must match backend POLICY_VERSION_ID_PREFIX. */
export const POLICY_VERSION_ID_PREFIX = "policy_";
@@@ -79,9 -81,14 +81,13 @@@ const PolicySelector: React.FC<PolicySe
onChange(selectedValues);
};
+ if (!canViewPolicies) {
+ return null;
+ }
+
return (
- <div>
- <Select
- mode="multiple"
+ <div className="min-w-0">
+ <MultiSelect
disabled={disabled}
placeholder={
disabled ? "Setting policies is a premium feature." : "Select policies (production or published versions)"