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]

fixing build

yuneng-jiang1dbb6e0d3fac
diff --git a/ui/litellm-dashboard/src/components/policies/index.tsx b/ui/litellm-dashboard/src/components/policies/index.tsx
index f24d2e2c113..717a6ff612f 100644
--- a/ui/litellm-dashboard/src/components/policies/index.tsx
+++ b/ui/litellm-dashboard/src/components/policies/index.tsx
@@ -279,7 +279,7 @@ const PoliciesPanel: React.FC<PoliciesPanelProps> = ({
description={
<div>
<p className="mb-3">
- Policy attachments control where your policies apply. Policies don't do anything until you attach them to specific teams, keys, models, or globally.
+ Policy attachments control where your policies apply. Policies don&apos;t do anything until you attach them to specific teams, keys, models, or globally.
</p>
<p className="mb-2 font-semibold">Attachment Scopes:</p>
<ul className="list-disc list-inside mb-3 space-y-1 ml-2">
diff --git a/ui/litellm-dashboard/src/components/team/team_info.tsx b/ui/litellm-dashboard/src/components/team/team_info.tsx
index 34a47a2495b..193d056fdd4 100644
--- a/ui/litellm-dashboard/src/components/team/team_info.tsx
+++ b/ui/litellm-dashboard/src/components/team/team_info.tsx
@@ -96,6 +96,8 @@ export interface TeamData {
model_aliases: Record<string, string>;
} | null;
created_at: string;
+ guardrails?: string[];
+ policies?: string[];
object_permission?: {
object_permission_id: string;
mcp_servers: string[];
@@ -270,7 +272,7 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
// Fetch resolved guardrails for all policies
useEffect(() => {
const fetchPolicyGuardrails = async () => {
- if (!accessToken || !info?.policies || info.policies.length === 0) {
+ if (!accessToken || !teamData?.team_info?.policies || teamData.team_info.policies.length === 0) {
return;
}
@@ -279,7 +281,7 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
try {
await Promise.all(
- info.policies.map(async (policyName: string) => {
+ teamData.team_info.policies.map(async (policyName: string) => {
try {
const policyInfo = await getPolicyInfoWithGuardrails(accessToken, policyName);
guardrailsMap[policyName] = policyInfo.resolved_guardrails || [];
@@ -298,7 +300,7 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
};
fetchPolicyGuardrails();
- }, [accessToken, info?.policies]);
+ }, [accessToken, teamData?.team_info?.policies]);
const handleMemberCreate = async (values: any) => {
try {
@@ -462,6 +464,7 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
logging: values.logging_settings || [],
...(secretManagerSettings !== undefined ? { secret_manager_settings: secretManagerSettings } : {}),
},
+ policies: values.policies || [],
organization_id: values.organization_id,
};
@@ -757,6 +760,7 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
team_member_budget: info.team_member_budget_table?.max_budget,
team_member_budget_duration: info.team_member_budget_table?.budget_duration,
guardrails: info.metadata?.guardrails || [],
+ policies: info.policies || [],
disable_global_guardrails: info.metadata?.disable_global_guardrails || false,
metadata: info.metadata
? JSON.stringify(
diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
index f3739a53bdc..d9d4bf53384 100644
--- a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
+++ b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
@@ -73,7 +73,8 @@ export default function KeyInfoView({
// Fetch resolved guardrails for all policies
useEffect(() => {
const fetchPolicyGuardrails = async () => {
- if (!accessToken || !currentKeyData?.metadata?.policies || currentKeyData.metadata.policies.length === 0) {
+ const policies = currentKeyData?.metadata?.policies;
+ if (!accessToken || !policies || !Array.isArray(policies) || policies.length === 0) {
return;
}
@@ -82,7 +83,7 @@ export default function KeyInfoView({
try {
await Promise.all(
- currentKeyData.metadata.policies.map(async (policyName: string) => {
+ policies.map(async (policyName: string) => {
try {
const policyInfo = await getPolicyInfoWithGuardrails(accessToken, policyName);
guardrailsMap[policyName] = policyInfo.resolved_guardrails || [];
@@ -521,9 +522,9 @@ export default function KeyInfoView({
<Card>
<Text className="font-medium mb-3">Guardrails</Text>
- {currentKeyData.guardrails && currentKeyData.guardrails.length > 0 ? (
+ {Array.isArray(currentKeyData.metadata?.guardrails) && currentKeyData.metadata.guardrails.length > 0 ? (
<div className="flex flex-wrap gap-2">
- {currentKeyData.guardrails.map((guardrail, index) => (
+ {currentKeyData.metadata.guardrails.map((guardrail: string, index: number) => (
<Badge key={index} color="blue">
{guardrail}
</Badge>
@@ -532,16 +533,17 @@ export default function KeyInfoView({
) : (
<Text className="text-gray-500">No guardrails configured</Text>
)}
- {currentKeyData.metadata?.disable_global_guardrails && (
- <div className="mt-3 pt-3 border-t border-gray-200">
- <Badge color="yellow">Global Guardrails Disabled</Badge>
- </div>
- )}
+ {typeof currentKeyData.metadata?.disable_global_guardrails === "boolean" &&
+ currentKeyData.metadata.disable_global_guardrails === true && (
+ <div className="mt-3 pt-3 border-t border-gray-200">
+ <Badge color="yellow">Global Guardrails Disabled</Badge>
+ </div>
+ )}
</Card>
<Card>
<Text className="font-medium mb-3">Policies</Text>
- {currentKeyData.metadata?.policies && currentKeyData.metadata.policies.length > 0 ? (
+ {Array.isArray(currentKeyData.metadata?.policies) && currentKeyData.metadata.policies.length > 0 ? (
<div className="space-y-4">
{currentKeyData.metadata.policies.map((policy: string, index: number) => (
<div key={index} className="space-y-2">