+ Select Time Range
+ {
+ setDateValue(value);
+ updateModelMetrics(
+ selectedModelGroup,
+ value.from,
+ value.to
+ ); // Call updateModelMetrics with the new date range
+ }}
+ />
+
+
-
- Enterprise features are available for users with a specific license,
- please contact LiteLLM to unlock this limitation.
-
-
-
- Get in touch
-
-
-
);
};
diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx
index 4673e064f5..46099906ac 100644
--- a/ui/litellm-dashboard/src/components/networking.tsx
+++ b/ui/litellm-dashboard/src/components/networking.tsx
@@ -36,6 +36,21 @@ export interface Organization {
members: any[] | null;
}
+export interface CredentialItem {
+ credential_name: string;
+ credential_values: object;
+ credential_info: {
+ custom_llm_provider?: string;
+ description?: string;
+ required?: boolean;
+ };
+}
+
+export interface CredentialsResponse {
+ credentials: CredentialItem[];
+}
+
+
const baseUrl = "/"; // Assuming the base URL is the root
@@ -2527,6 +2542,158 @@ export const teamCreateCall = async (
}
};
+export const credentialCreateCall = async (
+ accessToken: string,
+ formValues: Record // Assuming formValues is an object
+) => {
+ try {
+ console.log("Form Values in credentialCreateCall:", formValues); // Log the form values before making the API call
+ if (formValues.metadata) {
+ console.log("formValues.metadata:", formValues.metadata);
+ // if there's an exception JSON.parse, show it in the message
+ try {
+ formValues.metadata = JSON.parse(formValues.metadata);
+ } catch (error) {
+ throw new Error("Failed to parse metadata: " + error);
+ }
+ }
+
+ const url = proxyBaseUrl ? `${proxyBaseUrl}/credentials` : `/credentials`;
+ const response = await fetch(url, {
+ method: "POST",
+ headers: {
+ [globalLitellmHeaderName]: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ ...formValues, // Include formValues in the request body
+ }),
+ });
+
+ if (!response.ok) {
+ const errorData = await response.text();
+ handleError(errorData);
+ console.error("Error response from the server:", errorData);
+ throw new Error("Network response was not ok");
+ }
+
+ const data = await response.json();
+ console.log("API Response:", data);
+ return data;
+ // Handle success - you might want to update some state or UI based on the created key
+ } catch (error) {
+ console.error("Failed to create key:", error);
+ throw error;
+ }
+};
+
+export const credentialListCall = async (
+ accessToken: String,
+) => {
+ /**
+ * Get all available teams on proxy
+ */
+ try {
+ let url = proxyBaseUrl ? `${proxyBaseUrl}/credentials` : `/credentials`;
+ console.log("in credentialListCall");
+
+ const response = await fetch(url, {
+ method: "GET",
+ headers: {
+ [globalLitellmHeaderName]: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ },
+ });
+
+ if (!response.ok) {
+ const errorData = await response.text();
+ handleError(errorData);
+ throw new Error("Network response was not ok");
+ }
+
+ const data = await response.json();
+ console.log("/credentials API Response:", data);
+ return data;
+ // Handle success - you might want to update some state or UI based on the created key
+ } catch (error) {
+ console.error("Failed to create key:", error);
+ throw error;
+ }
+};
+
+export const credentialDeleteCall = async (accessToken: String, credentialName: String) => {
+ try {
+ const url = proxyBaseUrl ? `${proxyBaseUrl}/credentials/${credentialName}` : `/credentials/${credentialName}`;
+ console.log("in credentialDeleteCall:", credentialName);
+ const response = await fetch(url, {
+ method: "DELETE",
+ headers: {
+ [globalLitellmHeaderName]: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ },
+ });
+
+ if (!response.ok) {
+ const errorData = await response.text();
+ handleError(errorData);
+ throw new Error("Network response was not ok");
+ }
+ const data = await response.json();
+ console.log(data);
+ return data;
+ // Handle success - you might want to update some state or UI based on the created key
+ } catch (error) {
+ console.error("Failed to delete key:", error);
+ throw error;
+ }
+};
+
+export const credentialUpdateCall = async (
+ accessToken: string,
+ credentialName: string,
+ formValues: Record // Assuming formValues is an object
+) => {
+ try {
+ console.log("Form Values in credentialUpdateCall:", formValues); // Log the form values before making the API call
+ if (formValues.metadata) {
+ console.log("formValues.metadata:", formValues.metadata);
+ // if there's an exception JSON.parse, show it in the message
+ try {
+ formValues.metadata = JSON.parse(formValues.metadata);
+ } catch (error) {
+ throw new Error("Failed to parse metadata: " + error);
+ }
+ }
+
+ const url = proxyBaseUrl ? `${proxyBaseUrl}/credentials/${credentialName}` : `/credentials/${credentialName}`;
+ const response = await fetch(url, {
+ method: "PUT",
+ headers: {
+ [globalLitellmHeaderName]: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ ...formValues, // Include formValues in the request body
+ }),
+ });
+
+ if (!response.ok) {
+ const errorData = await response.text();
+ handleError(errorData);
+ console.error("Error response from the server:", errorData);
+ throw new Error("Network response was not ok");
+ }
+
+ const data = await response.json();
+ console.log("API Response:", data);
+ return data;
+ // Handle success - you might want to update some state or UI based on the created key
+ } catch (error) {
+ console.error("Failed to create key:", error);
+ throw error;
+ }
+};
+
export const keyUpdateCall = async (
accessToken: string,
formValues: Record // Assuming formValues is an object
diff --git a/ui/litellm-dashboard/src/components/team/team_info.tsx b/ui/litellm-dashboard/src/components/team/team_info.tsx
index d268f137f6..fd7f08210a 100644
--- a/ui/litellm-dashboard/src/components/team/team_info.tsx
+++ b/ui/litellm-dashboard/src/components/team/team_info.tsx
@@ -184,7 +184,7 @@ const TeamInfoView: React.FC = ({
max_budget: values.max_budget,
budget_duration: values.budget_duration,
metadata: {
- ...teamData?.team_info?.metadata,
+ ...values.metadata,
guardrails: values.guardrails || []
}
};