From f487f4e3a9cd3cd2374adb4e51140ae126e1382a Mon Sep 17 00:00:00 2001 From: YutaSaito <36355491+uc4w6c@users.noreply.github.com> Date: Sat, 15 Nov 2025 11:14:43 +0900 Subject: [PATCH 01/52] feat: add dynamic OAuth2 metadata discovery for MCP servers (#16676) * feat: add dynamic OAuth2 metadata discovery for MCP servers * fix: lint error --- docs/my-website/docs/mcp.md | 20 +- .../docs/tutorials/claude_responses_api.md | 6 - .../mcp_server/mcp_server_manager.py | 299 +++++++++++++++++- litellm/proxy/proxy_server.py | 6 +- .../types/mcp_server/mcp_server_manager.py | 5 + tests/mcp_tests/test_mcp_auth_priority.py | 4 +- tests/mcp_tests/test_mcp_logging.py | 6 +- tests/mcp_tests/test_mcp_server.py | 57 ++-- .../mcp_server/test_mcp_custom_fields.py | 20 +- .../mcp_server/test_mcp_server_manager.py | 131 +++++++- 10 files changed, 474 insertions(+), 80 deletions(-) diff --git a/docs/my-website/docs/mcp.md b/docs/my-website/docs/mcp.md index c735b8ecdd..9fd803f434 100644 --- a/docs/my-website/docs/mcp.md +++ b/docs/my-website/docs/mcp.md @@ -211,11 +211,12 @@ mcp_servers: oauth2_example: url: "https://my-mcp-server.com/mcp" auth_type: "oauth2" # 👈 KEY CHANGE - authorization_url: "https://my-mcp-server.com/oauth/authorize" # optional for client-credentials - token_url: "https://my-mcp-server.com/oauth/token" # required + authorization_url: "https://my-mcp-server.com/oauth/authorize" # optional override + token_url: "https://my-mcp-server.com/oauth/token" # optional override + registration_url: "https://my-mcp-server.com/oauth/register" # optional override client_id: os.environ/OAUTH_CLIENT_ID client_secret: os.environ/OAUTH_CLIENT_SECRET - scopes: ["tool.read", "tool.write"] # optional + scopes: ["tool.read", "tool.write"] # optional override bearer_example: url: "https://my-mcp-server.com/mcp" @@ -325,6 +326,10 @@ mcp_servers: | `spec_path` | Yes | Path or URL to your OpenAPI specification file (JSON or YAML) | | `auth_type` | No | Authentication type: `none`, `api_key`, `bearer_token`, `basic`, `authorization` | | `auth_value` | No | Authentication value (required if `auth_type` is set) | +| `authorization_url` | No | For `auth_type: oauth2`. Optional override; if omitted LiteLLM auto-discovers it. | +| `token_url` | No | For `auth_type: oauth2`. Optional override; if omitted LiteLLM auto-discovers it. | +| `registration_url` | No | For `auth_type: oauth2`. Optional override; if omitted LiteLLM auto-discovers it. | +| `scopes` | No | For `auth_type: oauth2`. Optional override; if omitted LiteLLM uses the scopes advertised by the server. | | `description` | No | Optional description for the MCP server | | `allowed_tools` | No | List of specific tools to allow (see [MCP Tool Filtering](#mcp-tool-filtering)) | | `disallowed_tools` | No | List of specific tools to block (see [MCP Tool Filtering](#mcp-tool-filtering)) | @@ -1224,17 +1229,10 @@ mcp_servers: github_mcp: url: "https://api.githubcopilot.com/mcp" auth_type: oauth2 - authorization_url: https://github.com/login/oauth/authorize - token_url: https://github.com/login/oauth/access_token client_id: os.environ/GITHUB_OAUTH_CLIENT_ID client_secret: os.environ/GITHUB_OAUTH_CLIENT_SECRET - scopes: ["public_repo", "user:email"] ``` -**Note** -In the future, users will only need to specify the `url` of the MCP server. -LiteLLM will automatically resolve the corresponding `authorization_url`, `token_url`, and `registration_url` based on the MCP server metadata (e.g., `.well-known/oauth-authorization-server` or `oauth-protected-resource`). - [**See Claude Code Tutorial**](./tutorials/claude_responses_api#connecting-mcp-servers) ## Using your MCP with client side credentials @@ -1887,4 +1885,4 @@ async with stdio_client(server_params) as (read, write): ``` - \ No newline at end of file + diff --git a/docs/my-website/docs/tutorials/claude_responses_api.md b/docs/my-website/docs/tutorials/claude_responses_api.md index 343f938b67..0dbb4a2f1e 100644 --- a/docs/my-website/docs/tutorials/claude_responses_api.md +++ b/docs/my-website/docs/tutorials/claude_responses_api.md @@ -237,11 +237,8 @@ mcp_servers: github_mcp: url: "https://api.githubcopilot.com/mcp" auth_type: oauth2 - authorization_url: https://github.com/login/oauth/authorize - token_url: https://github.com/login/oauth/access_token client_id: os.environ/GITHUB_OAUTH_CLIENT_ID client_secret: os.environ/GITHUB_OAUTH_CLIENT_SECRET - scopes: ["public_repo", "user:email"] ``` @@ -255,9 +252,6 @@ atlassian_mcp: url: "https://mcp.atlassian.com/v1/sse" transport: "sse" auth_type: oauth2 - authorization_url: https://mcp.atlassian.com/v1/authorize - token_url: https://cf.mcp.atlassian.com/v1/token - registration_url: https://cf.mcp.atlassian.com/v1/register ``` diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py index aefbbc8d4a..b42364b6db 100644 --- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py +++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py @@ -10,9 +10,13 @@ import asyncio import datetime import hashlib import json -from typing import Any, Dict, List, Optional, Set, Union, cast +import re +from typing import Any, Dict, List, Optional, Set, Tuple, Union, cast +from urllib.parse import urlparse from fastapi import HTTPException +import httpx +from httpx import HTTPStatusError from mcp.types import CallToolRequestParams as MCPCallToolRequestParams from mcp.types import CallToolResult from mcp.types import Tool as MCPTool @@ -43,7 +47,11 @@ from litellm.proxy.common_utils.encrypt_decrypt_utils import ( ) from litellm.proxy.utils import ProxyLogging from litellm.types.mcp import MCPAuth, MCPStdioConfig -from litellm.types.mcp_server.mcp_server_manager import MCPInfo, MCPServer +from litellm.types.mcp_server.mcp_server_manager import ( + MCPInfo, + MCPOAuthMetadata, + MCPServer, +) def _deserialize_json_dict(data: Any) -> Optional[Dict[str, str]]: @@ -100,7 +108,7 @@ class MCPServerManager: """ return self.config_mcp_servers | self.registry - def load_servers_from_config( + async def load_servers_from_config( self, mcp_servers_config: Dict[str, Any], mcp_aliases: Optional[Dict[str, str]] = None, @@ -180,35 +188,57 @@ class MCPServerManager: )() name_for_prefix = get_server_prefix(temp_server) + server_url = server_config.get("url", None) or "" # Generate stable server ID based on parameters server_id = self._generate_stable_server_id( server_name=server_name, - url=server_config.get("url", None) or "", + url=server_url, transport=server_config.get("transport", MCPTransport.http), auth_type=server_config.get("auth_type", None), alias=alias, ) + auth_type = server_config.get("auth_type", None) + if server_url and auth_type is not None and auth_type == MCPAuth.oauth2: + mcp_oauth_metadata = await self._descovery_metadata( + server_url=server_url, + ) + else: + mcp_oauth_metadata = None + + resolved_scopes = server_config.get("scopes") or ( + mcp_oauth_metadata.scopes if mcp_oauth_metadata else None + ) + resolved_authorization_url = server_config.get("authorization_url") or ( + mcp_oauth_metadata.authorization_url if mcp_oauth_metadata else None + ) + resolved_token_url = server_config.get("token_url") or ( + mcp_oauth_metadata.token_url if mcp_oauth_metadata else None + ) + resolved_registration_url = server_config.get("registration_url") or ( + mcp_oauth_metadata.registration_url if mcp_oauth_metadata else None + ) + new_server = MCPServer( server_id=server_id, name=name_for_prefix, alias=alias, server_name=server_name, spec_path=server_config.get("spec_path", None), - url=server_config.get("url", None) or "", + url=server_url, command=server_config.get("command", None) or "", args=server_config.get("args", None) or [], env=server_config.get("env", None) or {}, # oauth specific fields client_id=server_config.get("client_id", None), client_secret=server_config.get("client_secret", None), - scopes=server_config.get("scopes", None), - authorization_url=server_config.get("authorization_url", None), - token_url=server_config.get("token_url", None), - registration_url=server_config.get("registration_url", None), + scopes=resolved_scopes, + authorization_url=resolved_authorization_url, + token_url=resolved_token_url, + registration_url=resolved_registration_url, # TODO: utility fn the default values transport=server_config.get("transport", MCPTransport.http), - auth_type=server_config.get("auth_type", None), + auth_type=auth_type, authentication_token=server_config.get( "authentication_token", server_config.get("auth_value", None) ), @@ -692,6 +722,250 @@ class MCPServerManager: except Exception: pass + async def _descovery_metadata( + self, + server_url: str, + ) -> Optional[MCPOAuthMetadata]: + """Discover OAuth metadata by following RFC 9728 (protected resource metadata discovery).""" + + try: + async with httpx.AsyncClient( + timeout=10.0, follow_redirects=False + ) as client: + response = await client.get(server_url) + response.raise_for_status() + verbose_logger.warning( + "MCP OAuth discovery unexpectedly succeeded for %s; server did not challenge", + server_url, + ) + raise RuntimeError("OAuth discovery must not succeed without a challenge") + except HTTPStatusError as exc: + verbose_logger.debug( + "MCP OAuth discovery for %s received status error: %s", + server_url, + exc, + ) + + header_value: Optional[str] = None + if exc.response is not None: + header_value = exc.response.headers.get( + "WWW-Authenticate" + ) or exc.response.headers.get("www-authenticate") + + resource_metadata_url, scopes = self._parse_www_authenticate_header( + header_value + ) + + authorization_servers: List[str] = [] + resource_scopes: Optional[List[str]] = None + if resource_metadata_url: + ( + authorization_servers, + resource_scopes, + ) = await self._fetch_oauth_metadata_from_resource( + resource_metadata_url + ) + else: + ( + authorization_servers, + resource_scopes, + ) = await self._attempt_well_known_discovery(server_url) + + metadata = None + if not authorization_servers: + try: + parsed_url = urlparse(server_url) + if parsed_url.scheme and parsed_url.netloc: + authorization_servers = [ + f"{parsed_url.scheme}://{parsed_url.netloc}" + ] + except Exception: + authorization_servers = [] + + if authorization_servers: + metadata = await self._fetch_authorization_server_metadata( + authorization_servers + ) + + preferred_scopes = scopes or resource_scopes + if metadata is None and preferred_scopes: + metadata = MCPOAuthMetadata(scopes=preferred_scopes) + elif metadata is not None and preferred_scopes: + metadata.scopes = preferred_scopes + + return metadata + except Exception as exc: # pragma: no cover - network/transient issues + verbose_logger.debug( + "MCP OAuth discovery failed for %s: %s", server_url, exc + ) + return None + + def _parse_www_authenticate_header( + self, header_value: Optional[str] + ) -> Tuple[Optional[str], Optional[List[str]]]: + if not header_value: + return None, None + + _, _, params_section = header_value.partition(" ") + params_section = params_section or header_value + + param_pattern = re.compile(r"([a-zA-Z0-9_]+)\s*=\s*\"?([^\",]+)\"?") + params: Dict[str, str] = { + match.group(1).lower(): match.group(2).strip() + for match in param_pattern.finditer(params_section) + } + + resource_metadata_url = params.get("resource_metadata") + + scope_value = params.get("scope") + scopes_list = [s for s in (scope_value.split() if scope_value else []) if s] + scopes = scopes_list or None + + return resource_metadata_url, scopes + + async def _fetch_oauth_metadata_from_resource( + self, resource_metadata_url: str + ) -> Tuple[List[str], Optional[List[str]]]: + if not resource_metadata_url: + return [], None + + try: + async with httpx.AsyncClient(timeout=10.0, follow_redirects=True) as client: + response = await client.get(resource_metadata_url) + response.raise_for_status() + data = response.json() + except Exception as exc: # pragma: no cover - network issues + verbose_logger.debug( + "Failed to fetch MCP OAuth metadata from %s: %s", + resource_metadata_url, + exc, + ) + return [], None + + raw_servers = data.get("authorization_servers") + if isinstance(raw_servers, list): + authorization_servers = [ + entry + for entry in raw_servers + if isinstance(entry, str) and entry.strip() != "" + ] + else: + authorization_servers = [] + + scopes = self._extract_scopes( + data.get("scopes_supported") or data.get("scopes") + ) + + return authorization_servers, scopes + + async def _attempt_well_known_discovery( + self, server_url: str + ) -> Tuple[List[str], Optional[List[str]]]: + try: + parsed = urlparse(server_url) + except Exception: + return [], None + + if not parsed.scheme or not parsed.netloc: + return [], None + + base = f"{parsed.scheme}://{parsed.netloc}" + path = parsed.path or "" + path = path.strip("/") + + candidate_urls: List[str] = [] + if path: + candidate_urls.append(f"{base}/.well-known/oauth-protected-resource/{path}") + candidate_urls.append(f"{base}/.well-known/oauth-protected-resource") + + for url in candidate_urls: + ( + authorization_servers, + scopes, + ) = await self._fetch_oauth_metadata_from_resource(url) + if authorization_servers: + return authorization_servers, scopes + + return [], None + + async def _fetch_authorization_server_metadata( + self, authorization_servers: List[str] + ) -> Optional[MCPOAuthMetadata]: + for issuer in authorization_servers: + metadata = await self._fetch_single_authorization_server_metadata(issuer) + if metadata is not None: + return metadata + return None + + async def _fetch_single_authorization_server_metadata( + self, issuer_url: str + ) -> Optional[MCPOAuthMetadata]: + try: + parsed = urlparse(issuer_url) + except Exception: + return None + + if not parsed.scheme or not parsed.netloc: + return None + + base = f"{parsed.scheme}://{parsed.netloc}" + path = (parsed.path or "").strip("/") + + candidate_urls: List[str] = [] + if path: + candidate_urls.append( + f"{base}/.well-known/oauth-authorization-server/{path}" + ) + candidate_urls.append(f"{base}/.well-known/openid-configuration/{path}") + candidate_urls.append(f"{base}/.well-known/oauth-authorization-server") + candidate_urls.append(f"{base}/.well-known/openid-configuration") + candidate_urls.append(issuer_url.rstrip("/")) + + for url in candidate_urls: + try: + async with httpx.AsyncClient( + timeout=10.0, follow_redirects=True + ) as client: + response = await client.get(url) + response.raise_for_status() + data = response.json() + except Exception as exc: # pragma: no cover - network issues + verbose_logger.debug( + "Failed to fetch authorization metadata from %s: %s", + url, + exc, + ) + continue + + scopes = self._extract_scopes(data.get("scopes_supported")) + metadata = MCPOAuthMetadata( + scopes=scopes, + authorization_url=data.get("authorization_endpoint"), + token_url=data.get("token_endpoint"), + registration_url=data.get("registration_endpoint"), + ) + + if any( + [ + metadata.scopes, + metadata.authorization_url, + metadata.token_url, + metadata.registration_url, + ] + ): + return metadata + + return None + + def _extract_scopes(self, scopes_value: Any) -> Optional[List[str]]: + if isinstance(scopes_value, str): + scopes = [s.strip() for s in scopes_value.split() if s.strip()] + return scopes or None + if isinstance(scopes_value, list): + scopes = [s for s in scopes_value if isinstance(s, str) and s.strip()] + return scopes or None + return None + async def _fetch_tools_with_timeout( self, client: MCPClient, server_name: str ) -> List[MCPTool]: @@ -721,11 +995,6 @@ class MCPServerManager: f"Client operation failed for {server_name}: {str(e)}" ) return [] - finally: - try: - await client.disconnect() - except Exception: - pass try: return await asyncio.wait_for(_list_tools_task(), timeout=30.0) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index f81bcd14d5..06964d1cf8 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -2572,11 +2572,11 @@ class ProxyConfig: litellm.credential_list = credential_list_dict ## NON-LLM CONFIGS eg. MCP tools, vector stores, etc. - self._init_non_llm_configs(config=config) + await self._init_non_llm_configs(config=config) return router, router.get_model_list(), general_settings - def _init_non_llm_configs(self, config: dict): + async def _init_non_llm_configs(self, config: dict): """ Initialize non-LLM configs eg. MCP tools, vector stores, etc. """ @@ -2595,7 +2595,7 @@ class ProxyConfig: litellm_settings = config.get("litellm_settings", {}) mcp_aliases = litellm_settings.get("mcp_aliases", None) - global_mcp_server_manager.load_servers_from_config( + await global_mcp_server_manager.load_servers_from_config( mcp_servers_config, mcp_aliases ) diff --git a/litellm/types/mcp_server/mcp_server_manager.py b/litellm/types/mcp_server/mcp_server_manager.py index bba28b26ae..869037546c 100644 --- a/litellm/types/mcp_server/mcp_server_manager.py +++ b/litellm/types/mcp_server/mcp_server_manager.py @@ -7,6 +7,11 @@ from litellm.proxy._types import MCPAuthType, MCPTransportType # MCPInfo now allows arbitrary additional fields for custom metadata MCPInfo = Dict[str, Any] +class MCPOAuthMetadata(BaseModel): + scopes: Optional[List[str]] = None + authorization_url: Optional[str] = None + token_url: Optional[str] = None + registration_url: Optional[str] = None class MCPServer(BaseModel): server_id: str diff --git a/tests/mcp_tests/test_mcp_auth_priority.py b/tests/mcp_tests/test_mcp_auth_priority.py index 1f120b4669..bc217a7903 100644 --- a/tests/mcp_tests/test_mcp_auth_priority.py +++ b/tests/mcp_tests/test_mcp_auth_priority.py @@ -43,7 +43,7 @@ def test_mcp_server_works_without_config_auth_value(): @pytest.mark.parametrize("token_key", ["authentication_token", "auth_value"]) -def test_mcp_server_config_auth_value_header_used(token_key): +async def test_mcp_server_config_auth_value_header_used(token_key): """Ensure auth header is sent when auth token configured in config""" config = { "test_server": { @@ -55,7 +55,7 @@ def test_mcp_server_config_auth_value_header_used(token_key): } manager = MCPServerManager() - manager.load_servers_from_config(config) + await manager.load_servers_from_config(config) server = next(iter(manager.config_mcp_servers.values())) client = manager._create_mcp_client(server) diff --git a/tests/mcp_tests/test_mcp_logging.py b/tests/mcp_tests/test_mcp_logging.py index 7049a77345..6ee52364cc 100644 --- a/tests/mcp_tests/test_mcp_logging.py +++ b/tests/mcp_tests/test_mcp_logging.py @@ -66,7 +66,7 @@ async def test_mcp_cost_tracking(): with patch('litellm.proxy._experimental.mcp_server.mcp_server_manager.MCPClient', mock_client_constructor): # Load the server config - local_mcp_server_manager.load_servers_from_config( + await local_mcp_server_manager.load_servers_from_config( mcp_servers_config={ "zapier_gmail_server": { "url": os.getenv("ZAPIER_MCP_HTTPS_SERVER_URL"), @@ -166,7 +166,7 @@ async def test_mcp_cost_tracking_per_tool(): with patch('litellm.proxy._experimental.mcp_server.mcp_server_manager.MCPClient', mock_client_constructor): # Load the server config with per-tool costs - local_mcp_server_manager.load_servers_from_config( + await local_mcp_server_manager.load_servers_from_config( mcp_servers_config={ "test_server": { "url": os.getenv("ZAPIER_MCP_HTTPS_SERVER_URL"), @@ -310,7 +310,7 @@ async def test_mcp_tool_call_hook(): with patch('litellm.proxy._experimental.mcp_server.mcp_server_manager.MCPClient', mock_client_constructor): # Load the server config - local_mcp_server_manager.load_servers_from_config( + await local_mcp_server_manager.load_servers_from_config( mcp_servers_config={ "zapier_gmail_server": { "url": os.getenv("ZAPIER_MCP_HTTPS_SERVER_URL"), diff --git a/tests/mcp_tests/test_mcp_server.py b/tests/mcp_tests/test_mcp_server.py index 8391e8f77e..953dc373ab 100644 --- a/tests/mcp_tests/test_mcp_server.py +++ b/tests/mcp_tests/test_mcp_server.py @@ -24,7 +24,7 @@ mcp_server_manager = MCPServerManager() @pytest.mark.asyncio @pytest.mark.skip(reason="Local only test") async def test_mcp_server_manager(): - mcp_server_manager.load_servers_from_config( + await mcp_server_manager.load_servers_from_config( { "zapier_mcp_server": { "url": os.environ.get("ZAPIER_MCP_SERVER_URL"), @@ -79,7 +79,7 @@ async def test_mcp_server_manager_https_server(): "litellm.proxy._experimental.mcp_server.mcp_server_manager.MCPClient", mock_client_constructor, ): - mcp_server_manager.load_servers_from_config( + await mcp_server_manager.load_servers_from_config( { "zapier_mcp_server": { "url": "https://test-mcp-server.com/mcp", @@ -189,7 +189,7 @@ async def test_mcp_http_transport_list_tools_mock(): mock_client_constructor, ): # Load server config with HTTP transport - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "test_http_server": { "url": "https://test-mcp-server.com/mcp", @@ -266,7 +266,7 @@ async def test_mcp_http_transport_call_tool_mock(): mock_client_constructor, ): # Load server config with HTTP transport - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "test_http_server": { "url": "https://test-mcp-server.com/mcp", @@ -333,7 +333,7 @@ async def test_mcp_http_transport_call_tool_error_mock(): mock_client_constructor, ): # Load server config with HTTP transport - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "test_http_server": { "url": "https://test-mcp-server.com/mcp", @@ -376,7 +376,7 @@ async def test_mcp_http_transport_tool_not_found(): test_manager = MCPServerManager() # Load server config - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "test_http_server": { "url": "https://test-mcp-server.com/mcp", @@ -699,7 +699,7 @@ async def test_list_tools_rest_api_success(): mock_client_constructor, ): # Load server config into global manager - global_mcp_server_manager.load_servers_from_config( + await global_mcp_server_manager.load_servers_from_config( { "test_server": { "url": "https://test-server.com/mcp", @@ -878,7 +878,7 @@ async def test_list_tools_only_returns_allowed_servers(monkeypatch): test_manager = MCPServerManager() # Setup two servers in the config - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "server_a": { "url": "https://server-a.com/mcp", @@ -944,12 +944,13 @@ async def test_list_tools_only_returns_allowed_servers(monkeypatch): assert tools[0].name.startswith(f"{expected_prefix}-") -def test_mcp_server_manager_access_groups_from_config(): +@pytest.mark.asyncio +async def test_mcp_server_manager_access_groups_from_config(): """ Test that access_groups are loaded from config and can be resolved. """ test_manager = MCPServerManager() - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "config_server": { "url": "https://config-mcp-server.com/mcp", @@ -986,15 +987,15 @@ def test_mcp_server_manager_access_groups_from_config(): # Should find config_server for group-a, both for group-b, other_server for group-c import asyncio - server_ids_a = asyncio.run( - MCPRequestHandler._get_mcp_servers_from_access_groups(["group-a"]) - ) - server_ids_b = asyncio.run( - MCPRequestHandler._get_mcp_servers_from_access_groups(["group-b"]) - ) - server_ids_c = asyncio.run( - MCPRequestHandler._get_mcp_servers_from_access_groups(["group-c"]) - ) + server_ids_a = await MCPRequestHandler._get_mcp_servers_from_access_groups([ + "group-a" + ]) + server_ids_b = await MCPRequestHandler._get_mcp_servers_from_access_groups([ + "group-b" + ]) + server_ids_c = await MCPRequestHandler._get_mcp_servers_from_access_groups([ + "group-c" + ]) assert any(config_server.server_id == sid for sid in server_ids_a) assert set(server_ids_b) == set( [ @@ -1009,7 +1010,7 @@ def test_mcp_server_manager_access_groups_from_config(): ) -def test_mcp_server_manager_config_integration_with_database(): +async def test_mcp_server_manager_config_integration_with_database(): """ Test that config-based servers properly integrate with database servers, specifically testing access_groups and description fields. @@ -1020,7 +1021,7 @@ def test_mcp_server_manager_config_integration_with_database(): test_manager = MCPServerManager() # Test 1: Load config with access_groups and description - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "config_server_with_groups": { "url": "https://config-server.com/mcp", @@ -1081,10 +1082,8 @@ def test_mcp_server_manager_config_integration_with_database(): # Test the method (this tests our second fix) import asyncio - servers_list = asyncio.run( - test_manager.get_all_mcp_servers_with_health_and_teams( - user_api_key_auth=mock_user_auth - ) + servers_list = await test_manager.get_all_mcp_servers_with_health_and_teams( + user_api_key_auth=mock_user_auth ) # Verify we have the config server properly converted @@ -1536,7 +1535,7 @@ async def test_mcp_protocol_version_passed_to_client(): mock_client_constructor, ): # Load a test server - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "test_server": { "url": "https://test-server.com/mcp", @@ -2423,7 +2422,7 @@ async def test_mcp_server_manager_with_access_groups_integration(): test_manager = MCPServerManager() # Load servers with access groups - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "staff_server": { "url": "https://staff-server.com/mcp", @@ -2470,7 +2469,7 @@ async def test_get_allowed_mcp_servers_returns_registry_for_admin(): ) test_manager = MCPServerManager() - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "alpha_server": { "url": "https://alpha.server/mcp", @@ -2505,7 +2504,7 @@ async def test_get_allowed_mcp_servers_returns_empty_for_non_admin_without_permi ) test_manager = MCPServerManager() - test_manager.load_servers_from_config( + await test_manager.load_servers_from_config( { "alpha_server": { "url": "https://alpha.server/mcp", diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_custom_fields.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_custom_fields.py index d2fa7853e7..51f2861b2d 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_custom_fields.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_custom_fields.py @@ -22,7 +22,7 @@ from litellm.proxy._types import LiteLLM_MCPServerTable class TestMCPCustomFields: """Test custom fields functionality in MCP server configuration.""" - def test_custom_fields_preserved_from_config(self): + async def test_custom_fields_preserved_from_config(self): """Test that custom fields in mcp_info are preserved when loading from config.""" manager = MCPServerManager() @@ -46,7 +46,7 @@ class TestMCPCustomFields: } # Load servers from config - manager.load_servers_from_config(mock_config) + await manager.load_servers_from_config(mock_config) # Get the loaded server servers = list(manager.config_mcp_servers.values()) @@ -109,7 +109,7 @@ class TestMCPCustomFields: assert mcp_info["metadata"] == {"source": "database"} assert mcp_info["version"] == "1.0.0" - def test_empty_mcp_info_handled_gracefully(self): + async def test_empty_mcp_info_handled_gracefully(self): """Test that empty or missing mcp_info is handled gracefully.""" manager = MCPServerManager() @@ -122,7 +122,7 @@ class TestMCPCustomFields: } } - manager.load_servers_from_config(mock_config) + await manager.load_servers_from_config(mock_config) servers = list(manager.config_mcp_servers.values()) assert len(servers) == 1 @@ -133,7 +133,7 @@ class TestMCPCustomFields: # Should have default server_name assert mcp_info["server_name"] == "test_server" - def test_missing_mcp_info_creates_defaults(self): + async def test_missing_mcp_info_creates_defaults(self): """Test that missing mcp_info creates appropriate defaults.""" manager = MCPServerManager() @@ -146,7 +146,7 @@ class TestMCPCustomFields: } } - manager.load_servers_from_config(mock_config) + await manager.load_servers_from_config(mock_config) servers = list(manager.config_mcp_servers.values()) assert len(servers) == 1 @@ -158,7 +158,7 @@ class TestMCPCustomFields: assert mcp_info["server_name"] == "test_server" assert mcp_info["description"] == "Server description" - def test_config_description_fallback(self): + async def test_config_description_fallback(self): """Test that description from config level is used as fallback.""" manager = MCPServerManager() @@ -174,7 +174,7 @@ class TestMCPCustomFields: } } - manager.load_servers_from_config(mock_config) + await manager.load_servers_from_config(mock_config) servers = list(manager.config_mcp_servers.values()) server = servers[0] @@ -184,7 +184,7 @@ class TestMCPCustomFields: assert mcp_info["description"] == "Config level description" assert mcp_info["custom_field"] == "custom_value" - def test_mcp_info_description_takes_precedence(self): + async def test_mcp_info_description_takes_precedence(self): """Test that description in mcp_info takes precedence over config level.""" manager = MCPServerManager() @@ -201,7 +201,7 @@ class TestMCPCustomFields: } } - manager.load_servers_from_config(mock_config) + await manager.load_servers_from_config(mock_config) servers = list(manager.config_mcp_servers.values()) server = servers[0] diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py index f36ae1aec0..d5b3832971 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py @@ -8,12 +8,14 @@ from fastapi import HTTPException # Add the parent directory to the path so we can import litellm sys.path.insert(0, "../../../../../") +import httpx from litellm.proxy._experimental.mcp_server.mcp_server_manager import ( MCPServerManager, _deserialize_json_dict, ) from litellm.proxy._types import LiteLLM_MCPServerTable, MCPTransport -from litellm.types.mcp_server.mcp_server_manager import MCPServer +from litellm.types.mcp import MCPAuth +from litellm.types.mcp_server.mcp_server_manager import MCPServer, MCPOAuthMetadata class TestMCPServerManager: @@ -218,6 +220,133 @@ class TestMCPServerManager: assert len(result) == 1 assert result[0].name == "github_tool_1" + @pytest.mark.asyncio + async def test_fetch_oauth_metadata_from_resource_returns_servers_and_scopes(self): + manager = MCPServerManager() + + mock_response = MagicMock() + mock_response.json.return_value = { + "authorization_servers": [ + "https://auth1.example.com", + "https://auth2.example.com", + ], + "scopes_supported": ["read", "write"], + } + mock_response.raise_for_status = MagicMock() + + mock_client = MagicMock() + mock_client.get = AsyncMock(return_value=mock_response) + + async_client_context = MagicMock() + async_client_context.__aenter__ = AsyncMock(return_value=mock_client) + async_client_context.__aexit__ = AsyncMock(return_value=None) + + with patch( + "litellm.proxy._experimental.mcp_server.mcp_server_manager.httpx.AsyncClient", + return_value=async_client_context, + ): + servers, scopes = await manager._fetch_oauth_metadata_from_resource( + "https://protected.example.com/.well-known/oauth" + ) + + assert servers == [ + "https://auth1.example.com", + "https://auth2.example.com", + ] + assert scopes == ["read", "write"] + + @pytest.mark.asyncio + async def test_descovery_metadata_falls_back_to_origin_when_no_auth_servers(self): + manager = MCPServerManager() + server_url = "https://example.com/public/mcp" + + request = httpx.Request("GET", server_url) + response_obj = httpx.Response( + status_code=401, + request=request, + headers={"WWW-Authenticate": 'Bearer scope="read"'}, + ) + + def raise_http_error(): + raise httpx.HTTPStatusError( + "unauthorized", request=request, response=response_obj + ) + + response_obj.raise_for_status = MagicMock(side_effect=raise_http_error) + + mock_client = MagicMock() + mock_client.get = AsyncMock(return_value=response_obj) + + async_client_context = MagicMock() + async_client_context.__aenter__ = AsyncMock(return_value=mock_client) + async_client_context.__aexit__ = AsyncMock(return_value=None) + + mock_metadata = MCPOAuthMetadata( + scopes=None, + authorization_url="https://example.com/auth", + token_url="https://example.com/token", + registration_url=None, + ) + + with patch( + "litellm.proxy._experimental.mcp_server.mcp_server_manager.httpx.AsyncClient", + return_value=async_client_context, + ), patch.object( + manager, + "_fetch_oauth_metadata_from_resource", + AsyncMock(return_value=([], None)), + ), patch.object( + manager, + "_attempt_well_known_discovery", + AsyncMock(return_value=([], None)), + ), patch.object( + manager, + "_fetch_authorization_server_metadata", + AsyncMock(return_value=mock_metadata), + ) as mock_fetch_auth: + result = await manager._descovery_metadata(server_url) + + mock_fetch_auth.assert_awaited_once_with(["https://example.com"]) + assert result is mock_metadata + assert result.scopes == ["read"] + + @pytest.mark.asyncio + async def test_load_servers_from_config_overrides_discovery_metadata(self): + manager = MCPServerManager() + + discovered_metadata = MCPOAuthMetadata( + scopes=["discovered"], + authorization_url="https://discovered.example.com/auth", + token_url="https://discovered.example.com/token", + registration_url="https://discovered.example.com/register", + ) + + async def fake_discovery(server_url: str): + assert server_url == "https://example.com/mcp" + return discovered_metadata + + manager._descovery_metadata = fake_discovery # type: ignore[attr-defined] + + config = { + "example": { + "url": "https://example.com/mcp", + "transport": MCPTransport.http, + "auth_type": MCPAuth.oauth2, + "scopes": ["config"], + "authorization_url": "https://config.example.com/auth", + } + } + + await manager.load_servers_from_config(config) + + server = next(iter(manager.config_mcp_servers.values())) + assert server.scopes == ["config"] # config overrides discovery + assert server.authorization_url == "https://config.example.com/auth" + assert server.token_url == "https://discovered.example.com/token" + assert ( + server.registration_url == "https://discovered.example.com/register" + ) + @pytest.mark.asyncio async def test_list_tools_handles_missing_server_alias(self): """Test that list_tools handles servers without alias gracefully""" From 65468353d19dd75dbb09277137e2b443d25cc9af Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 14 Nov 2025 18:17:42 -0800 Subject: [PATCH 02/52] provider_specific_fields --- .../langfuse_expected_request_body/completion.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/completion.json b/tests/logging_callback_tests/langfuse_expected_request_body/completion.json index 50f4db61f9..e252e8a128 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/completion.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/completion.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -59,7 +60,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-11-28-54-796360_chatcmpl-521e530f-5e29-4d0a-8d1a-58fca0a847c2", From 8097fafc05f6367b0a34e46a3e25e86f0b353fc6 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Fri, 14 Nov 2025 18:23:30 -0800 Subject: [PATCH 03/52] Agents - support agent registration + discovery (A2A spec) (#16615) * fix: initial commit adding types * refactor: refactor to include agent registry * feat(agents/): endpoints.py working endpoint for agent discovery * feat(agent_endpoints/endpoints.py): add permission management logic to agents endpoint * feat: public endpoint for showing publicly discoverable agents * feat: make /public/agent_hub discoverable * feat(agent_endpoints/endpoints.py): working create agent endpoint adds dynamic agent registration to the proxy * feat: working crud endpoints * feat: working multi-instance create/delete agents * feat(migration.sql): add migration for agents table --- .../20251114182247_agents_table/migration.sql | 20 + .../litellm_proxy_extras/schema.prisma | 15 +- .../index.html} | 0 .../proxy/_experimental/out/guardrails.html | 1 - .../out/{logs.html => logs/index.html} | 0 .../{model-hub.html => model-hub/index.html} | 0 .../index.html} | 0 .../index.html} | 0 .../proxy/_experimental/out/onboarding.html | 1 - .../index.html} | 0 .../out/{teams.html => teams/index.html} | 0 .../{test-key.html => test-key/index.html} | 0 .../out/{usage.html => usage/index.html} | 0 .../out/{users.html => users/index.html} | 0 .../index.html} | 0 litellm/proxy/_new_secret_config.yaml | 21 + litellm/proxy/_types.py | 85 +++-- .../proxy/agent_endpoints/agent_registry.py | 239 ++++++++++++ litellm/proxy/agent_endpoints/endpoints.py | 358 ++++++++++++++++++ litellm/proxy/proxy_server.py | 44 ++- .../public_endpoints/public_endpoints.py | 14 + litellm/proxy/schema.prisma | 13 + litellm/types/agents.py | 186 +++++++++ pyrightconfig.json | 2 +- schema.prisma | 13 + 25 files changed, 962 insertions(+), 50 deletions(-) create mode 100644 litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql rename litellm/proxy/_experimental/out/{api-reference.html => api-reference/index.html} (100%) delete mode 100644 litellm/proxy/_experimental/out/guardrails.html rename litellm/proxy/_experimental/out/{logs.html => logs/index.html} (100%) rename litellm/proxy/_experimental/out/{model-hub.html => model-hub/index.html} (100%) rename litellm/proxy/_experimental/out/{model_hub_table.html => model_hub_table/index.html} (100%) rename litellm/proxy/_experimental/out/{models-and-endpoints.html => models-and-endpoints/index.html} (100%) delete mode 100644 litellm/proxy/_experimental/out/onboarding.html rename litellm/proxy/_experimental/out/{organizations.html => organizations/index.html} (100%) rename litellm/proxy/_experimental/out/{teams.html => teams/index.html} (100%) rename litellm/proxy/_experimental/out/{test-key.html => test-key/index.html} (100%) rename litellm/proxy/_experimental/out/{usage.html => usage/index.html} (100%) rename litellm/proxy/_experimental/out/{users.html => users/index.html} (100%) rename litellm/proxy/_experimental/out/{virtual-keys.html => virtual-keys/index.html} (100%) create mode 100644 litellm/proxy/agent_endpoints/agent_registry.py create mode 100644 litellm/proxy/agent_endpoints/endpoints.py create mode 100644 litellm/types/agents.py diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql new file mode 100644 index 0000000000..ef9c8103b4 --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql @@ -0,0 +1,20 @@ +-- AlterTable +ALTER TABLE "LiteLLM_DailyTagSpend" ADD COLUMN "request_id" TEXT; + +-- CreateTable +CREATE TABLE "LiteLLM_AgentsTable" ( + "agent_id" TEXT NOT NULL, + "agent_name" TEXT NOT NULL, + "litellm_params" JSONB, + "agent_card_params" JSONB NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_by" TEXT NOT NULL, + "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_by" TEXT NOT NULL, + + CONSTRAINT "LiteLLM_AgentsTable_pkey" PRIMARY KEY ("agent_id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "LiteLLM_AgentsTable_agent_name_key" ON "LiteLLM_AgentsTable"("agent_name"); + diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma index 8890456112..d6b7cebbd1 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma +++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma @@ -54,6 +54,19 @@ model LiteLLM_ProxyModelTable { updated_by String } + +// Agents on proxy +model LiteLLM_AgentsTable { + agent_id String @id @default(uuid()) + agent_name String @unique + litellm_params Json? + agent_card_params Json + created_at DateTime @default(now()) @map("created_at") + created_by String + updated_at DateTime @default(now()) @updatedAt @map("updated_at") + updated_by String +} + model LiteLLM_OrganizationTable { organization_id String @id @default(uuid()) organization_alias String @@ -610,4 +623,4 @@ model LiteLLM_CacheConfig { cache_settings Json created_at DateTime @default(now()) updated_at DateTime @updatedAt -} +} \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/api-reference.html b/litellm/proxy/_experimental/out/api-reference/index.html similarity index 100% rename from litellm/proxy/_experimental/out/api-reference.html rename to litellm/proxy/_experimental/out/api-reference/index.html diff --git a/litellm/proxy/_experimental/out/guardrails.html b/litellm/proxy/_experimental/out/guardrails.html deleted file mode 100644 index a5f4b95a37..0000000000 --- a/litellm/proxy/_experimental/out/guardrails.html +++ /dev/null @@ -1 +0,0 @@ -LiteLLM Dashboard \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/logs.html b/litellm/proxy/_experimental/out/logs/index.html similarity index 100% rename from litellm/proxy/_experimental/out/logs.html rename to litellm/proxy/_experimental/out/logs/index.html diff --git a/litellm/proxy/_experimental/out/model-hub.html b/litellm/proxy/_experimental/out/model-hub/index.html similarity index 100% rename from litellm/proxy/_experimental/out/model-hub.html rename to litellm/proxy/_experimental/out/model-hub/index.html diff --git a/litellm/proxy/_experimental/out/model_hub_table.html b/litellm/proxy/_experimental/out/model_hub_table/index.html similarity index 100% rename from litellm/proxy/_experimental/out/model_hub_table.html rename to litellm/proxy/_experimental/out/model_hub_table/index.html diff --git a/litellm/proxy/_experimental/out/models-and-endpoints.html b/litellm/proxy/_experimental/out/models-and-endpoints/index.html similarity index 100% rename from litellm/proxy/_experimental/out/models-and-endpoints.html rename to litellm/proxy/_experimental/out/models-and-endpoints/index.html diff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.html deleted file mode 100644 index 23f711cd6e..0000000000 --- a/litellm/proxy/_experimental/out/onboarding.html +++ /dev/null @@ -1 +0,0 @@ -LiteLLM Dashboard \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/organizations.html b/litellm/proxy/_experimental/out/organizations/index.html similarity index 100% rename from litellm/proxy/_experimental/out/organizations.html rename to litellm/proxy/_experimental/out/organizations/index.html diff --git a/litellm/proxy/_experimental/out/teams.html b/litellm/proxy/_experimental/out/teams/index.html similarity index 100% rename from litellm/proxy/_experimental/out/teams.html rename to litellm/proxy/_experimental/out/teams/index.html diff --git a/litellm/proxy/_experimental/out/test-key.html b/litellm/proxy/_experimental/out/test-key/index.html similarity index 100% rename from litellm/proxy/_experimental/out/test-key.html rename to litellm/proxy/_experimental/out/test-key/index.html diff --git a/litellm/proxy/_experimental/out/usage.html b/litellm/proxy/_experimental/out/usage/index.html similarity index 100% rename from litellm/proxy/_experimental/out/usage.html rename to litellm/proxy/_experimental/out/usage/index.html diff --git a/litellm/proxy/_experimental/out/users.html b/litellm/proxy/_experimental/out/users/index.html similarity index 100% rename from litellm/proxy/_experimental/out/users.html rename to litellm/proxy/_experimental/out/users/index.html diff --git a/litellm/proxy/_experimental/out/virtual-keys.html b/litellm/proxy/_experimental/out/virtual-keys/index.html similarity index 100% rename from litellm/proxy/_experimental/out/virtual-keys.html rename to litellm/proxy/_experimental/out/virtual-keys/index.html diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml index 3a4cf84609..89a5e01b16 100644 --- a/litellm/proxy/_new_secret_config.yaml +++ b/litellm/proxy/_new_secret_config.yaml @@ -11,3 +11,24 @@ model_list: model: openai/gpt-4o-mini-transcribe api_key: os.environ/OPENAI_API_KEY +agent_list: + - agent_name: my_custom_agent + agent_card_params: + protocolVersion: '1.0' + name: 'Hello World Agent' + description: Just a hello world agent + url: http://localhost:9999/ + version: 1.0.0 + defaultInputModes: ['text'] + defaultOutputModes: ['text'] + capabilities: + streaming: true + skills: + - id: 'hello_world' + name: 'Returns hello world' + description: 'just returns hello world' + tags: ['hello world'] + examples: ['hi', 'hello world'] + supportsAuthenticatedExtendedCard: true + litellm_params: + make_public: true \ No newline at end of file diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index a212eab076..35ec1226fd 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -509,6 +509,7 @@ class LiteLLMRoutes(enum.Enum): "/litellm/.well-known/litellm-ui-config", "/.well-known/litellm-ui-config", "/public/model_hub", + "/public/agent_hub", ] ) @@ -781,9 +782,9 @@ class GenerateRequestBase(LiteLLMPydanticObjectBase): allowed_cache_controls: Optional[list] = [] config: Optional[dict] = {} permissions: Optional[dict] = {} - model_max_budget: Optional[ - dict - ] = {} # {"gpt-4": 5.0, "gpt-3.5-turbo": 5.0}, defaults to {} + model_max_budget: Optional[dict] = ( + {} + ) # {"gpt-4": 5.0, "gpt-3.5-turbo": 5.0}, defaults to {} model_config = ConfigDict(protected_namespaces=()) model_rpm_limit: Optional[dict] = None @@ -1237,12 +1238,12 @@ class NewCustomerRequest(BudgetNewRequest): blocked: bool = False # allow/disallow requests for this end-user budget_id: Optional[str] = None # give either a budget_id or max_budget spend: Optional[float] = None - allowed_model_region: Optional[ - AllowedModelRegion - ] = None # require all user requests to use models in this specific region - default_model: Optional[ - str - ] = None # if no equivalent model in allowed region - default all requests to this model + allowed_model_region: Optional[AllowedModelRegion] = ( + None # require all user requests to use models in this specific region + ) + default_model: Optional[str] = ( + None # if no equivalent model in allowed region - default all requests to this model + ) @model_validator(mode="before") @classmethod @@ -1264,12 +1265,12 @@ class UpdateCustomerRequest(LiteLLMPydanticObjectBase): blocked: bool = False # allow/disallow requests for this end-user max_budget: Optional[float] = None budget_id: Optional[str] = None # give either a budget_id or max_budget - allowed_model_region: Optional[ - AllowedModelRegion - ] = None # require all user requests to use models in this specific region - default_model: Optional[ - str - ] = None # if no equivalent model in allowed region - default all requests to this model + allowed_model_region: Optional[AllowedModelRegion] = ( + None # require all user requests to use models in this specific region + ) + default_model: Optional[str] = ( + None # if no equivalent model in allowed region - default all requests to this model + ) class DeleteCustomerRequest(LiteLLMPydanticObjectBase): @@ -1353,15 +1354,15 @@ class NewTeamRequest(TeamBase): ] = None # raise an error if 'guaranteed_throughput' is set and we're overallocating tpm model_tpm_limit: Optional[Dict[str, int]] = None - team_member_budget: Optional[ - float - ] = None # allow user to set a budget for all team members - team_member_rpm_limit: Optional[ - int - ] = None # allow user to set RPM limit for all team members - team_member_tpm_limit: Optional[ - int - ] = None # allow user to set TPM limit for all team members + team_member_budget: Optional[float] = ( + None # allow user to set a budget for all team members + ) + team_member_rpm_limit: Optional[int] = ( + None # allow user to set RPM limit for all team members + ) + team_member_tpm_limit: Optional[int] = ( + None # allow user to set TPM limit for all team members + ) team_member_key_duration: Optional[str] = None # e.g. "1d", "1w", "1m" allowed_vector_store_indexes: Optional[List[AllowedVectorStoreIndexItem]] = None @@ -1445,9 +1446,9 @@ class BlockKeyRequest(LiteLLMPydanticObjectBase): class AddTeamCallback(LiteLLMPydanticObjectBase): callback_name: str - callback_type: Optional[ - Literal["success", "failure", "success_and_failure"] - ] = "success_and_failure" + callback_type: Optional[Literal["success", "failure", "success_and_failure"]] = ( + "success_and_failure" + ) callback_vars: Dict[str, str] @model_validator(mode="before") @@ -1732,9 +1733,9 @@ class ConfigList(LiteLLMPydanticObjectBase): stored_in_db: Optional[bool] field_default_value: Any premium_field: bool = False - nested_fields: Optional[ - List[FieldDetail] - ] = None # For nested dictionary or Pydantic fields + nested_fields: Optional[List[FieldDetail]] = ( + None # For nested dictionary or Pydantic fields + ) class UserHeaderMapping(LiteLLMPydanticObjectBase): @@ -2114,9 +2115,9 @@ class LiteLLM_OrganizationMembershipTable(LiteLLMPydanticObjectBase): budget_id: Optional[str] = None created_at: datetime updated_at: datetime - user: Optional[ - Any - ] = None # You might want to replace 'Any' with a more specific type if available + user: Optional[Any] = ( + None # You might want to replace 'Any' with a more specific type if available + ) litellm_budget_table: Optional[LiteLLM_BudgetTable] = None model_config = ConfigDict(protected_namespaces=()) @@ -3054,9 +3055,9 @@ class TeamModelDeleteRequest(BaseModel): # Organization Member Requests class OrganizationMemberAddRequest(OrgMemberAddRequest): organization_id: str - max_budget_in_organization: Optional[ - float - ] = None # Users max budget within the organization + max_budget_in_organization: Optional[float] = ( + None # Users max budget within the organization + ) class OrganizationMemberDeleteRequest(MemberDeleteRequest): @@ -3269,9 +3270,9 @@ class ProviderBudgetResponse(LiteLLMPydanticObjectBase): Maps provider names to their budget configs. """ - providers: Dict[ - str, ProviderBudgetResponseObject - ] = {} # Dictionary mapping provider names to their budget configurations + providers: Dict[str, ProviderBudgetResponseObject] = ( + {} + ) # Dictionary mapping provider names to their budget configurations class ProxyStateVariables(TypedDict): @@ -3405,9 +3406,9 @@ class LiteLLM_JWTAuth(LiteLLMPydanticObjectBase): enforce_rbac: bool = False roles_jwt_field: Optional[str] = None # v2 on role mappings role_mappings: Optional[List[RoleMapping]] = None - object_id_jwt_field: Optional[ - str - ] = None # can be either user / team, inferred from the role mapping + object_id_jwt_field: Optional[str] = ( + None # can be either user / team, inferred from the role mapping + ) scope_mappings: Optional[List[ScopeMapping]] = None enforce_scope_based_access: bool = False enforce_team_based_model_access: bool = False diff --git a/litellm/proxy/agent_endpoints/agent_registry.py b/litellm/proxy/agent_endpoints/agent_registry.py new file mode 100644 index 0000000000..345c31e07b --- /dev/null +++ b/litellm/proxy/agent_endpoints/agent_registry.py @@ -0,0 +1,239 @@ +from datetime import datetime, timezone +from typing import Any, Dict, List, Optional + +from litellm.litellm_core_utils.safe_json_dumps import safe_dumps +from litellm.proxy.utils import PrismaClient +from litellm.types.agents import AgentConfig + + +class AgentRegistry: + def __init__(self): + self.agent_list: List[AgentConfig] = [] + + def reset_agent_list(self): + self.agent_list = [] + + def register_agent(self, agent_config: AgentConfig): + self.agent_list.append(agent_config) + + def deregister_agent(self, agent_name: str): + self.agent_list = [ + agent for agent in self.agent_list if agent.get("agent_name") != agent_name + ] + + def get_agent_list(self, agent_names: Optional[List[str]] = None): + if agent_names is not None: + return [ + agent + for agent in self.agent_list + if agent.get("agent_name") in agent_names + ] + return self.agent_list + + def get_public_agent_list(self): + public_agent_list = [] + for agent in self.agent_list: + if agent.get("litellm_params", {}).get("make_public", False) is True: + public_agent_list.append(agent) + return public_agent_list + + def load_agents_from_config(self, agent_config: Optional[List[AgentConfig]] = None): + if agent_config is None: + return None + + for agent_config_item in agent_config: + if not isinstance(agent_config_item, dict): + raise ValueError("agent_config must be a list of dictionaries") + + agent_name = agent_config_item.get("agent_name") + agent_card_params = agent_config_item.get("agent_card_params") + if not all([agent_name, agent_card_params]): + continue + + self.register_agent(agent_config=agent_config_item) + + def load_agents_from_db_and_config( + self, + agent_config: Optional[List[AgentConfig]] = None, + db_agents: Optional[List[Dict[str, Any]]] = None, + ): + self.reset_agent_list() + + if agent_config: + for agent_config_item in agent_config: + if not isinstance(agent_config_item, dict): + raise ValueError("agent_config must be a list of dictionaries") + + self.register_agent(agent_config=agent_config_item) + + if db_agents: + for db_agent in db_agents: + if not isinstance(db_agent, dict): + raise ValueError("db_agents must be a list of dictionaries") + + self.register_agent(agent_config=AgentConfig(**db_agent)) + return self.agent_list + + ########################################################### + ########### DB management helpers for agents ########### + ############################################################ + async def add_agent_to_db( + self, agent: AgentConfig, prisma_client: PrismaClient, created_by: str + ) -> Dict[str, Any]: + """ + Add an agent to the database + """ + try: + agent_name = agent.get("agent_name") + + # Serialize litellm_params + litellm_params_obj: Any = agent.get("litellm_params", {}) + if hasattr(litellm_params_obj, "model_dump"): + litellm_params_dict = litellm_params_obj.model_dump() + else: + litellm_params_dict = ( + dict(litellm_params_obj) if litellm_params_obj else {} + ) + litellm_params: str = safe_dumps(litellm_params_dict) + + # Serialize agent_card_params + agent_card_params_obj: Any = agent.get("agent_card_params", {}) + if hasattr(agent_card_params_obj, "model_dump"): + agent_card_params_dict = agent_card_params_obj.model_dump() + else: + agent_card_params_dict = ( + dict(agent_card_params_obj) if agent_card_params_obj else {} + ) + agent_card_params: str = safe_dumps(agent_card_params_dict) + + # Create agent in DB + created_agent = await prisma_client.db.litellm_agentstable.create( + data={ + "agent_name": agent_name, + "litellm_params": litellm_params, + "agent_card_params": agent_card_params, + "created_by": created_by, + "updated_by": created_by, + "created_at": datetime.now(timezone.utc), + "updated_at": datetime.now(timezone.utc), + } + ) + + return dict(created_agent) + except Exception as e: + raise Exception(f"Error adding agent to DB: {str(e)}") + + async def delete_agent_from_db( + self, agent_id: str, prisma_client: PrismaClient + ) -> Dict[str, Any]: + """ + Delete an agent from the database + """ + try: + deleted_agent = await prisma_client.db.litellm_agentstable.delete( + where={"agent_id": agent_id} + ) + return dict(deleted_agent) + except Exception as e: + raise Exception(f"Error deleting agent from DB: {str(e)}") + + async def update_agent_in_db( + self, + agent_id: str, + agent: AgentConfig, + prisma_client: PrismaClient, + updated_by: str, + ) -> Dict[str, Any]: + """ + Update an agent in the database + """ + try: + agent_name = agent.get("agent_name") + + # Serialize litellm_params + litellm_params_obj: Any = agent.get("litellm_params", {}) + if hasattr(litellm_params_obj, "model_dump"): + litellm_params_dict = litellm_params_obj.model_dump() + else: + litellm_params_dict = ( + dict(litellm_params_obj) if litellm_params_obj else {} + ) + litellm_params: str = safe_dumps(litellm_params_dict) + + # Serialize agent_card_params + agent_card_params_obj: Any = agent.get("agent_card_params", {}) + if hasattr(agent_card_params_obj, "model_dump"): + agent_card_params_dict = agent_card_params_obj.model_dump() + else: + agent_card_params_dict = ( + dict(agent_card_params_obj) if agent_card_params_obj else {} + ) + agent_card_params: str = safe_dumps(agent_card_params_dict) + + # Update agent in DB + updated_agent = await prisma_client.db.litellm_agentstable.update( + where={"agent_id": agent_id}, + data={ + "agent_name": agent_name, + "litellm_params": litellm_params, + "agent_card_params": agent_card_params, + "updated_by": updated_by, + "updated_at": datetime.now(timezone.utc), + }, + ) + + return dict(updated_agent) + except Exception as e: + raise Exception(f"Error updating agent in DB: {str(e)}") + + @staticmethod + async def get_all_agents_from_db( + prisma_client: PrismaClient, + ) -> List[Dict[str, Any]]: + """ + Get all agents from the database + """ + try: + agents_from_db = await prisma_client.db.litellm_agentstable.find_many( + order={"created_at": "desc"}, + ) + + agents: List[Dict[str, Any]] = [] + for agent in agents_from_db: + agents.append(dict(agent)) + + return agents + except Exception as e: + raise Exception(f"Error getting agents from DB: {str(e)}") + + def get_agent_by_id( + self, + agent_id: str, + ) -> Optional[Dict[str, Any]]: + """ + Get an agent by its ID from the database + """ + try: + for agent in self.agent_list: + if agent.get("agent_id") == agent_id: + return dict(agent) + + return None + except Exception as e: + raise Exception(f"Error getting agent from DB: {str(e)}") + + def get_agent_by_name(self, agent_name: str) -> Optional[Dict[str, Any]]: + """ + Get an agent by its name from the database + """ + try: + for agent in self.agent_list: + if agent.get("agent_name") == agent_name: + return dict(agent) + + return None + except Exception as e: + raise Exception(f"Error getting agent from DB: {str(e)}") + + +global_agent_registry = AgentRegistry() diff --git a/litellm/proxy/agent_endpoints/endpoints.py b/litellm/proxy/agent_endpoints/endpoints.py new file mode 100644 index 0000000000..87c3cb44c4 --- /dev/null +++ b/litellm/proxy/agent_endpoints/endpoints.py @@ -0,0 +1,358 @@ +""" +Agent endpoints for registering + discovering agents via LiteLLM. + +Follows the A2A Spec. + +1. Register an agent via POST `/v1/agents` +2. Discover agents via GET `/v1/agents` +3. Get specific agent via GET `/v1/agents/{agent_id}` +""" + +from typing import Any, List + +from fastapi import APIRouter, Depends, HTTPException, Request + +from litellm._logging import verbose_proxy_logger +from litellm.proxy._types import CommonProxyErrors, LitellmUserRoles, UserAPIKeyAuth +from litellm.proxy.auth.user_api_key_auth import user_api_key_auth +from litellm.types.agents import AgentConfig, AgentResponse + +router = APIRouter() + + +@router.get( + "/v1/agents", + tags=["[beta] Agents"], + dependencies=[Depends(user_api_key_auth)], + response_model=List[AgentConfig], +) +async def get_agents( + request: Request, + user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), # Used for auth +): + """ + Example usage: + ``` + curl -X GET "http://localhost:4000/v1/agents" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer your-key" \ + ``` + + Returns: List[AgentConfig] + + """ + from litellm.proxy.agent_endpoints.agent_registry import global_agent_registry + + try: + if ( + user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN + or user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value + ): + return global_agent_registry.get_agent_list() + key_agents = user_api_key_dict.metadata.get("agents") + _team_metadata = user_api_key_dict.team_metadata or {} + team_agents = _team_metadata.get("agents") + if key_agents is not None: + return global_agent_registry.get_agent_list(agent_names=key_agents) + if team_agents is not None: + return global_agent_registry.get_agent_list(agent_names=team_agents) + return [] + except HTTPException: + raise + except Exception as e: + verbose_proxy_logger.exception( + "litellm.proxy.anthropic_endpoints.count_tokens(): Exception occurred - {}".format( + str(e) + ) + ) + raise HTTPException( + status_code=500, detail={"error": f"Internal server error: {str(e)}"} + ) + + +#### CRUD ENDPOINTS FOR AGENTS #### + +from litellm.proxy.agent_endpoints.agent_registry import ( + global_agent_registry as AGENT_REGISTRY, +) + + +@router.post( + "/v1/agents", + tags=["[beta] Agents"], + dependencies=[Depends(user_api_key_auth)], + response_model=AgentResponse, +) +async def create_agent( + request: AgentConfig, + user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), +): + """ + Create a new agent + + Example Request: + ```bash + curl -X POST "http://localhost:4000/agents" \\ + -H "Authorization: Bearer " \\ + -H "Content-Type: application/json" \\ + -d '{ + "agent": { + "agent_name": "my-custom-agent", + "agent_card_params": { + "protocolVersion": "1.0", + "name": "Hello World Agent", + "description": "Just a hello world agent", + "url": "http://localhost:9999/", + "version": "1.0.0", + "defaultInputModes": ["text"], + "defaultOutputModes": ["text"], + "capabilities": { + "streaming": true + }, + "skills": [ + { + "id": "hello_world", + "name": "Returns hello world", + "description": "just returns hello world", + "tags": ["hello world"], + "examples": ["hi", "hello world"] + } + ] + }, + "litellm_params": { + "make_public": true + } + } + }' + ``` + """ + from litellm.proxy.proxy_server import prisma_client + + if prisma_client is None: + raise HTTPException(status_code=500, detail="Prisma client not initialized") + + try: + # Get the user ID from the API key auth + created_by = user_api_key_dict.user_id or "unknown" + + # check for naming conflicts + existing_agent = AGENT_REGISTRY.get_agent_by_name( + agent_name=request.get("agent_name") # type: ignore + ) + if existing_agent is not None: + raise HTTPException( + status_code=400, + detail=f"Agent with name {request.get('agent_name')} already exists", + ) + + result = await AGENT_REGISTRY.add_agent_to_db( + agent=request, prisma_client=prisma_client, created_by=created_by + ) + + agent_name = result.get("agent_name", "Unknown") + agent_id = result.get("agent_id", "Unknown") + + # Also register in memory + try: + AGENT_REGISTRY.register_agent(agent_config=request) + verbose_proxy_logger.info( + f"Successfully registered agent '{agent_name}' (ID: {agent_id}) in memory" + ) + except Exception as reg_error: + verbose_proxy_logger.warning( + f"Failed to register agent '{agent_name}' (ID: {agent_id}) in memory: {reg_error}" + ) + + return AgentResponse(**result) + + except HTTPException: + raise + except Exception as e: + verbose_proxy_logger.exception(f"Error adding agent to db: {e}") + raise HTTPException(status_code=500, detail=str(e)) + + +@router.get( + "/v1/agents/{agent_id}", + tags=["[beta] Agents"], + dependencies=[Depends(user_api_key_auth)], + response_model=AgentResponse, +) +async def get_agent_by_id(agent_id: str): + """ + Get a specific agent by ID + + Example Request: + ```bash + curl -X GET "http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000" \\ + -H "Authorization: Bearer " + ``` + """ + from litellm.proxy.proxy_server import prisma_client + + if prisma_client is None: + raise HTTPException(status_code=500, detail="Prisma client not initialized") + + try: + agent = AGENT_REGISTRY.get_agent_by_id(agent_id=agent_id) + if agent is None: + agent = await prisma_client.db.litellm_agentstable.find_unique( + where={"agent_id": agent_id} + ) + if agent is not None: + agent = dict(agent) + + if agent is None: + raise HTTPException( + status_code=404, detail=f"Agent with ID {agent_id} not found" + ) + + return AgentResponse(**agent) + except HTTPException: + raise + except Exception as e: + verbose_proxy_logger.exception(f"Error getting agent from db: {e}") + raise HTTPException(status_code=500, detail=str(e)) + + +@router.put( + "/v1/agents/{agent_id}", + tags=["[beta] Agents"], + dependencies=[Depends(user_api_key_auth)], + response_model=AgentResponse, +) +async def update_agent( + agent_id: str, + request: AgentConfig, + user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), +): + """ + Update an existing agent + + Example Request: + ```bash + curl -X PUT "http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000" \\ + -H "Authorization: Bearer " \\ + -H "Content-Type: application/json" \\ + -d '{ + "agent": { + "agent_name": "updated-agent", + "agent_card_params": { + "protocolVersion": "1.0", + "name": "Updated Agent", + "description": "Updated description", + "url": "http://localhost:9999/", + "version": "1.1.0", + "defaultInputModes": ["text"], + "defaultOutputModes": ["text"], + "capabilities": { + "streaming": true + }, + "skills": [] + }, + "litellm_params": { + "make_public": false + } + } + }' + ``` + """ + from litellm.proxy.proxy_server import prisma_client + + if prisma_client is None: + raise HTTPException( + status_code=500, detail=CommonProxyErrors.db_not_connected_error.value + ) + + try: + # Check if agent exists + existing_agent = await prisma_client.db.litellm_agentstable.find_unique( + where={"agent_id": agent_id} + ) + if existing_agent is not None: + existing_agent = dict(existing_agent) + + if existing_agent is None: + raise HTTPException( + status_code=404, detail=f"Agent with ID {agent_id} not found" + ) + + # Get the user ID from the API key auth + updated_by = user_api_key_dict.user_id or "unknown" + + result = await AGENT_REGISTRY.update_agent_in_db( + agent_id=agent_id, + agent=request, + prisma_client=prisma_client, + updated_by=updated_by, + ) + + # deregister in memory + AGENT_REGISTRY.deregister_agent(agent_name=existing_agent.get("agent_name")) # type: ignore + # register in memory + AGENT_REGISTRY.register_agent(agent_config=request) + + verbose_proxy_logger.info( + f"Successfully updated agent '{existing_agent.get('agent_name')}' (ID: {agent_id}) in memory" + ) + + return AgentResponse(**result) + except HTTPException: + raise + except Exception as e: + verbose_proxy_logger.exception(f"Error updating agent: {e}") + raise HTTPException(status_code=500, detail=str(e)) + + +@router.delete( + "/v1/agents/{agent_id}", + tags=["Agents"], + dependencies=[Depends(user_api_key_auth)], +) +async def delete_agent(agent_id: str): + """ + Delete an agent + + Example Request: + ```bash + curl -X DELETE "http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000" \\ + -H "Authorization: Bearer " + ``` + + Example Response: + ```json + { + "message": "Agent 123e4567-e89b-12d3-a456-426614174000 deleted successfully" + } + ``` + """ + from litellm.proxy.proxy_server import prisma_client + + if prisma_client is None: + raise HTTPException(status_code=500, detail="Prisma client not initialized") + + try: + # Check if agent exists + existing_agent = await prisma_client.db.litellm_agentstable.find_unique( + where={"agent_id": agent_id} + ) + if existing_agent is not None: + existing_agent = dict[Any, Any](existing_agent) + + if existing_agent is None: + raise HTTPException( + status_code=404, detail=f"Agent with ID {agent_id} not found in DB." + ) + + await AGENT_REGISTRY.delete_agent_from_db( + agent_id=agent_id, prisma_client=prisma_client + ) + + AGENT_REGISTRY.deregister_agent(agent_name=existing_agent.get("agent_name")) # type: ignore + + return {"message": f"Agent {agent_id} deleted successfully"} + except HTTPException: + raise + except Exception as e: + verbose_proxy_logger.exception(f"Error deleting agent: {e}") + raise HTTPException(status_code=500, detail=str(e)) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 06964d1cf8..226b5c1179 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -40,6 +40,7 @@ from litellm.constants import ( LITELLM_SETTINGS_SAFE_DB_OVERRIDES, ) from litellm.litellm_core_utils.safe_json_dumps import safe_dumps +from litellm.proxy.common_utils.callback_utils import normalize_callback_names from litellm.types.utils import ( ModelResponse, ModelResponseStream, @@ -48,8 +49,6 @@ from litellm.types.utils import ( ) from litellm.utils import load_credentials_from_list -from litellm.proxy.common_utils.callback_utils import normalize_callback_names - if TYPE_CHECKING: from aiohttp import ClientSession from opentelemetry.trace import Span as _Span @@ -175,6 +174,8 @@ from litellm.proxy._experimental.mcp_server.tool_registry import ( global_mcp_tool_registry, ) from litellm.proxy._types import * +from litellm.proxy.agent_endpoints.agent_registry import global_agent_registry +from litellm.proxy.agent_endpoints.endpoints import router as agent_endpoints_router from litellm.proxy.analytics_endpoints.analytics_endpoints import ( router as analytics_router, ) @@ -471,6 +472,8 @@ from fastapi.security import OAuth2PasswordBearer from fastapi.security.api_key import APIKeyHeader from fastapi.staticfiles import StaticFiles +from litellm.types.agents import AgentConfig + # import enterprise folder enterprise_router = APIRouter() try: @@ -1061,6 +1064,7 @@ callback_settings: dict = {} log_file = "api_log.json" worker_config = None master_key: Optional[str] = None +config_agents: Optional[List[AgentConfig]] = None otel_logging = False prisma_client: Optional[PrismaClient] = None shared_aiohttp_session: Optional["ClientSession"] = ( @@ -2585,6 +2589,11 @@ class ProxyConfig: if mcp_tools_config: global_mcp_tool_registry.load_tools_from_config(mcp_tools_config) + ## AGENTS + agent_config = config.get("agent_list", None) + if agent_config: + global_agent_registry.load_agents_from_config(agent_config) # type: ignore + mcp_servers_config = config.get("mcp_servers", None) if mcp_servers_config: from litellm.proxy._experimental.mcp_server.mcp_server_manager import ( @@ -2821,7 +2830,9 @@ class ProxyConfig: for k, v in _litellm_params.items(): if isinstance(v, str): # decrypt value - returns original value if decryption fails or no key is set - _value = decrypt_value_helper(value=v, key=k, return_original_value=True) + _value = decrypt_value_helper( + value=v, key=k, return_original_value=True + ) _litellm_params[k] = _value _litellm_params = LiteLLM_Params(**_litellm_params) @@ -3414,6 +3425,9 @@ class ProxyConfig: if self._should_load_db_object(object_type="mcp"): await self._init_mcp_servers_in_db() + if self._should_load_db_object(object_type="agents"): + await self._init_agents_in_db(prisma_client=prisma_client) + if self._should_load_db_object(object_type="pass_through_endpoints"): await self._init_pass_through_endpoints_in_db() @@ -3682,6 +3696,25 @@ class ProxyConfig: ) ) + async def _init_agents_in_db(self, prisma_client: PrismaClient): + from litellm.proxy.agent_endpoints.agent_registry import ( + global_agent_registry as AGENT_REGISTRY, + ) + + try: + db_agents = await AGENT_REGISTRY.get_all_agents_from_db( + prisma_client=prisma_client + ) + AGENT_REGISTRY.load_agents_from_db_and_config( + db_agents=db_agents, agent_config=config_agents + ) + except Exception as e: + verbose_proxy_logger.exception( + "litellm.proxy.proxy_server.py::ProxyConfig:_init_agents_in_db - {}".format( + str(e) + ) + ) + async def _init_search_tools_in_db(self, prisma_client: PrismaClient): """ Initialize search tools from database into the router on startup. @@ -8963,7 +8996,9 @@ async def update_config(config_info: ConfigYAML): # noqa: PLR0915 if isinstance( config["litellm_settings"]["success_callback"], list ) and isinstance(updated_litellm_settings["success_callback"], list): - updated_success_callbacks_normalized = normalize_callback_names(updated_litellm_settings["success_callback"]) + updated_success_callbacks_normalized = normalize_callback_names( + updated_litellm_settings["success_callback"] + ) combined_success_callback = ( config["litellm_settings"]["success_callback"] + updated_success_callbacks_normalized @@ -10097,6 +10132,7 @@ app.include_router(cache_settings_router) app.include_router(user_agent_analytics_router) app.include_router(enterprise_router) app.include_router(ui_discovery_endpoints_router) +app.include_router(agent_endpoints_router) ######################################################## # MCP Server ######################################################## diff --git a/litellm/proxy/public_endpoints/public_endpoints.py b/litellm/proxy/public_endpoints/public_endpoints.py index 8c1e6b74b3..0160021846 100644 --- a/litellm/proxy/public_endpoints/public_endpoints.py +++ b/litellm/proxy/public_endpoints/public_endpoints.py @@ -7,6 +7,7 @@ from litellm.proxy.public_endpoints.provider_create_metadata import ( get_provider_create_metadata, ) from litellm.proxy.auth.user_api_key_auth import user_api_key_auth +from litellm.types.agents import AgentCard from litellm.types.proxy.management_endpoints.model_management_endpoints import ( ModelGroupInfoProxy, ) @@ -45,6 +46,19 @@ async def public_model_hub(): return model_groups +@router.get( + "/public/agent_hub", + tags=["[beta] Agents", "public"], + dependencies=[Depends(user_api_key_auth)], + response_model=List[AgentCard], +) +async def get_agents(): + from litellm.proxy.agent_endpoints.agent_registry import global_agent_registry + + agents = global_agent_registry.get_public_agent_list() + return [agent.get("agent_card_params") for agent in agents] + + @router.get( "/public/model_hub/info", tags=["public", "model management"], diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index 51e6ea9454..d6b7cebbd1 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -54,6 +54,19 @@ model LiteLLM_ProxyModelTable { updated_by String } + +// Agents on proxy +model LiteLLM_AgentsTable { + agent_id String @id @default(uuid()) + agent_name String @unique + litellm_params Json? + agent_card_params Json + created_at DateTime @default(now()) @map("created_at") + created_by String + updated_at DateTime @default(now()) @updatedAt @map("updated_at") + updated_by String +} + model LiteLLM_OrganizationTable { organization_id String @id @default(uuid()) organization_alias String diff --git a/litellm/types/agents.py b/litellm/types/agents.py new file mode 100644 index 0000000000..b9be640fd7 --- /dev/null +++ b/litellm/types/agents.py @@ -0,0 +1,186 @@ +from datetime import datetime +from typing import Any, Dict, List, Literal, Optional, Union + +from pydantic import BaseModel +from typing_extensions import Required, TypedDict + + +# AgentProvider +class AgentProvider(TypedDict, total=False): + """Represents the service provider of an agent.""" + + organization: str # required + url: str # required + + +# AgentExtension +class AgentExtension(TypedDict, total=False): + """A declaration of a protocol extension supported by an Agent.""" + + uri: str # required + description: Optional[str] + required: Optional[bool] + params: Optional[Dict[str, Any]] + + +# AgentCapabilities +class AgentCapabilities(TypedDict, total=False): + """Defines optional capabilities supported by an agent.""" + + streaming: Optional[bool] + pushNotifications: Optional[bool] + stateTransitionHistory: Optional[bool] + extensions: Optional[List[AgentExtension]] + + +# SecurityScheme types +class SecuritySchemeBase(TypedDict, total=False): + """Base properties shared by all security scheme objects.""" + + description: Optional[str] + + +class APIKeySecurityScheme(SecuritySchemeBase): + """Defines a security scheme using an API key.""" + + type: Literal["apiKey"] + in_: Literal["query", "header", "cookie"] # using in_ to avoid Python keyword + name: str + + +class HTTPAuthSecurityScheme(SecuritySchemeBase): + """Defines a security scheme using HTTP authentication.""" + + type: Literal["http"] + scheme: str + bearerFormat: Optional[str] + + +class MutualTLSSecurityScheme(SecuritySchemeBase): + """Defines a security scheme using mTLS authentication.""" + + type: Literal["mutualTLS"] + + +class OAuthFlows(TypedDict, total=False): + """Defines the configuration for the supported OAuth 2.0 flows.""" + + authorizationCode: Optional[Dict[str, Any]] + clientCredentials: Optional[Dict[str, Any]] + implicit: Optional[Dict[str, Any]] + password: Optional[Dict[str, Any]] + + +class OAuth2SecurityScheme(SecuritySchemeBase): + """Defines a security scheme using OAuth 2.0.""" + + type: Literal["oauth2"] + flows: OAuthFlows + oauth2MetadataUrl: Optional[str] + + +class OpenIdConnectSecurityScheme(SecuritySchemeBase): + """Defines a security scheme using OpenID Connect.""" + + type: Literal["openIdConnect"] + openIdConnectUrl: str + + +# Union of all security schemes +SecurityScheme = Union[ + APIKeySecurityScheme, + HTTPAuthSecurityScheme, + OAuth2SecurityScheme, + OpenIdConnectSecurityScheme, + MutualTLSSecurityScheme, +] + + +# AgentSkill +class AgentSkill(TypedDict, total=False): + """Represents a distinct capability or function that an agent can perform.""" + + id: str # required + name: str # required + description: str # required + tags: List[str] # required + examples: Optional[List[str]] + inputModes: Optional[List[str]] + outputModes: Optional[List[str]] + security: Optional[List[Dict[str, List[str]]]] + + +# AgentInterface +class AgentInterface(TypedDict, total=False): + """Declares a combination of a target URL and a transport protocol.""" + + url: str # required + transport: str # required (TransportProtocol | string) + + +# AgentCardSignature +class AgentCardSignature(TypedDict, total=False): + """Represents a JWS signature of an AgentCard.""" + + protected: str # required + signature: str # required + header: Optional[Dict[str, Any]] + + +# AgentCard +class AgentCard(TypedDict, total=False): + """ + The AgentCard is a self-describing manifest for an agent. + It provides essential metadata including the agent's identity, capabilities, + skills, supported communication methods, and security requirements. + """ + + # Required fields + protocolVersion: str + name: str + description: str + url: str + version: str + capabilities: AgentCapabilities + defaultInputModes: List[str] + defaultOutputModes: List[str] + skills: List[AgentSkill] + + # Optional fields + preferredTransport: Optional[str] + additionalInterfaces: Optional[List[AgentInterface]] + iconUrl: Optional[str] + provider: Optional[AgentProvider] + documentationUrl: Optional[str] + securitySchemes: Optional[Dict[str, SecurityScheme]] + security: Optional[List[Dict[str, List[str]]]] + supportsAuthenticatedExtendedCard: Optional[bool] + signatures: Optional[List[AgentCardSignature]] + + +class AgentLitellmParams(TypedDict): + make_public: bool + + +class AgentConfig(TypedDict, total=False): + agent_name: Required[str] + agent_card_params: Required[AgentCard] + litellm_params: AgentLitellmParams + + +# Request/Response models for CRUD endpoints + + +class AgentResponse(BaseModel): + agent_id: str + agent_name: str + litellm_params: Optional[Dict[str, Any]] = None + agent_card_params: Dict[str, Any] + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + created_by: Optional[str] = None + updated_by: Optional[str] = None + + +class ListAgentsResponse(BaseModel): + agents: List[AgentResponse] diff --git a/pyrightconfig.json b/pyrightconfig.json index 9a43abda78..f930e44d30 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -1,6 +1,6 @@ { "ignore": [], - "exclude": ["**/node_modules", "**/__pycache__", "litellm/types/utils.py"], + "exclude": ["**/node_modules", "**/__pycache__", "litellm/types/utils.py", "litellm/proxy/_types.py"], "reportMissingImports": false, "reportPrivateImportUsage": false } diff --git a/schema.prisma b/schema.prisma index 51e6ea9454..d6b7cebbd1 100644 --- a/schema.prisma +++ b/schema.prisma @@ -54,6 +54,19 @@ model LiteLLM_ProxyModelTable { updated_by String } + +// Agents on proxy +model LiteLLM_AgentsTable { + agent_id String @id @default(uuid()) + agent_name String @unique + litellm_params Json? + agent_card_params Json + created_at DateTime @default(now()) @map("created_at") + created_by String + updated_at DateTime @default(now()) @updatedAt @map("updated_at") + updated_by String +} + model LiteLLM_OrganizationTable { organization_id String @id @default(uuid()) organization_alias String From 54e77929339b2a5c3f6fe081e7ee3c1ca12be98e Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 14 Nov 2025 18:24:01 -0800 Subject: [PATCH 04/52] fix: remove dailytag request id migration from agents_table.sql --- .../migrations/20251114182247_agents_table/migration.sql | 3 --- 1 file changed, 3 deletions(-) diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql index ef9c8103b4..28760dcfe4 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql @@ -1,6 +1,3 @@ --- AlterTable -ALTER TABLE "LiteLLM_DailyTagSpend" ADD COLUMN "request_id" TEXT; - -- CreateTable CREATE TABLE "LiteLLM_AgentsTable" ( "agent_id" TEXT NOT NULL, From 9e8653ad3c025d86ec35f88520f7b9c0f4f78714 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 14 Nov 2025 18:25:21 -0800 Subject: [PATCH 05/52] fix prisma client --- tests/proxy_unit_tests/test_key_generate_prisma.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/proxy_unit_tests/test_key_generate_prisma.py b/tests/proxy_unit_tests/test_key_generate_prisma.py index ca8014f76f..95aaef0af2 100644 --- a/tests/proxy_unit_tests/test_key_generate_prisma.py +++ b/tests/proxy_unit_tests/test_key_generate_prisma.py @@ -132,11 +132,6 @@ def prisma_client(): ### add connection pool + pool timeout args params = {"connection_limit": 100, "pool_timeout": 60} database_url = os.getenv("DATABASE_URL") - - # If DATABASE_URL is not set, use a default test database URL - if not database_url: - database_url = "postgresql://postgres:postgres@localhost:5432/circle_test" - modified_url = append_query_params(database_url, params) os.environ["DATABASE_URL"] = modified_url From 09e226b14014b98a7f383c7c9af69f0d46a0f04a Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 14 Nov 2025 18:36:59 -0800 Subject: [PATCH 06/52] [Feature] UI - New Callbacks table (#16512) * New Callbacks table * Change Action Buttons to use Icons * Changed to follow our existing pattern * Removed unused import --- .../LoggingCallbacksTable.test.tsx | 58 +++++++ .../LoggingCallbacksTable.tsx | 151 ++++++++++++++++++ .../LoggingCallbacks/types.ts | 12 ++ .../src/components/settings.tsx | 143 ++++++----------- 4 files changed, 270 insertions(+), 94 deletions(-) create mode 100644 ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.test.tsx create mode 100644 ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.tsx create mode 100644 ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/types.ts diff --git a/ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.test.tsx b/ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.test.tsx new file mode 100644 index 0000000000..a65a22edc8 --- /dev/null +++ b/ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.test.tsx @@ -0,0 +1,58 @@ +import { render } from "@testing-library/react"; +import { describe, expect, it } from "vitest"; +import { LoggingCallbacksTable } from "./LoggingCallbacksTable"; + +describe("LoggingCallbacksTable", () => { + it("should render", () => { + const { getByText } = render(); + expect(getByText("Active Logging Callbacks")).toBeInTheDocument(); + }); + + it('should map "otel" to "OpenTelemetry" on the table', () => { + const { getByText } = render( + , + ); + expect(getByText("OpenTelemetry")).toBeInTheDocument(); + }); + + it("should fallback to original callback name when not in availableCallbacks", () => { + const { getByText } = render( + , + ); + expect(getByText("custom_callback_x")).toBeInTheDocument(); + }); +}); diff --git a/ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.tsx b/ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.tsx new file mode 100644 index 0000000000..d30f0ff92e --- /dev/null +++ b/ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.tsx @@ -0,0 +1,151 @@ +import { PencilAltIcon, PlayIcon, TrashIcon } from "@heroicons/react/outline"; +import { Button, Icon } from "@tremor/react"; +import type { TableProps } from "antd"; +import { Table } from "antd"; +import Title from "antd/es/typography/Title"; +import { PlusCircle } from "lucide-react"; +import React from "react"; +import { AlertingObject } from "./types"; + +type LoggingCallbacksProps = { + callbacks: AlertingObject[]; + availableCallbacks?: Record< + string, + { + litellm_callback_name: string; + litellm_callback_params: string[]; + ui_callback_name: string; + } + >; + onTest?: (callback: AlertingObject) => void | Promise; + onEdit?: (callback: AlertingObject) => void; + onDelete?: (callback: AlertingObject) => void; + onAdd?: () => void; +}; + +type CallbackRow = AlertingObject & { + id?: string; + mode?: "success" | "failure" | "info" | string; +}; + +const CALLBACK_MODES: { value: string; label: string }[] = [ + { value: "success", label: "Success" }, + { value: "failure", label: "Failure" }, + { value: "success_and_failure", label: "Success & Failure" }, +]; + +export const LoggingCallbacksTable: React.FC = ({ + callbacks, + availableCallbacks = {}, + onTest = () => {}, + onEdit = () => {}, + onDelete = () => {}, + onAdd = () => {}, +}) => { + const columns: TableProps["columns"] = [ + { + title: Callback Name, + dataIndex: "name", + key: "name", + render: (_: string, record: CallbackRow) => { + const id = record.name; + console.log("availableCallbacks", availableCallbacks); + const displayName = availableCallbacks[id]?.ui_callback_name || id; + return
{displayName}
; + }, + }, + { + title: Mode, + key: "mode", + render: (_: unknown, record: CallbackRow) => { + const mode = record.mode || "success"; + const label = CALLBACK_MODES.find((m) => m.value === mode)?.label || mode; + const badgeClass = + mode === "success" + ? "bg-green-100 text-green-800" + : mode === "failure" + ? "bg-red-100 text-red-800" + : "bg-blue-100 text-blue-800"; + return ( + + {label} + + ); + }, + width: 240, + }, + { + title: Actions, + key: "actions", + align: "right", + render: (_: unknown, record: CallbackRow) => ( +
+ + onTest(record)} + /> + + + + onEdit(record)} + /> + + + onDelete(record)} + /> + +
+ ), + width: 240, + }, + ]; + return ( + <> +
+ +
+ Active Logging Callbacks +
+ {/* Empty state */} + {callbacks.length === 0 ? ( +
+
+

No callbacks configured

+

Add your first callback to start logging data to external services.

+ +
+
/* Callbacks list */ + ) : ( +
+ record.name} + pagination={false} + rowClassName={() => "hover:bg-gray-50"} + /> + + )} + + + ); +}; diff --git a/ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/types.ts b/ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/types.ts new file mode 100644 index 0000000000..2fc180e49f --- /dev/null +++ b/ui/litellm-dashboard/src/components/Settings/LoggingAndAlerts/LoggingCallbacks/types.ts @@ -0,0 +1,12 @@ +export interface AlertingObject { + name: string; + variables: AlertingVariables; +} + +export interface AlertingVariables { + SLACK_WEBHOOK_URL: string | null; + LANGFUSE_PUBLIC_KEY: string | null; + LANGFUSE_SECRET_KEY: string | null; + LANGFUSE_HOST: string | null; + OPENMETER_API_KEY: string | null; +} diff --git a/ui/litellm-dashboard/src/components/settings.tsx b/ui/litellm-dashboard/src/components/settings.tsx index 823ef18951..907ef412c5 100644 --- a/ui/litellm-dashboard/src/components/settings.tsx +++ b/ui/litellm-dashboard/src/components/settings.tsx @@ -1,38 +1,37 @@ -import React, { useState, useEffect } from "react"; import { - Card, - Table, - TableHead, - TableRow, - TableHeaderCell, - TableCell, - TableBody, - Text, - Grid, Button, - TextInput, + Card, + Grid, + SelectItem, Switch, + Tab, + TabGroup, + Table, + TableBody, + TableCell, + TableHead, + TableHeaderCell, + TableRow, + TabList, TabPanel, TabPanels, - TabGroup, - TabList, - Tab, - SelectItem, - Icon, + Text, + TextInput, } from "@tremor/react"; +import React, { useEffect, useState } from "react"; -import { PencilAltIcon, TrashIcon } from "@heroicons/react/outline"; - -import { Modal, Typography, Form, Input, Select, Button as Button2 } from "antd"; -import NotificationsManager from "./molecules/notifications_manager"; +import { Button as Button2, Form, Input, Modal, Select, Typography } from "antd"; import EmailSettings from "./email_settings"; +import NotificationsManager from "./molecules/notifications_manager"; const { Title, Paragraph } = Typography; -import { getCallbacksCall, setCallbacksCall, serviceHealthCheck, deleteCallback } from "./networking"; -import AlertingSettings from "./alerting/alerting_settings"; import FormItem from "antd/es/form/FormItem"; +import AlertingSettings from "./alerting/alerting_settings"; import { CALLBACK_CONFIGS, getCallbackById } from "./callback_info_helpers"; +import { deleteCallback, getCallbacksCall, serviceHealthCheck, setCallbacksCall } from "./networking"; +import { LoggingCallbacksTable } from "./Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable"; +import { AlertingObject } from "./Settings/LoggingAndAlerts/LoggingCallbacks/types"; import { parseErrorMessage } from "./shared/errorUtils"; interface SettingsPageProps { accessToken: string | null; @@ -47,19 +46,6 @@ interface genericCallbackParams { litellm_callback_params: string[] | null; // known required params for this callback } -interface AlertingVariables { - SLACK_WEBHOOK_URL: string | null; - LANGFUSE_PUBLIC_KEY: string | null; - LANGFUSE_SECRET_KEY: string | null; - LANGFUSE_HOST: string | null; - OPENMETER_API_KEY: string | null; -} - -interface AlertingObject { - name: string; - variables: AlertingVariables; -} - const Settings: React.FC = ({ accessToken, userRole, userID, premiumUser }) => { const [callbacks, setCallbacks] = useState([]); const [alerts, setAlerts] = useState([]); @@ -72,7 +58,16 @@ const Settings: React.FC = ({ accessToken, userRole, userID, const [activeAlerts, setActiveAlerts] = useState([]); const [showAddCallbacksModal, setShowAddCallbacksModal] = useState(false); - const [allCallbacks, setAllCallbacks] = useState([]); + const [allCallbacks, setAllCallbacks] = useState< + Record< + string, + { + litellm_callback_name: string; + litellm_callback_params: string[]; + ui_callback_name: string; + } + > + >({}); const [selectedCallbackParams, setSelectedCallbackParams] = useState([]); @@ -410,64 +405,24 @@ const Settings: React.FC = ({ accessToken, userRole, userID, - Active Logging Callbacks - - - -
- - - Callback Name - {/* Callback Env Vars */} - - - - {callbacks.map((callback, index) => ( - - - {callback.name} - - - - { - setSelectedEditCallback(callback); - setShowEditCallback(true); - }} - /> - handleDeleteCallback(callback.name)} - className="text-red-500 hover:text-red-700 cursor-pointer" - /> - - - - - ))} - -
- - - + setShowAddCallbacksModal(true)} + onEdit={(cb) => { + setSelectedEditCallback(cb); + setShowEditCallback(true); + }} + onDelete={(cb) => handleDeleteCallback(cb.name)} + onTest={async (cb) => { + try { + await serviceHealthCheck(accessToken, cb.name); + NotificationsManager.success("Health check triggered"); + } catch (error) { + NotificationsManager.fromBackend(parseErrorMessage(error)); + } + }} + /> From a1286fb60918dd585fd55ba1a8986bd05bc5752f Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 14 Nov 2025 18:34:53 -0800 Subject: [PATCH 07/52] security fix --- docs/my-website/.trivyignore | 7 +++++++ docs/my-website/package.json | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 docs/my-website/.trivyignore diff --git a/docs/my-website/.trivyignore b/docs/my-website/.trivyignore new file mode 100644 index 0000000000..977504f267 --- /dev/null +++ b/docs/my-website/.trivyignore @@ -0,0 +1,7 @@ +# js-yaml CVE-2025-64718 +# This vulnerability is not applicable because we've forced js-yaml to version 4.1.1 +# via npm overrides in package.json. Trivy incorrectly reports this based on +# dependency requirements in the lockfile, but the actual installed version is 4.1.1. +# Verified with: npm list js-yaml +CVE-2025-64718 + diff --git a/docs/my-website/package.json b/docs/my-website/package.json index d73633817b..d86ef0ebb3 100644 --- a/docs/my-website/package.json +++ b/docs/my-website/package.json @@ -45,7 +45,8 @@ ] }, "engines": { - "node": ">=16.14" + "node": ">=16.14", + "npm": ">=8.3.0" }, "overrides": { "webpack-dev-server": ">=5.2.1", From efb80ffab7919c6444b513af0d654bc11ab3cfee Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 14 Nov 2025 18:43:36 -0800 Subject: [PATCH 08/52] fix pkg lock --- docs/my-website/package-lock.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/my-website/package-lock.json b/docs/my-website/package-lock.json index cc20e0d830..2943097e1b 100644 --- a/docs/my-website/package-lock.json +++ b/docs/my-website/package-lock.json @@ -27,7 +27,8 @@ "dotenv": "^16.4.5" }, "engines": { - "node": ">=16.14" + "node": ">=16.14", + "npm": ">=8.3.0" } }, "node_modules/@algolia/autocomplete-core": { From a69011883ac36228163ef35ae85b5670e9bb61c9 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 14 Nov 2025 18:48:20 -0800 Subject: [PATCH 09/52] fix logging_testing --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0ebf912703..30e90ca985 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1447,7 +1447,7 @@ jobs: command: | pwd ls - python -m pytest -vv tests/logging_callback_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5 + python -m pytest -vv tests/logging_callback_tests --cov=litellm --cov-report=xml -s -v --junitxml=test-results/junit.xml --durations=5 no_output_timeout: 120m - run: name: Rename the coverage files From 11cf22e7b8e6ddf830f074734c77e505f6e59cd6 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 14 Nov 2025 18:49:35 -0800 Subject: [PATCH 10/52] add "provider_specific_fields": null --- .../completion_with_langfuse_metadata.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_langfuse_metadata.json b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_langfuse_metadata.json index a986a5a8ae..8d5d08894e 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_langfuse_metadata.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_langfuse_metadata.json @@ -20,7 +20,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "sessionId": "test_session_id", "version": "test_trace_version", @@ -75,7 +76,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "parentObservationId": "test_parent_observation_id", From 938ec7c39af1b7987cfd84b0f5bb068e26782310 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 14 Nov 2025 18:54:24 -0800 Subject: [PATCH 11/52] fix: fix linting error --- litellm/proxy/agent_endpoints/agent_registry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/proxy/agent_endpoints/agent_registry.py b/litellm/proxy/agent_endpoints/agent_registry.py index 345c31e07b..f67bb9c617 100644 --- a/litellm/proxy/agent_endpoints/agent_registry.py +++ b/litellm/proxy/agent_endpoints/agent_registry.py @@ -71,7 +71,7 @@ class AgentRegistry: if not isinstance(db_agent, dict): raise ValueError("db_agents must be a list of dictionaries") - self.register_agent(agent_config=AgentConfig(**db_agent)) + self.register_agent(agent_config=AgentConfig(**db_agent)) # type: ignore return self.agent_list ########################################################### From 9ced18b69518c09cb2ceaebf29267309cc0a5544 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 14 Nov 2025 18:56:14 -0800 Subject: [PATCH 12/52] perf: use reusable http client --- .../mcp_server/mcp_server_manager.py | 28 +++++++++---------- litellm/types/llms/custom_http.py | 1 + 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py index b42364b6db..71f1fab13b 100644 --- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py +++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py @@ -14,8 +14,8 @@ import re from typing import Any, Dict, List, Optional, Set, Tuple, Union, cast from urllib.parse import urlparse -from fastapi import HTTPException import httpx +from fastapi import HTTPException from httpx import HTTPStatusError from mcp.types import CallToolRequestParams as MCPCallToolRequestParams from mcp.types import CallToolResult @@ -24,6 +24,7 @@ from mcp.types import Tool as MCPTool from litellm._logging import verbose_logger from litellm.exceptions import BlockedPiiEntityError, GuardrailRaisedException from litellm.experimental_mcp_client.client import MCPClient +from litellm.llms.custom_httpx.http_handler import get_async_httpx_client from litellm.proxy._experimental.mcp_server.auth.user_api_key_auth_mcp import ( MCPRequestHandler, ) @@ -42,10 +43,9 @@ from litellm.proxy._types import ( MCPTransportType, UserAPIKeyAuth, ) -from litellm.proxy.common_utils.encrypt_decrypt_utils import ( - decrypt_value_helper, -) +from litellm.proxy.common_utils.encrypt_decrypt_utils import decrypt_value_helper from litellm.proxy.utils import ProxyLogging +from litellm.types.llms.custom_http import httpxSpecialProvider from litellm.types.mcp import MCPAuth, MCPStdioConfig from litellm.types.mcp_server.mcp_server_manager import ( MCPInfo, @@ -386,12 +386,12 @@ class MCPServerManager: ) # Update tool name to server name mapping (for both prefixed and base names) - self.tool_name_to_mcp_server_name_mapping[ - base_tool_name - ] = server_prefix - self.tool_name_to_mcp_server_name_mapping[ - prefixed_tool_name - ] = server_prefix + self.tool_name_to_mcp_server_name_mapping[base_tool_name] = ( + server_prefix + ) + self.tool_name_to_mcp_server_name_mapping[prefixed_tool_name] = ( + server_prefix + ) registered_count += 1 verbose_logger.debug( @@ -729,11 +729,9 @@ class MCPServerManager: """Discover OAuth metadata by following RFC 9728 (protected resource metadata discovery).""" try: - async with httpx.AsyncClient( - timeout=10.0, follow_redirects=False - ) as client: - response = await client.get(server_url) - response.raise_for_status() + client = get_async_httpx_client(llm_provider=httpxSpecialProvider.MCP) + response = await client.get(server_url) + response.raise_for_status() verbose_logger.warning( "MCP OAuth discovery unexpectedly succeeded for %s; server did not challenge", server_url, diff --git a/litellm/types/llms/custom_http.py b/litellm/types/llms/custom_http.py index 6b86f55e02..46956fedc8 100644 --- a/litellm/types/llms/custom_http.py +++ b/litellm/types/llms/custom_http.py @@ -22,6 +22,7 @@ class httpxSpecialProvider(str, Enum): PromptFactory = "prompt_factory" SSO_HANDLER = "sso_handler" Search = "search" + MCP = "mcp" VerifyTypes = Union[str, bool, ssl.SSLContext] From 39c1a970a13e11bf477dea286dafe363bfa5b99b Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 14 Nov 2025 18:56:25 -0800 Subject: [PATCH 13/52] fix --- tests/test_litellm/integrations/test_langfuse.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_litellm/integrations/test_langfuse.py b/tests/test_litellm/integrations/test_langfuse.py index b7a2ed5095..b9009d2005 100644 --- a/tests/test_litellm/integrations/test_langfuse.py +++ b/tests/test_litellm/integrations/test_langfuse.py @@ -1,12 +1,14 @@ -import unittest import asyncio -from unittest.mock import patch, MagicMock -from typing import Optional -import sys -import os import datetime import json +import os +import sys +import unittest +from typing import Optional +from unittest.mock import MagicMock, patch + import pytest + import litellm from litellm.integrations.langfuse import langfuse as langfuse_module from litellm.integrations.langfuse.langfuse import LangFuseLogger @@ -255,6 +257,7 @@ class TestLangfuseUsageDetails(unittest.TestCase): with patch( "litellm.integrations.langfuse.langfuse._add_prompt_to_generation_params", side_effect=lambda generation_params, **kwargs: generation_params, + create=True, ) as mock_add_prompt_params: # Create a mock response object with usage information containing None values response_obj = MagicMock() From acad73018d7079f04af033b29eac4f5ee2b28085 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 14 Nov 2025 18:59:49 -0800 Subject: [PATCH 14/52] fix pkg lock --- ui/litellm-dashboard/.trivyignore | 7 + ui/litellm-dashboard/package-lock.json | 543 ++++++++++++++++++++----- ui/litellm-dashboard/package.json | 9 +- 3 files changed, 461 insertions(+), 98 deletions(-) create mode 100644 ui/litellm-dashboard/.trivyignore diff --git a/ui/litellm-dashboard/.trivyignore b/ui/litellm-dashboard/.trivyignore new file mode 100644 index 0000000000..977504f267 --- /dev/null +++ b/ui/litellm-dashboard/.trivyignore @@ -0,0 +1,7 @@ +# js-yaml CVE-2025-64718 +# This vulnerability is not applicable because we've forced js-yaml to version 4.1.1 +# via npm overrides in package.json. Trivy incorrectly reports this based on +# dependency requirements in the lockfile, but the actual installed version is 4.1.1. +# Verified with: npm list js-yaml +CVE-2025-64718 + diff --git a/ui/litellm-dashboard/package-lock.json b/ui/litellm-dashboard/package-lock.json index 6e21fc2f5f..e76ae17175 100644 --- a/ui/litellm-dashboard/package-lock.json +++ b/ui/litellm-dashboard/package-lock.json @@ -64,8 +64,12 @@ "prettier": "3.2.5", "tailwindcss": "^3.4.1", "typescript": "5.3.3", - "vite": "^7.1.6", + "vite": "^7.1.11", "vitest": "^3.2.4" + }, + "engines": { + "node": ">=18.17.0", + "npm": ">=8.3.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -88,7 +92,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", - "dev": true, "engines": { "node": ">=10" }, @@ -3310,6 +3313,407 @@ "react-dom": "*" } }, + "node_modules/@docusaurus/plugin-content-docs": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.9.2.tgz", + "integrity": "sha512-C5wZsGuKTY8jEYsqdxhhFOe1ZDjH0uIYJ9T/jebHwkyxqnr4wW0jTkB72OMqNjsoQRcb0JN3PcSeTwFlVgzCZg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@docusaurus/core": "3.9.2", + "@docusaurus/logger": "3.9.2", + "@docusaurus/mdx-loader": "3.9.2", + "@docusaurus/module-type-aliases": "3.9.2", + "@docusaurus/theme-common": "3.9.2", + "@docusaurus/types": "3.9.2", + "@docusaurus/utils": "3.9.2", + "@docusaurus/utils-common": "3.9.2", + "@docusaurus/utils-validation": "3.9.2", + "@types/react-router-config": "^5.0.7", + "combine-promises": "^1.1.0", + "fs-extra": "^11.1.1", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "schema-dts": "^1.1.2", + "tslib": "^2.6.0", + "utility-types": "^3.10.0", + "webpack": "^5.88.1" + }, + "engines": { + "node": ">=20.0" + }, + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/babel": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/babel/-/babel-3.9.2.tgz", + "integrity": "sha512-GEANdi/SgER+L7Japs25YiGil/AUDnFFHaCGPBbundxoWtCkA2lmy7/tFmgED4y1htAy6Oi4wkJEQdGssnw9MA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/core": "^7.25.9", + "@babel/generator": "^7.25.9", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.25.9", + "@babel/preset-env": "^7.25.9", + "@babel/preset-react": "^7.25.9", + "@babel/preset-typescript": "^7.25.9", + "@babel/runtime": "^7.25.9", + "@babel/runtime-corejs3": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@docusaurus/logger": "3.9.2", + "@docusaurus/utils": "3.9.2", + "babel-plugin-dynamic-import-node": "^2.3.3", + "fs-extra": "^11.1.1", + "tslib": "^2.6.0" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/bundler": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/bundler/-/bundler-3.9.2.tgz", + "integrity": "sha512-ZOVi6GYgTcsZcUzjblpzk3wH1Fya2VNpd5jtHoCCFcJlMQ1EYXZetfAnRHLcyiFeBABaI1ltTYbOBtH/gahGVA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/core": "^7.25.9", + "@docusaurus/babel": "3.9.2", + "@docusaurus/cssnano-preset": "3.9.2", + "@docusaurus/logger": "3.9.2", + "@docusaurus/types": "3.9.2", + "@docusaurus/utils": "3.9.2", + "babel-loader": "^9.2.1", + "clean-css": "^5.3.3", + "copy-webpack-plugin": "^11.0.0", + "css-loader": "^6.11.0", + "css-minimizer-webpack-plugin": "^5.0.1", + "cssnano": "^6.1.2", + "file-loader": "^6.2.0", + "html-minifier-terser": "^7.2.0", + "mini-css-extract-plugin": "^2.9.2", + "null-loader": "^4.0.1", + "postcss": "^8.5.4", + "postcss-loader": "^7.3.4", + "postcss-preset-env": "^10.2.1", + "terser-webpack-plugin": "^5.3.9", + "tslib": "^2.6.0", + "url-loader": "^4.1.1", + "webpack": "^5.95.0", + "webpackbar": "^6.0.1" + }, + "engines": { + "node": ">=20.0" + }, + "peerDependencies": { + "@docusaurus/faster": "*" + }, + "peerDependenciesMeta": { + "@docusaurus/faster": { + "optional": true + } + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/core": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/core/-/core-3.9.2.tgz", + "integrity": "sha512-HbjwKeC+pHUFBfLMNzuSjqFE/58+rLVKmOU3lxQrpsxLBOGosYco/Q0GduBb0/jEMRiyEqjNT/01rRdOMWq5pw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@docusaurus/babel": "3.9.2", + "@docusaurus/bundler": "3.9.2", + "@docusaurus/logger": "3.9.2", + "@docusaurus/mdx-loader": "3.9.2", + "@docusaurus/utils": "3.9.2", + "@docusaurus/utils-common": "3.9.2", + "@docusaurus/utils-validation": "3.9.2", + "boxen": "^6.2.1", + "chalk": "^4.1.2", + "chokidar": "^3.5.3", + "cli-table3": "^0.6.3", + "combine-promises": "^1.1.0", + "commander": "^5.1.0", + "core-js": "^3.31.1", + "detect-port": "^1.5.1", + "escape-html": "^1.0.3", + "eta": "^2.2.0", + "eval": "^0.1.8", + "execa": "5.1.1", + "fs-extra": "^11.1.1", + "html-tags": "^3.3.1", + "html-webpack-plugin": "^5.6.0", + "leven": "^3.1.0", + "lodash": "^4.17.21", + "open": "^8.4.0", + "p-map": "^4.0.0", + "prompts": "^2.4.2", + "react-helmet-async": "npm:@slorber/react-helmet-async@1.3.0", + "react-loadable": "npm:@docusaurus/react-loadable@6.0.0", + "react-loadable-ssr-addon-v5-slorber": "^1.0.1", + "react-router": "^5.3.4", + "react-router-config": "^5.1.1", + "react-router-dom": "^5.3.4", + "semver": "^7.5.4", + "serve-handler": "^6.1.6", + "tinypool": "^1.0.2", + "tslib": "^2.6.0", + "update-notifier": "^6.0.2", + "webpack": "^5.95.0", + "webpack-bundle-analyzer": "^4.10.2", + "webpack-dev-server": "^5.2.2", + "webpack-merge": "^6.0.1" + }, + "bin": { + "docusaurus": "bin/docusaurus.mjs" + }, + "engines": { + "node": ">=20.0" + }, + "peerDependencies": { + "@mdx-js/react": "^3.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/cssnano-preset": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/cssnano-preset/-/cssnano-preset-3.9.2.tgz", + "integrity": "sha512-8gBKup94aGttRduABsj7bpPFTX7kbwu+xh3K9NMCF5K4bWBqTFYW+REKHF6iBVDHRJ4grZdIPbvkiHd/XNKRMQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "cssnano-preset-advanced": "^6.1.2", + "postcss": "^8.5.4", + "postcss-sort-media-queries": "^5.2.0", + "tslib": "^2.6.0" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/logger": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/logger/-/logger-3.9.2.tgz", + "integrity": "sha512-/SVCc57ByARzGSU60c50rMyQlBuMIJCjcsJlkphxY6B0GV4UH3tcA1994N8fFfbJ9kX3jIBe/xg3XP5qBtGDbA==", + "license": "MIT", + "peer": true, + "dependencies": { + "chalk": "^4.1.2", + "tslib": "^2.6.0" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/mdx-loader": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/mdx-loader/-/mdx-loader-3.9.2.tgz", + "integrity": "sha512-wiYoGwF9gdd6rev62xDU8AAM8JuLI/hlwOtCzMmYcspEkzecKrP8J8X+KpYnTlACBUUtXNJpSoCwFWJhLRevzQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@docusaurus/logger": "3.9.2", + "@docusaurus/utils": "3.9.2", + "@docusaurus/utils-validation": "3.9.2", + "@mdx-js/mdx": "^3.0.0", + "@slorber/remark-comment": "^1.0.0", + "escape-html": "^1.0.3", + "estree-util-value-to-estree": "^3.0.1", + "file-loader": "^6.2.0", + "fs-extra": "^11.1.1", + "image-size": "^2.0.2", + "mdast-util-mdx": "^3.0.0", + "mdast-util-to-string": "^4.0.0", + "rehype-raw": "^7.0.0", + "remark-directive": "^3.0.0", + "remark-emoji": "^4.0.0", + "remark-frontmatter": "^5.0.0", + "remark-gfm": "^4.0.0", + "stringify-object": "^3.3.0", + "tslib": "^2.6.0", + "unified": "^11.0.3", + "unist-util-visit": "^5.0.0", + "url-loader": "^4.1.1", + "vfile": "^6.0.1", + "webpack": "^5.88.1" + }, + "engines": { + "node": ">=20.0" + }, + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/module-type-aliases": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-3.9.2.tgz", + "integrity": "sha512-8qVe2QA9hVLzvnxP46ysuofJUIc/yYQ82tvA/rBTrnpXtCjNSFLxEZfd5U8cYZuJIVlkPxamsIgwd5tGZXfvew==", + "license": "MIT", + "peer": true, + "dependencies": { + "@docusaurus/types": "3.9.2", + "@types/history": "^4.7.11", + "@types/react": "*", + "@types/react-router-config": "*", + "@types/react-router-dom": "*", + "react-helmet-async": "npm:@slorber/react-helmet-async@1.3.0", + "react-loadable": "npm:@docusaurus/react-loadable@6.0.0" + }, + "peerDependencies": { + "react": "*", + "react-dom": "*" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/theme-common": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/theme-common/-/theme-common-3.9.2.tgz", + "integrity": "sha512-6c4DAbR6n6nPbnZhY2V3tzpnKnGL+6aOsLvFL26VRqhlczli9eWG0VDUNoCQEPnGwDMhPS42UhSAnz5pThm5Ag==", + "license": "MIT", + "peer": true, + "dependencies": { + "@docusaurus/mdx-loader": "3.9.2", + "@docusaurus/module-type-aliases": "3.9.2", + "@docusaurus/utils": "3.9.2", + "@docusaurus/utils-common": "3.9.2", + "@types/history": "^4.7.11", + "@types/react": "*", + "@types/react-router-config": "*", + "clsx": "^2.0.0", + "parse-numeric-range": "^1.3.0", + "prism-react-renderer": "^2.3.0", + "tslib": "^2.6.0", + "utility-types": "^3.10.0" + }, + "engines": { + "node": ">=20.0" + }, + "peerDependencies": { + "@docusaurus/plugin-content-docs": "*", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/types": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/types/-/types-3.9.2.tgz", + "integrity": "sha512-Ux1JUNswg+EfUEmajJjyhIohKceitY/yzjRUpu04WXgvVz+fbhVC0p+R0JhvEu4ytw8zIAys2hrdpQPBHRIa8Q==", + "license": "MIT", + "peer": true, + "dependencies": { + "@mdx-js/mdx": "^3.0.0", + "@types/history": "^4.7.11", + "@types/mdast": "^4.0.2", + "@types/react": "*", + "commander": "^5.1.0", + "joi": "^17.9.2", + "react-helmet-async": "npm:@slorber/react-helmet-async@1.3.0", + "utility-types": "^3.10.0", + "webpack": "^5.95.0", + "webpack-merge": "^5.9.0" + }, + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/types/node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "license": "MIT", + "peer": true, + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/utils": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/utils/-/utils-3.9.2.tgz", + "integrity": "sha512-lBSBiRruFurFKXr5Hbsl2thmGweAPmddhF3jb99U4EMDA5L+e5Y1rAkOS07Nvrup7HUMBDrCV45meaxZnt28nQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@docusaurus/logger": "3.9.2", + "@docusaurus/types": "3.9.2", + "@docusaurus/utils-common": "3.9.2", + "escape-string-regexp": "^4.0.0", + "execa": "5.1.1", + "file-loader": "^6.2.0", + "fs-extra": "^11.1.1", + "github-slugger": "^1.5.0", + "globby": "^11.1.0", + "gray-matter": "^4.0.3", + "jiti": "^1.20.0", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "micromatch": "^4.0.5", + "p-queue": "^6.6.2", + "prompts": "^2.4.2", + "resolve-pathname": "^3.0.0", + "tslib": "^2.6.0", + "url-loader": "^4.1.1", + "utility-types": "^3.10.0", + "webpack": "^5.88.1" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/utils-common": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/utils-common/-/utils-common-3.9.2.tgz", + "integrity": "sha512-I53UC1QctruA6SWLvbjbhCpAw7+X7PePoe5pYcwTOEXD/PxeP8LnECAhTHHwWCblyUX5bMi4QLRkxvyZ+IT8Aw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@docusaurus/types": "3.9.2", + "tslib": "^2.6.0" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/@docusaurus/utils-validation": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/@docusaurus/utils-validation/-/utils-validation-3.9.2.tgz", + "integrity": "sha512-l7yk3X5VnNmATbwijJkexdhulNsQaNDwoagiwujXoxFbWLcxHQqNQ+c/IAlzrfMMOfa/8xSBZ7KEKDesE/2J7A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@docusaurus/logger": "3.9.2", + "@docusaurus/utils": "3.9.2", + "@docusaurus/utils-common": "3.9.2", + "fs-extra": "^11.2.0", + "joi": "^17.9.2", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "tslib": "^2.6.0" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@docusaurus/plugin-content-docs/node_modules/commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/@docusaurus/theme-common": { "version": "3.8.1", "resolved": "https://registry.npmjs.org/@docusaurus/theme-common/-/theme-common-3.8.1.tgz", @@ -4138,7 +4542,6 @@ "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", @@ -4155,7 +4558,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, "engines": { "node": ">=12" }, @@ -4167,7 +4569,6 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, "dependencies": { "ansi-regex": "^6.0.1" }, @@ -4413,6 +4814,24 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/@mdx-js/react": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@mdx-js/react/-/react-3.1.1.tgz", + "integrity": "sha512-f++rKLQgUVYDAtECQ6fn/is15GkEH9+nZPM3MS0RcxVqoTfawHvDlSCH7JbMhAM6uJ32v3eXLvLmLvjGu7PTQw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdx": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=16", + "react": ">=16" + } + }, "node_modules/@mermaid-js/parser": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/@mermaid-js/parser/-/parser-0.6.2.tgz", @@ -4606,7 +5025,6 @@ "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, "optional": true, "engines": { "node": ">=14" @@ -7122,8 +7540,7 @@ "node_modules/any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", - "dev": true + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==" }, "node_modules/anymatch": { "version": "3.1.3", @@ -7140,8 +7557,7 @@ "node_modules/arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", - "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", - "dev": true + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" }, "node_modules/argparse": { "version": "2.0.1", @@ -7851,7 +8267,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", - "dev": true, "engines": { "node": ">= 6" } @@ -8230,7 +8645,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", - "dev": true, "engines": { "node": ">= 6" } @@ -9808,8 +10222,7 @@ "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", - "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", - "dev": true + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" }, "node_modules/dir-glob": { "version": "3.0.1", @@ -9825,8 +10238,7 @@ "node_modules/dlv": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", - "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", - "dev": true + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==" }, "node_modules/dns-packet": { "version": "5.6.1", @@ -10738,18 +11150,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/esquery": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", @@ -11382,7 +11782,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dev": true, "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" @@ -11641,7 +12040,6 @@ "version": "10.3.10", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", - "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.3.5", @@ -11679,7 +12077,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -11688,7 +12085,6 @@ "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, "dependencies": { "brace-expansion": "^2.0.1" }, @@ -11842,26 +12238,6 @@ "node": ">=6.0" } }, - "node_modules/gray-matter/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/gray-matter/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/gzip-size": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz", @@ -13395,7 +13771,6 @@ "version": "2.3.6", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", - "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" }, @@ -13479,9 +13854,10 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -13835,7 +14211,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", - "dev": true, "engines": { "node": ">=10" } @@ -14037,7 +14412,6 @@ "version": "10.2.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", - "dev": true, "engines": { "node": "14 || >=16.14" } @@ -15410,7 +15784,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, "license": "ISC", "engines": { "node": ">=16 || 14 >=14.17" @@ -15479,7 +15852,6 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", - "dev": true, "dependencies": { "any-promise": "^1.0.0", "object-assign": "^4.0.1", @@ -15768,7 +16140,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", - "dev": true, "engines": { "node": ">= 6" } @@ -16293,7 +16664,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "lru-cache": "^10.2.0", @@ -16362,7 +16732,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -16371,7 +16740,6 @@ "version": "4.0.6", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", - "dev": true, "engines": { "node": ">= 6" } @@ -17036,7 +17404,6 @@ "version": "15.1.0", "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", - "dev": true, "dependencies": { "postcss-value-parser": "^4.0.0", "read-cache": "^1.0.0", @@ -17053,7 +17420,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.1.tgz", "integrity": "sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==", - "dev": true, "dependencies": { "camelcase-css": "^2.0.1" }, @@ -17100,7 +17466,6 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.2.tgz", "integrity": "sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==", - "dev": true, "funding": [ { "type": "opencollective", @@ -17135,7 +17500,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.0.0.tgz", "integrity": "sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==", - "dev": true, "engines": { "node": ">=14" } @@ -17375,7 +17739,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.1.tgz", "integrity": "sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==", - "dev": true, "dependencies": { "postcss-selector-parser": "^6.0.11" }, @@ -19113,7 +19476,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", - "dev": true, "dependencies": { "pify": "^2.3.0" } @@ -19971,6 +20333,13 @@ "loose-envify": "^1.1.0" } }, + "node_modules/schema-dts": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/schema-dts/-/schema-dts-1.1.5.tgz", + "integrity": "sha512-RJr9EaCmsLzBX2NDiO5Z3ux2BVosNZN5jo0gWgsyKvxKIUL5R3swNvoorulAeL9kLB0iTSX7V6aokhla2m7xbg==", + "license": "Apache-2.0", + "peer": true + }, "node_modules/schema-utils": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.2.tgz", @@ -20423,7 +20792,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, "engines": { "node": ">=14" }, @@ -20564,11 +20932,6 @@ "wbuf": "^1.7.3" } }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" - }, "node_modules/stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", @@ -20631,7 +20994,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -20644,8 +21006,7 @@ "node_modules/string-width-cjs/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/string-width/node_modules/ansi-regex": { "version": "6.0.1", @@ -20779,7 +21140,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -20919,7 +21279,6 @@ "version": "3.35.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==", - "dev": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", @@ -21072,7 +21431,6 @@ "version": "3.4.1", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.1.tgz", "integrity": "sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA==", - "dev": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -21283,7 +21641,6 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", - "dev": true, "dependencies": { "any-promise": "^1.0.0" } @@ -21292,7 +21649,6 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", - "dev": true, "dependencies": { "thenify": ">= 3.1.0 < 4" }, @@ -21552,8 +21908,7 @@ "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", - "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", - "dev": true + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" }, "node_modules/tsconfig-paths": { "version": "3.15.0", @@ -21685,7 +22040,7 @@ "version": "5.3.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", - "dev": true, + "devOptional": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -22173,9 +22528,9 @@ } }, "node_modules/vite": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.6.tgz", - "integrity": "sha512-SRYIB8t/isTwNn8vMB3MR6E+EQZM/WG1aKmmIUCfDXfVvKfc20ZpamngWHKzAmmu9ppsgxsg4b2I7c90JZudIQ==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.2.2.tgz", + "integrity": "sha512-BxAKBWmIbrDgrokdGZH1IgkIk/5mMHDreLDmCJ0qpyJaAteP8NvMhkwr/ZCQNqNH97bw/dANTE9PDzqwJghfMQ==", "dev": true, "license": "MIT", "dependencies": { @@ -23023,7 +23378,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -23039,14 +23393,12 @@ "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/wrap-ansi-cjs/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -23202,7 +23554,6 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz", "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==", - "dev": true, "license": "ISC", "bin": { "yaml": "bin.mjs" @@ -23233,4 +23584,4 @@ } } } -} \ No newline at end of file +} diff --git a/ui/litellm-dashboard/package.json b/ui/litellm-dashboard/package.json index 102ea91ae1..cc3c0ef4e7 100644 --- a/ui/litellm-dashboard/package.json +++ b/ui/litellm-dashboard/package.json @@ -69,12 +69,17 @@ "prettier": "3.2.5", "tailwindcss": "^3.4.1", "typescript": "5.3.3", - "vite": "^7.1.6", + "vite": "^7.1.11", "vitest": "^3.2.4" }, "overrides": { "prismjs": ">=1.30.0", "webpack-dev-server": ">=5.2.1", - "mermaid": ">=11.10.0" + "mermaid": ">=11.10.0", + "js-yaml": ">=4.1.1" + }, + "engines": { + "node": ">=18.17.0", + "npm": ">=8.3.0" } } From 63994e302e5f2688005025b3aab2c4f9ca0d4559 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 14 Nov 2025 19:05:00 -0800 Subject: [PATCH 15/52] test_call_with_key_over_model_budget --- .../test_key_generate_prisma.py | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/proxy_unit_tests/test_key_generate_prisma.py b/tests/proxy_unit_tests/test_key_generate_prisma.py index 95aaef0af2..4fc47b72e6 100644 --- a/tests/proxy_unit_tests/test_key_generate_prisma.py +++ b/tests/proxy_unit_tests/test_key_generate_prisma.py @@ -1843,7 +1843,32 @@ async def test_call_with_key_over_model_budget( }, ) - await asyncio.sleep(2) + # Wait for the budget callback to complete with polling + max_wait_time = 10 # Maximum 10 seconds + poll_interval = 0.5 # Check every 0.5 seconds + waited = 0 + budget_updated = False + + while waited < max_wait_time: + await asyncio.sleep(poll_interval) + waited += poll_interval + + # Check if budget has been updated by trying to get spend from cache + try: + # Try to access the budget limiter cache to see if spend was recorded + virtual_spend_key = f"virtual_key_spend:{hash_token(generated_key)}:{request_model}:86400" + cached_spend = await model_budget_limiter.dual_cache.async_get_cache( + key=virtual_spend_key + ) + if cached_spend is not None and float(cached_spend) > 0: + budget_updated = True + break + except Exception: + pass + + if not budget_updated: + # Fallback to original 2 second wait if we couldn't verify + await asyncio.sleep(max(0, 2 - waited)) # use generated key to auth in result = await user_api_key_auth(request=request, api_key=bearer_token) From f599a462c153719aab7d45efdeadfb728d3b6b35 Mon Sep 17 00:00:00 2001 From: pnookala-godaddy <93624827+pnookala-godaddy@users.noreply.github.com> Date: Fri, 14 Nov 2025 19:33:37 -0800 Subject: [PATCH 16/52] openai(video): use GET for /videos/{id}/content by returning empty params; add tests to assert GET (#16672) --- litellm/llms/openai/videos/transformation.py | 10 ++--- tests/test_litellm/test_video_generation.py | 47 ++++++++++++++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/litellm/llms/openai/videos/transformation.py b/litellm/llms/openai/videos/transformation.py index 9848477f32..8f5d41fe46 100644 --- a/litellm/llms/openai/videos/transformation.py +++ b/litellm/llms/openai/videos/transformation.py @@ -178,10 +178,10 @@ class OpenAIVideoConfig(BaseVideoConfig): # Construct the URL for video content download url = f"{api_base.rstrip('/')}/{original_video_id}/content" - # Add video_id as query parameter - params = {"video_id": original_video_id} - - return url, params + # No additional data needed for GET content request + data: Dict[str, Any] = {} + + return url, data def transform_video_remix_request( self, @@ -404,4 +404,4 @@ class OpenAIVideoConfig(BaseVideoConfig): if isinstance(image, BufferedReader): files_list.append((field_name, (image.name, image, image_content_type))) else: - files_list.append((field_name, ("input_reference.png", image, image_content_type))) \ No newline at end of file + files_list.append((field_name, ("input_reference.png", image, image_content_type))) diff --git a/tests/test_litellm/test_video_generation.py b/tests/test_litellm/test_video_generation.py index b11e38b32b..3ba4a9ddda 100644 --- a/tests/test_litellm/test_video_generation.py +++ b/tests/test_litellm/test_video_generation.py @@ -14,6 +14,7 @@ import litellm from litellm.types.videos.main import VideoObject, VideoResponse from litellm.videos.main import video_generation, avideo_generation, video_status, avideo_status from litellm.llms.openai.videos.transformation import OpenAIVideoConfig +from litellm.llms.custom_httpx.llm_http_handler import BaseLLMHTTPHandler from litellm.cost_calculator import default_video_cost_calculator from litellm.litellm_core_utils.litellm_logging import Logging as LitellmLogging from litellm.integrations.custom_logger import CustomLogger @@ -713,5 +714,51 @@ class TestVideoLogging: # The important thing is that the logging payload is created and recognized +def test_openai_transform_video_content_request_empty_params(): + """OpenAI content transform should return empty params to ensure GET is used.""" + config = OpenAIVideoConfig() + url, params = config.transform_video_content_request( + video_id="video_123", + api_base="https://api.openai.com/v1/videos", + litellm_params={}, + headers={}, + ) + + assert url == "https://api.openai.com/v1/videos/video_123/content" + assert params == {} + + +def test_video_content_handler_uses_get_for_openai(): + """HTTP handler must use GET (not POST) for OpenAI content download.""" + handler = BaseLLMHTTPHandler() + config = OpenAIVideoConfig() + + mock_client = MagicMock() + mock_response = MagicMock() + mock_response.content = b"mp4-bytes" + mock_client.get.return_value = mock_response + + with patch( + "litellm.llms.custom_httpx.llm_http_handler._get_httpx_client", + return_value=mock_client, + ): + result = handler.video_content_handler( + video_id="video_abc", + video_content_provider_config=config, + custom_llm_provider="openai", + litellm_params={"api_base": "https://api.openai.com/v1"}, + logging_obj=MagicMock(), + timeout=5.0, + api_key="sk-test", + _is_async=False, + ) + + assert result == b"mp4-bytes" + mock_client.get.assert_called_once() + assert not mock_client.post.called + called_url = mock_client.get.call_args.kwargs["url"] + assert called_url == "https://api.openai.com/v1/videos/video_abc/content" + + if __name__ == "__main__": pytest.main([__file__]) From 473886d35a5ff347065faf57ad4ca70aefb96d9c Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 14 Nov 2025 19:34:28 -0800 Subject: [PATCH 17/52] user_alias in read and update path (#16669) --- litellm/proxy/_types.py | 1 + ui/litellm-dashboard/src/components/user_edit_view.tsx | 5 +++++ .../src/components/view_users/user_info_view.test.tsx | 10 +++++++++- .../src/components/view_users/user_info_view.tsx | 7 +++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 35ec1226fd..8b2a188c70 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -1144,6 +1144,7 @@ class UpdateUserRequestNoUserIDorEmail( password: Optional[str] = None spend: Optional[float] = None metadata: Optional[dict] = None + user_alias: Optional[str] = None user_role: Optional[ Literal[ LitellmUserRoles.PROXY_ADMIN, diff --git a/ui/litellm-dashboard/src/components/user_edit_view.tsx b/ui/litellm-dashboard/src/components/user_edit_view.tsx index 845719355d..5a15cba91f 100644 --- a/ui/litellm-dashboard/src/components/user_edit_view.tsx +++ b/ui/litellm-dashboard/src/components/user_edit_view.tsx @@ -40,6 +40,7 @@ export function UserEditView({ form.setFieldsValue({ user_id: userData.user_id, user_email: userData.user_info?.user_email, + user_alias: userData.user_info?.user_alias, user_role: userData.user_info?.user_role, models: userData.user_info?.models || [], max_budget: userData.user_info?.max_budget, @@ -76,6 +77,10 @@ export function UserEditView({ )} + + + + diff --git a/ui/litellm-dashboard/src/components/view_users/user_info_view.test.tsx b/ui/litellm-dashboard/src/components/view_users/user_info_view.test.tsx index 7334dd72fc..8d5927124a 100644 --- a/ui/litellm-dashboard/src/components/view_users/user_info_view.test.tsx +++ b/ui/litellm-dashboard/src/components/view_users/user_info_view.test.tsx @@ -7,6 +7,7 @@ vi.mock("../networking", () => { user_id: "user-123", user_info: { user_email: "test@example.com", + user_alias: "Test Alias", user_role: "admin", teams: [], models: [], @@ -40,7 +41,7 @@ describe("UserInfoView", () => { possibleUIRoles: null, }; - it("renders loading state and then the user email", async () => { + it("should render the loading state and then the user email", async () => { const { getByText, findAllByText } = render(); expect(getByText("Loading user data...")).toBeInTheDocument(); @@ -48,4 +49,11 @@ describe("UserInfoView", () => { const emails = await findAllByText("test@example.com"); expect(emails.length).toBeGreaterThan(0); }); + + it("should render the user alias", async () => { + const { findAllByText } = render(); + + const aliases = await findAllByText("Test Alias"); + expect(aliases.length).toBeGreaterThan(0); + }); }); diff --git a/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx b/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx index 65aa7c9d4c..456f07d188 100644 --- a/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx +++ b/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx @@ -33,6 +33,7 @@ interface UserInfo { user_id: string; user_info: { user_email: string | null; + user_alias: string | null; user_role: string | null; teams: any[] | null; models: string[] | null; @@ -138,6 +139,7 @@ export default function UserInfoView({ user_info: { ...userData.user_info, user_email: formValues.user_email, + user_alias: formValues.user_alias, models: formValues.models, max_budget: formValues.max_budget, budget_duration: formValues.budget_duration, @@ -384,6 +386,11 @@ export default function UserInfoView({ {userData.user_info?.user_email || "Not Set"}
+
+ User Alias + {userData.user_info?.user_alias || "Not Set"} +
+
Global Proxy Role {userData.user_info?.user_role || "Not Set"} From d84e97f211b23f32fa11d5e81eb47f93ab92b2ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Pe=C4=8Dnik?= Date: Sat, 15 Nov 2025 04:35:27 +0100 Subject: [PATCH 18/52] fix: preserve $defs for Anthropic tools input schema (#16648) * fix: preserve $defs for Anthropic tools input schema * fix: preserve $defs for Anthropic tools input schema * fix: preserve $defs for Anthropic tools input schema --- litellm/types/llms/anthropic.py | 16 +++++-- .../test_anthropic_completion.py | 46 +++++++++++++++++++ 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/litellm/types/llms/anthropic.py b/litellm/types/llms/anthropic.py index 1f20d4b0c7..903d429790 100644 --- a/litellm/types/llms/anthropic.py +++ b/litellm/types/llms/anthropic.py @@ -17,11 +17,17 @@ class AnthropicMessagesToolChoice(TypedDict, total=False): disable_parallel_tool_use: bool # default is false -class AnthropicInputSchema(TypedDict, total=False): - type: Optional[str] - properties: Optional[dict] - additionalProperties: Optional[bool] - required: Optional[List[str]] +AnthropicInputSchema = TypedDict( + "AnthropicInputSchema", + { + "type": Optional[str], + "properties": Optional[dict], + "additionalProperties": Optional[bool], + "required": Optional[List[str]], + "$defs": Optional[Dict], + }, + total=False, +) class AnthropicMessagesTool(TypedDict, total=False): diff --git a/tests/llm_translation/test_anthropic_completion.py b/tests/llm_translation/test_anthropic_completion.py index 42a3cbfca3..27841140e5 100644 --- a/tests/llm_translation/test_anthropic_completion.py +++ b/tests/llm_translation/test_anthropic_completion.py @@ -768,6 +768,52 @@ def test_anthropic_map_openai_params_tools_and_json_schema(): assert "Question" in json.dumps(mapped_params) +def test_anthropic_map_openai_params_tools_with_defs(): + args = { + "non_default_params": { + "tools": [ + { + "type": "function", + "function": { + "name": "create_user", + "description": "Create a user from provided profile data.", + "parameters": { + "type": "object", + "properties": { + "user": {"$ref": "#/$defs/User"}, + }, + "required": ["user"], + "$defs": { + "User": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "email": {"type": "string"}, + }, + "required": ["name", "email"], + } + }, + }, + }, + } + ] + } + } + + mapped_params = litellm.AnthropicConfig().map_openai_params( + non_default_params=args["non_default_params"], + optional_params={}, + model="claude-3-5-sonnet-20240620", + drop_params=False, + ) + + tool = mapped_params["tools"][0] + assert tool["input_schema"]["properties"]["user"]["$ref"] == "#/$defs/User" + assert ( + tool["input_schema"]["$defs"]["User"]["properties"]["name"]["type"] == "string" + ) + + from litellm.constants import RESPONSE_FORMAT_TOOL_NAME From d35d9008c96180059e82821f7ecf3e1cb9e5f5f8 Mon Sep 17 00:00:00 2001 From: Rob Geada Date: Sat, 15 Nov 2025 03:35:49 +0000 Subject: [PATCH 19/52] Ensure detector-id is passed as header to IBM detector server (#16649) --- .../guardrail_hooks/ibm_guardrails/ibm_detector.py | 6 +----- scripts/mock_ibm_guardrails_server.py | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py b/litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py index 72e0b3f013..c61ef3334c 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py +++ b/litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py @@ -127,13 +127,9 @@ class IBMGuardrailDetector(CustomGuardrail): headers = { "Authorization": f"Bearer {self.auth_token}", "content-type": "application/json", + "detector-id": self.detector_id, } - query_params = {"detector_id": self.detector_id} - - # update the api_url with the query params - self.api_url = f"{self.api_url}?{urlencode(query_params)}" - verbose_proxy_logger.debug( "IBM Detector Server request to %s with payload: %s", self.api_url, diff --git a/scripts/mock_ibm_guardrails_server.py b/scripts/mock_ibm_guardrails_server.py index 9850b62747..a9251c14ce 100644 --- a/scripts/mock_ibm_guardrails_server.py +++ b/scripts/mock_ibm_guardrails_server.py @@ -234,8 +234,8 @@ async def root(): @app.post("/api/v1/text/contents") async def text_detection( - detector_id: str, # query parameter request: TextDetectionRequest, + detector_id: str = Header(None), # query parameter authorization: Optional[str] = Header(None), ): """ @@ -243,6 +243,7 @@ async def text_detection( Args: request: Detection request with content and detector ID + detector_id: ID of detector authorization: Bearer token for authentication Returns: From cc72037cec8aaa51dec40fbce360e45b7e2a3e4a Mon Sep 17 00:00:00 2001 From: Cesar Garcia <128240629+Chesars@users.noreply.github.com> Date: Sat, 15 Nov 2025 00:38:27 -0300 Subject: [PATCH 20/52] feat(openai): Add verbosity parameter support for GPT-5 family models (#16660) OpenAI's GPT-5 model family supports a verbosity parameter to control the length and detail of responses. This parameter accepts three values: 'low', 'medium', or 'high'. Changes: - Added verbosity parameter to completion() and acompletion() signatures - Added verbosity to DEFAULT_CHAT_COMPLETION_PARAM_VALUES in constants.py - Added verbosity to get_optional_params() in utils.py - Added verbosity to GPT-5 supported params list - Updated OpenAI docs with verbosity usage examples - Added comprehensive test for verbosity parameter Supported models: gpt-5, gpt-5.1, gpt-5-mini, gpt-5-nano, gpt-5-codex, gpt-5-pro --- docs/my-website/docs/providers/openai.md | 47 +++++++++++++++++++ litellm/constants.py | 1 + .../llms/openai/chat/gpt_5_transformation.py | 2 +- litellm/main.py | 2 + litellm/utils.py | 1 + .../llms/openai/test_gpt5_transformation.py | 26 ++++++++++ 6 files changed, 78 insertions(+), 1 deletion(-) diff --git a/docs/my-website/docs/providers/openai.md b/docs/my-website/docs/providers/openai.md index e288f51155..99d17d8b21 100644 --- a/docs/my-website/docs/providers/openai.md +++ b/docs/my-website/docs/providers/openai.md @@ -486,6 +486,53 @@ curl -X POST 'http://0.0.0.0:4000/chat/completions' \ See [OpenAI Reasoning documentation](https://platform.openai.com/docs/guides/reasoning) for more details on organization verification requirements. +### Verbosity Control for GPT-5 Models + +The `verbosity` parameter controls the length and detail of responses from GPT-5 family models. It accepts three values: `"low"`, `"medium"`, or `"high"`. + +**Supported models:** All GPT-5 family models (`gpt-5`, `gpt-5.1`, `gpt-5-mini`, `gpt-5-nano`, `gpt-5-codex`, `gpt-5-pro`) + +**Use cases:** +- **`"low"`**: Best for concise answers or simple code generation (e.g., SQL queries) +- **`"medium"`**: Default - balanced output length +- **`"high"`**: Use when you need thorough explanations or extensive code refactoring + + + +```python +import litellm + +# Low verbosity - concise responses +response = litellm.completion( + model="gpt-5.1", + messages=[{"role": "user", "content": "Write a function to reverse a string"}], + verbosity="low" +) + +# High verbosity - detailed responses +response = litellm.completion( + model="gpt-5.1", + messages=[{"role": "user", "content": "Explain how neural networks work"}], + verbosity="high" +) +``` + + + +```bash +curl -X POST 'http://0.0.0.0:4000/chat/completions' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer sk-1234' \ +-d '{ + "model": "gpt-5.1", + "messages": [{"role": "user", "content": "Write a function to reverse a string"}], + "verbosity": "low" +}' +``` + + + + ## OpenAI Chat Completion to Responses API Bridge Call any Responses API model from OpenAI's `/chat/completions` endpoint. diff --git a/litellm/constants.py b/litellm/constants.py index d22772c7fb..3f763cad92 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -475,6 +475,7 @@ DEFAULT_CHAT_COMPLETION_PARAM_VALUES = { "additional_drop_params": None, "messages": None, "reasoning_effort": None, + "verbosity": None, "thinking": None, "web_search_options": None, "service_tier": None, diff --git a/litellm/llms/openai/chat/gpt_5_transformation.py b/litellm/llms/openai/chat/gpt_5_transformation.py index 183f60debb..d18f898cf1 100644 --- a/litellm/llms/openai/chat/gpt_5_transformation.py +++ b/litellm/llms/openai/chat/gpt_5_transformation.py @@ -30,7 +30,7 @@ class OpenAIGPT5Config(OpenAIGPTConfig): from litellm.utils import supports_tool_choice base_gpt_series_params = super().get_supported_openai_params(model=model) - gpt_5_only_params = ["reasoning_effort"] + gpt_5_only_params = ["reasoning_effort", "verbosity"] base_gpt_series_params.extend(gpt_5_only_params) if not supports_tool_choice(model=model): base_gpt_series_params.remove("tool_choice") diff --git a/litellm/main.py b/litellm/main.py index 23ffa90e2d..7d420bd36b 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -390,6 +390,7 @@ async def acompletion( reasoning_effort: Optional[ Literal["none", "minimal", "low", "medium", "high", "default"] ] = None, + verbosity: Optional[Literal["low", "medium", "high"]] = None, safety_identifier: Optional[str] = None, service_tier: Optional[str] = None, # set api_base, api_version, api_key @@ -961,6 +962,7 @@ def completion( # type: ignore # noqa: PLR0915 reasoning_effort: Optional[ Literal["none", "minimal", "low", "medium", "high", "default"] ] = None, + verbosity: Optional[Literal["low", "medium", "high"]] = None, response_format: Optional[Union[dict, Type[BaseModel]]] = None, seed: Optional[int] = None, tools: Optional[List] = None, diff --git a/litellm/utils.py b/litellm/utils.py index ae3de67374..e0cfa6202a 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -3383,6 +3383,7 @@ def get_optional_params( # noqa: PLR0915 drop_params=None, allowed_openai_params: Optional[List[str]] = None, reasoning_effort=None, + verbosity=None, additional_drop_params=None, messages: Optional[List[AllMessageValues]] = None, thinking: Optional[AnthropicThinkingParam] = None, diff --git a/tests/test_litellm/llms/openai/test_gpt5_transformation.py b/tests/test_litellm/llms/openai/test_gpt5_transformation.py index 42db678d1d..2e1eacce53 100644 --- a/tests/test_litellm/llms/openai/test_gpt5_transformation.py +++ b/tests/test_litellm/llms/openai/test_gpt5_transformation.py @@ -155,6 +155,32 @@ def test_gpt5_codex_supports_function_calling(config: OpenAIConfig): assert "tools" in supported_params +def test_gpt5_verbosity_parameter(config: OpenAIConfig): + """Test that verbosity parameter passes through correctly for GPT-5 models. + + The verbosity parameter controls output length and detail for GPT-5 family models. + Supported values: 'low', 'medium', 'high' + Supported models: gpt-5, gpt-5.1, gpt-5-mini, gpt-5-nano, gpt-5-codex, gpt-5-pro + """ + # Test all valid verbosity values + for verbosity_level in ["low", "medium", "high"]: + params = config.map_openai_params( + non_default_params={"verbosity": verbosity_level}, + optional_params={}, + model="gpt-5.1", + drop_params=False, + ) + assert params["verbosity"] == verbosity_level + + # Test with different GPT-5 models + for model in ["gpt-5", "gpt-5.1", "gpt-5-mini", "gpt-5-nano", "gpt-5-codex"]: + params = config.map_openai_params( + non_default_params={"verbosity": "low"}, + optional_params={}, + model=model, + drop_params=False, + ) + assert params["verbosity"] == "low" def test_gpt5_1_reasoning_effort_none(config: OpenAIConfig): """Test that GPT-5.1 supports reasoning_effort='none' parameter. From 15a04681ffd15ebde47adf403e0ded020c0a8cae Mon Sep 17 00:00:00 2001 From: Jorge Yero Salazar Date: Fri, 14 Nov 2025 21:38:50 -0600 Subject: [PATCH 21/52] Fix UI logos loading with SERVER_ROOT_PATH (#16618) --- .../out/_next/static/chunks/131-2eebef89ebe87d26.js | 2 +- .../out/_next/static/chunks/6204-910abacf940e6b75.js | 2 +- .../out/_next/static/chunks/7526-64e8890047228caf.js | 2 +- .../static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js | 2 +- .../(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js | 2 +- .../settings/logging-and-alerts/page-9879d5f79e798cff.js | 2 +- .../(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js | 2 +- .../chunks/app/(dashboard)/usage/page-e277e34746497b13.js | 2 +- .../out/_next/static/chunks/app/page-3ac57035eb8ce002.js | 2 +- ui/litellm-dashboard/src/components/callback_info_helpers.tsx | 2 +- ui/litellm-dashboard/src/components/provider_info_helpers.tsx | 2 +- .../src/components/search_tools/create_search_tool.tsx | 2 +- ui/litellm-dashboard/src/components/vector_store_providers.tsx | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js b/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js index 9d75456057..77e6671ad7 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[131],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return c.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return o.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),o=a(69552),c=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},80443:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914);t.Z=()=>{var e,t,a,i,o,c,d;let u=(0,r.useRouter)(),m="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{m||u.replace("/sso/key/generate")},[m,u]);let g=(0,s.useMemo)(()=>{if(!m)return null;try{return(0,l.o)(m)}catch(e){return(0,n.b)(),u.replace("/sso/key/generate"),null}},[m,u]);return{token:m,accessToken:null!==(e=null==g?void 0:g.key)&&void 0!==e?e:null,userId:null!==(t=null==g?void 0:g.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==g?void 0:g.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(i=null==g?void 0:g.user_role)&&void 0!==i?i:null),premiumUser:null!==(o=null==g?void 0:g.premium_user)&&void 0!==o?o:null,disabledPersonalKeyCreation:null!==(c=null==g?void 0:g.disabled_non_admin_personal_key_creation)&&void 0!==c?c:null,showSSOBanner:(null==g?void 0:g.login_method)==="username_password"}}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},O0:function(){return r},PA:function(){return c},RD:function(){return i},Z3:function(){return o},_3:function(){return d}});let s="/ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),o=e=>e.map(e=>n[e]||e),c=e=>e.map(e=>i[e]||e),d=e=>r.find(t=>t.id===e)},51601:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,g]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(o,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);g(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[o,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:c,onChange:t,value:a,loading:p,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(o){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(o),(0,n.fetchMCPAccessGroups)(o)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),p(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[o]);let f=[...g.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:e=>{t({servers:e.filter(e=>!g.includes(e)),accessGroups:e.filter(e=>g.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(87908),o=a(61994),c=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){p([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));p(s)}catch(e){console.error("Error fetching MCP servers:",e),p([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{g.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[g]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:g.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(c.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(o.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:o,...c}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:o,...c})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(52787),l=a(89970),n=a(23496),i=a(15424),o=a(20831),c=a(12514),d=a(49566),u=a(91777),m=a(82182),g=a(22452),p=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let o=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(o).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(o).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(o.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:g.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(c.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(o.Z,{variant:"light",onClick:()=>N(t),icon:p.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){p(!0);try{let e=await (0,n.vectorStoreListCall)(o);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[o]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:t,value:a,loading:g,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e)}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[131],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return c.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return o.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),o=a(69552),c=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},80443:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914);t.Z=()=>{var e,t,a,i,o,c,d;let u=(0,r.useRouter)(),m="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{m||u.replace("/sso/key/generate")},[m,u]);let g=(0,s.useMemo)(()=>{if(!m)return null;try{return(0,l.o)(m)}catch(e){return(0,n.b)(),u.replace("/sso/key/generate"),null}},[m,u]);return{token:m,accessToken:null!==(e=null==g?void 0:g.key)&&void 0!==e?e:null,userId:null!==(t=null==g?void 0:g.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==g?void 0:g.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(i=null==g?void 0:g.user_role)&&void 0!==i?i:null),premiumUser:null!==(o=null==g?void 0:g.premium_user)&&void 0!==o?o:null,disabledPersonalKeyCreation:null!==(c=null==g?void 0:g.disabled_non_admin_personal_key_creation)&&void 0!==c?c:null,showSSOBanner:(null==g?void 0:g.login_method)==="username_password"}}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},O0:function(){return r},PA:function(){return c},RD:function(){return i},Z3:function(){return o},_3:function(){return d}});let s="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),o=e=>e.map(e=>n[e]||e),c=e=>e.map(e=>i[e]||e),d=e=>r.find(t=>t.id===e)},51601:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,g]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(o,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);g(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[o,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:c,onChange:t,value:a,loading:p,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(o){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(o),(0,n.fetchMCPAccessGroups)(o)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),p(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[o]);let f=[...g.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:e=>{t({servers:e.filter(e=>!g.includes(e)),accessGroups:e.filter(e=>g.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(87908),o=a(61994),c=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){p([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));p(s)}catch(e){console.error("Error fetching MCP servers:",e),p([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{g.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[g]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:g.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(c.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(o.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:o,...c}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:o,...c})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(52787),l=a(89970),n=a(23496),i=a(15424),o=a(20831),c=a(12514),d=a(49566),u=a(91777),m=a(82182),g=a(22452),p=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let o=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(o).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(o).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(o.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:g.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(c.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(o.Z,{variant:"light",onClick:()=>N(t),icon:p.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){p(!0);try{let e=await (0,n.vectorStoreListCall)(o);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[o]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:t,value:a,loading:g,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e)}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6204-910abacf940e6b75.js b/litellm/proxy/_experimental/out/_next/static/chunks/6204-910abacf940e6b75.js index cf812b7fb3..a29ab72bad 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/6204-910abacf940e6b75.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/6204-910abacf940e6b75.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6204],{45822:function(e,t,r){r.d(t,{JO:function(){return o.Z},JX:function(){return l.Z},rj:function(){return a.Z},xv:function(){return n.Z},zx:function(){return s.Z}});var s=r(20831),l=r(49804),a=r(67101),o=r(47323),n=r(84264)},10178:function(e,t,r){r.d(t,{JO:function(){return s.Z},RM:function(){return a.Z},SC:function(){return i.Z},iA:function(){return l.Z},pj:function(){return o.Z},ss:function(){return n.Z},xs:function(){return c.Z}});var s=r(47323),l=r(21626),a=r(97214),o=r(28241),n=r(58834),c=r(69552),i=r(71876)},6204:function(e,t,r){r.d(t,{Z:function(){return ex}});var s,l,a=r(57437),o=r(2265),n=r(45822),c=r(23628),i=r(19250),d=r(10178),x=r(53410),m=r(74998),h=r(44633),u=r(86462),p=r(49084),v=r(89970),j=r(71594),g=r(24525),f=r(42673),_=e=>{let{data:t,onView:r,onEdit:s,onDelete:l}=e,[n,c]=o.useState([{id:"created_at",desc:!0}]),i=[{header:"Vector Store ID",accessorKey:"vector_store_id",cell:e=>{let{row:t}=e,s=t.original;return(0,a.jsx)("button",{onClick:()=>r(s.vector_store_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:s.vector_store_id.length>15?"".concat(s.vector_store_id.slice(0,15),"..."):s.vector_store_id})}},{header:"Name",accessorKey:"vector_store_name",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)(v.Z,{title:r.vector_store_name,children:(0,a.jsx)("span",{className:"text-xs",children:r.vector_store_name||"-"})})}},{header:"Description",accessorKey:"vector_store_description",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)(v.Z,{title:r.vector_store_description,children:(0,a.jsx)("span",{className:"text-xs",children:r.vector_store_description||"-"})})}},{header:"Provider",accessorKey:"custom_llm_provider",cell:e=>{let{row:t}=e,r=t.original,{displayName:s,logo:l}=(0,f.dr)(r.custom_llm_provider);return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,a.jsx)("img",{src:l,alt:s,className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-xs",children:s})]})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)("span",{className:"text-xs",children:new Date(r.created_at).toLocaleDateString()})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)("span",{className:"text-xs",children:new Date(r.updated_at).toLocaleDateString()})}},{id:"actions",header:"",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)(d.JO,{icon:x.Z,size:"sm",onClick:()=>s(r.vector_store_id),className:"cursor-pointer"}),(0,a.jsx)(d.JO,{icon:m.Z,size:"sm",onClick:()=>l(r.vector_store_id),className:"cursor-pointer"})]})}}],_=(0,j.b7)({data:t,columns:i,state:{sorting:n},onSortingChange:c,getCoreRowModel:(0,g.sC)(),getSortedRowModel:(0,g.tj)(),enableSorting:!0});return(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(d.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(d.ss,{children:_.getHeaderGroups().map(e=>(0,a.jsx)(d.SC,{children:e.headers.map(e=>(0,a.jsx)(d.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,j.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(h.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(u.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(p.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,a.jsx)(d.RM,{children:_.getRowModel().rows.length>0?_.getRowModel().rows.map(e=>(0,a.jsx)(d.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,a.jsx)(d.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,j.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,a.jsx)(d.SC,{children:(0,a.jsx)(d.pj,{colSpan:i.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No vector stores found"})})})})})]})})})},y=r(64504),b=r(13634),N=r(82680),w=r(52787),Z=r(61778),S=r(64482),C=r(15424);(s=l||(l={})).Bedrock="Amazon Bedrock",s.PgVector="PostgreSQL pgvector (LiteLLM Connector)",s.VertexRagEngine="Vertex AI RAG Engine",s.OpenAI="OpenAI",s.Azure="Azure OpenAI";let I={Bedrock:"bedrock",PgVector:"pg_vector",VertexRagEngine:"vertex_ai",OpenAI:"openai",Azure:"azure"},k="/ui/assets/logos/",A={"Amazon Bedrock":"".concat(k,"bedrock.svg"),"PostgreSQL pgvector (LiteLLM Connector)":"".concat(k,"postgresql.svg"),"Vertex AI RAG Engine":"".concat(k,"google.svg"),OpenAI:"".concat(k,"openai_small.svg"),"Azure OpenAI":"".concat(k,"microsoft_azure.svg")},E={bedrock:[],pg_vector:[{name:"api_base",label:"API Base",tooltip:"Enter the base URL of your deployed litellm-pgvector server (e.g., http://your-server:8000)",placeholder:"http://your-deployed-server:8000",required:!0,type:"text"},{name:"api_key",label:"API Key",tooltip:"Enter the API key from your deployed litellm-pgvector server",placeholder:"your-deployed-api-key",required:!0,type:"password"}],vertex_rag_engine:[],openai:[{name:"api_key",label:"API Key",tooltip:"Enter your OpenAI API key",placeholder:"sk-...",required:!0,type:"password"}],azure:[{name:"api_key",label:"API Key",tooltip:"Enter your Azure OpenAI API key",placeholder:"your-azure-api-key",required:!0,type:"password"},{name:"api_base",label:"API Base",tooltip:"Enter your Azure OpenAI endpoint (e.g., https://your-resource.openai.azure.com/)",placeholder:"https://your-resource.openai.azure.com/",required:!0,type:"text"}]},L=e=>E[e]||[];var V=r(9114),D=e=>{let{isVisible:t,onCancel:r,onSuccess:s,accessToken:n,credentials:c}=e,[d]=b.Z.useForm(),[x,m]=(0,o.useState)("{}"),[h,u]=(0,o.useState)("bedrock"),p=async e=>{if(n)try{let t={};try{t=x.trim()?JSON.parse(x):{}}catch(e){V.Z.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t,litellm_credential_name:e.litellm_credential_name},l=L(e.custom_llm_provider).reduce((t,r)=>(t[r.name]=e[r.name],t),{});r.litellm_params=l,await (0,i.vectorStoreCreateCall)(n,r),V.Z.success("Vector store created successfully"),d.resetFields(),m("{}"),s()}catch(e){console.error("Error creating vector store:",e),V.Z.fromBackend("Error creating vector store: "+e)}},j=()=>{d.resetFields(),m("{}"),u("bedrock"),r()};return(0,a.jsx)(N.Z,{title:"Add New Vector Store",visible:t,width:1e3,footer:null,onCancel:j,children:(0,a.jsxs)(b.Z,{form:d,onFinish:p,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Provider"," ",(0,a.jsx)(v.Z,{title:"Select the provider for this vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],initialValue:"bedrock",children:(0,a.jsx)(w.default,{onChange:e=>u(e),children:Object.entries(l).map(e=>{let[t,r]=e;return(0,a.jsx)(w.default.Option,{value:I[t],children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("img",{src:A[r],alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let t=e.target,s=t.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=r.charAt(0),s.replaceChild(e,t)}}}),(0,a.jsx)("span",{children:r})]})},t)})})}),"pg_vector"===h&&(0,a.jsx)(Z.Z,{message:"PG Vector Setup Required",description:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:"LiteLLM provides a server to connect to PG Vector. To use this provider:"}),(0,a.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,a.jsxs)("li",{children:["Deploy the litellm-pgvector server from:"," ",(0,a.jsx)("a",{href:"https://github.com/BerriAI/litellm-pgvector",target:"_blank",rel:"noopener noreferrer",children:"https://github.com/BerriAI/litellm-pgvector"})]}),(0,a.jsx)("li",{children:"Configure your PostgreSQL database with pgvector extension"}),(0,a.jsx)("li",{children:"Start the server and note the API base URL and API key"}),(0,a.jsx)("li",{children:"Enter those details in the fields below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),"vertex_rag_engine"===h&&(0,a.jsx)(Z.Z,{message:"Vertex AI RAG Engine Setup",description:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:"To use Vertex AI RAG Engine:"}),(0,a.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,a.jsxs)("li",{children:["Set up your Vertex AI RAG Engine corpus following the guide:"," ",(0,a.jsx)("a",{href:"https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/rag-overview",target:"_blank",rel:"noopener noreferrer",children:"Vertex AI RAG Engine Overview"})]}),(0,a.jsx)("li",{children:"Create a corpus in your Google Cloud project"}),(0,a.jsx)("li",{children:"Note the corpus ID from the Vertex AI console"}),(0,a.jsx)("li",{children:"Enter the corpus ID in the Vector Store ID field below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Vector Store ID"," ",(0,a.jsx)(v.Z,{title:"Enter the vector store ID from your api provider",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"vector_store_id",rules:[{required:!0,message:"Please input the vector store ID from your api provider"}],children:(0,a.jsx)(y.o,{placeholder:"vertex_rag_engine"===h?"6917529027641081856 (Get corpus ID from Vertex AI console)":"Enter vector store ID from your provider"})}),L(h).map(e=>(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:[e.label," ",(0,a.jsx)(v.Z,{title:e.tooltip,children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:e.name,rules:e.required?[{required:!0,message:"Please input the ".concat(e.label.toLowerCase())}]:[],children:(0,a.jsx)(y.o,{type:e.type||"text",placeholder:e.placeholder})},e.name)),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Vector Store Name"," ",(0,a.jsx)(v.Z,{title:"Custom name you want to give to the vector store, this name will be rendered on the LiteLLM UI",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"vector_store_name",children:(0,a.jsx)(y.o,{})}),(0,a.jsx)(b.Z.Item,{label:"Description",name:"vector_store_description",children:(0,a.jsx)(S.default.TextArea,{rows:4})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Existing Credentials"," ",(0,a.jsx)(v.Z,{title:"Optionally select API provider credentials for this vector store eg. Bedrock API KEY",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"litellm_credential_name",children:(0,a.jsx)(w.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>{var r;return(null!==(r=null==t?void 0:t.label)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...c.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Metadata"," ",(0,a.jsx)(v.Z,{title:"JSON metadata for the vector store (optional)",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),children:(0,a.jsx)(S.default.TextArea,{rows:4,value:x,onChange:e=>m(e.target.value),placeholder:'{"key": "value"}'})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-3",children:[(0,a.jsx)(y.z,{onClick:j,variant:"secondary",children:"Cancel"}),(0,a.jsx)(y.z,{variant:"primary",type:"submit",children:"Create"})]})]})})},P=r(16312),O=e=>{let{isVisible:t,onCancel:r,onConfirm:s}=e;return(0,a.jsxs)(N.Z,{title:"Delete Vector Store",visible:t,footer:null,onCancel:r,children:[(0,a.jsx)("p",{children:"Are you sure you want to delete this vector store? This action cannot be undone."}),(0,a.jsxs)("div",{className:"px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(P.z,{onClick:s,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(P.z,{onClick:r,variant:"primary",children:"Cancel"})]})]})},z=r(41649),R=r(20831),B=r(12514),T=r(12485),q=r(18135),F=r(35242),J=r(29706),M=r(77991),K=r(84264),G=r(96761),U=r(73002),Q=r(10900),H=r(93192),Y=r(42264),X=r(67960),W=r(23496),$=r(87908),ee=r(44625),et=r(70464),er=r(77565),es=r(61935),el=r(23907);let{TextArea:ea}=S.default,{Text:eo,Title:en}=H.default;var ec=e=>{let{vectorStoreId:t,accessToken:r,className:s=""}=e,[l,n]=(0,o.useState)(""),[c,d]=(0,o.useState)(!1),[x,m]=(0,o.useState)([]),[h,u]=(0,o.useState)({}),p=async()=>{if(!l.trim()){Y.ZP.warning("Please enter a search query");return}d(!0);try{let e=await (0,i.vectorStoreSearchCall)(r,t,l),s={query:l,response:e,timestamp:Date.now()};m(e=>[s,...e]),n("")}catch(e){console.error("Error searching vector store:",e),V.Z.fromBackend("Failed to search vector store")}finally{d(!1)}},v=e=>new Date(e).toLocaleString(),j=(e,t)=>{let r="".concat(e,"-").concat(t);u(e=>({...e,[r]:!e[r]}))};return(0,a.jsx)(X.Z,{className:"w-full rounded-xl shadow-md",children:(0,a.jsxs)("div",{className:"flex flex-col h-[600px]",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(ee.Z,{className:"mr-2 text-blue-500"}),(0,a.jsx)(en,{level:4,className:"mb-0",children:"Test Vector Store"})]}),x.length>0&&(0,a.jsx)(U.ZP,{onClick:()=>{m([]),u({}),V.Z.success("Search history cleared")},size:"small",children:"Clear History"})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===x.length?(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)(ee.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,a.jsx)(eo,{children:"Test your vector store by entering a search query below"})]}):(0,a.jsx)("div",{className:"space-y-4",children:x.map((e,t)=>{var r;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-right",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-blue-50 border border-blue-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("strong",{className:"text-sm",children:"Query"}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:v(e.timestamp)})]}),(0,a.jsx)("div",{className:"text-left",children:e.query})]})}),(0,a.jsx)("div",{className:"text-left",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-white border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)(ee.Z,{className:"text-green-500"}),(0,a.jsx)("strong",{className:"text-sm",children:"Vector Store Results"}),e.response&&(0,a.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600",children:[(null===(r=e.response.data)||void 0===r?void 0:r.length)||0," results"]})]}),e.response&&e.response.data&&e.response.data.length>0?(0,a.jsx)("div",{className:"space-y-3",children:e.response.data.map((e,r)=>{let s=h["".concat(t,"-").concat(r)]||!1;return(0,a.jsxs)("div",{className:"border rounded-lg overflow-hidden bg-gray-50",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center p-3 cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>j(t,r),children:[(0,a.jsxs)("div",{className:"flex items-center",children:[s?(0,a.jsx)(et.Z,{className:"text-gray-500 mr-2"}):(0,a.jsx)(er.Z,{className:"text-gray-500 mr-2"}),(0,a.jsxs)("span",{className:"font-medium text-sm",children:["Result ",r+1]}),!s&&e.content&&e.content[0]&&(0,a.jsxs)("span",{className:"ml-2 text-xs text-gray-500 truncate max-w-md",children:["- ",e.content[0].text.substring(0,100),"..."]})]}),(0,a.jsxs)("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:["Score: ",e.score.toFixed(4)]})]}),s&&(0,a.jsxs)("div",{className:"border-t bg-white p-3",children:[e.content&&e.content.map((e,t)=>(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsxs)("div",{className:"text-xs text-gray-500 mb-1",children:["Content (",e.type,")"]}),(0,a.jsx)("div",{className:"text-sm bg-gray-50 p-3 rounded border text-gray-800 max-h-40 overflow-y-auto",children:e.text})]},t)),(e.file_id||e.filename||e.attributes)&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:[(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-2 font-medium",children:"Metadata"}),(0,a.jsxs)("div",{className:"space-y-2 text-xs",children:[e.file_id&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium",children:"File ID:"})," ",e.file_id]}),e.filename&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium",children:"Filename:"})," ",e.filename]}),e.attributes&&Object.keys(e.attributes).length>0&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium block mb-1",children:"Attributes:"}),(0,a.jsx)("pre",{className:"text-xs bg-white p-2 rounded border overflow-x-auto",children:JSON.stringify(e.attributes,null,2)})]})]})]})]})]},r)})}):(0,a.jsx)("div",{className:"text-gray-500 text-sm",children:"No results found"})]})}),tn(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),p())},placeholder:"Enter your search query... (Shift+Enter for new line)",disabled:c,autoSize:{minRows:1,maxRows:4},style:{resize:"none"}})}),(0,a.jsx)(U.ZP,{type:"primary",onClick:p,disabled:c||!l.trim(),icon:(0,a.jsx)(el.Z,{}),loading:c,children:"Search"})]})})]})})},ei=e=>{let{vectorStoreId:t,onClose:r,accessToken:s,is_admin:l,editVectorStore:n}=e,[c]=b.Z.useForm(),[d,x]=(0,o.useState)(null),[m,h]=(0,o.useState)(n),[u,p]=(0,o.useState)("{}"),[j,g]=(0,o.useState)([]),[_,y]=(0,o.useState)("details"),N=async()=>{if(s)try{let e=await (0,i.vectorStoreInfoCall)(s,t);if(e&&e.vector_store){if(x(e.vector_store),e.vector_store.vector_store_metadata){let t="string"==typeof e.vector_store.vector_store_metadata?JSON.parse(e.vector_store.vector_store_metadata):e.vector_store.vector_store_metadata;p(JSON.stringify(t,null,2))}n&&c.setFieldsValue({vector_store_id:e.vector_store.vector_store_id,custom_llm_provider:e.vector_store.custom_llm_provider,vector_store_name:e.vector_store.vector_store_name,vector_store_description:e.vector_store.vector_store_description})}}catch(e){console.error("Error fetching vector store details:",e),V.Z.fromBackend("Error fetching vector store details: "+e)}},Z=async()=>{if(s)try{let e=await (0,i.credentialListCall)(s);console.log("List credentials response:",e),g(e.credentials||[])}catch(e){console.error("Error fetching credentials:",e)}};(0,o.useEffect)(()=>{N(),Z()},[t,s]);let I=async e=>{if(s)try{let t={};try{t=u?JSON.parse(u):{}}catch(e){V.Z.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t};await (0,i.vectorStoreUpdateCall)(s,r),V.Z.success("Vector store updated successfully"),h(!1),N()}catch(e){console.error("Error updating vector store:",e),V.Z.fromBackend("Error updating vector store: "+e)}};return d?(0,a.jsxs)("div",{className:"p-4 max-w-full",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(R.Z,{icon:Q.Z,variant:"light",className:"mb-4",onClick:r,children:"Back to Vector Stores"}),(0,a.jsxs)(G.Z,{children:["Vector Store ID: ",d.vector_store_id]}),(0,a.jsx)(K.Z,{className:"text-gray-500",children:d.vector_store_description||"No description"})]}),l&&!m&&(0,a.jsx)(R.Z,{onClick:()=>h(!0),children:"Edit Vector Store"})]}),(0,a.jsxs)(q.Z,{children:[(0,a.jsxs)(F.Z,{className:"mb-6",children:[(0,a.jsx)(T.Z,{children:"Details"}),(0,a.jsx)(T.Z,{children:"Test Vector Store"})]}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(J.Z,{children:m?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,a.jsx)(G.Z,{children:"Edit Vector Store"})}),(0,a.jsx)(B.Z,{children:(0,a.jsxs)(b.Z,{form:c,onFinish:I,layout:"vertical",initialValues:d,children:[(0,a.jsx)(b.Z.Item,{label:"Vector Store ID",name:"vector_store_id",rules:[{required:!0,message:"Please input a vector store ID"}],children:(0,a.jsx)(S.default,{disabled:!0})}),(0,a.jsx)(b.Z.Item,{label:"Vector Store Name",name:"vector_store_name",children:(0,a.jsx)(S.default,{})}),(0,a.jsx)(b.Z.Item,{label:"Description",name:"vector_store_description",children:(0,a.jsx)(S.default.TextArea,{rows:4})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Provider"," ",(0,a.jsx)(v.Z,{title:"Select the provider for this vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,a.jsx)(w.default,{children:Object.entries(f.Cl).map(e=>{let[t,r]=e;return"Bedrock"===t?(0,a.jsx)(w.default.Option,{value:f.fK[t],children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("img",{src:f.cd[r],alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let t=e.target,s=t.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=r.charAt(0),s.replaceChild(e,t)}}}),(0,a.jsx)("span",{children:r})]})},t):null})})}),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(K.Z,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter provider credentials below"})}),(0,a.jsx)(b.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",children:(0,a.jsx)(w.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>{var r;return(null!==(r=null==t?void 0:t.label)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...j.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,a.jsxs)("div",{className:"flex items-center my-4",children:[(0,a.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,a.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,a.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Metadata"," ",(0,a.jsx)(v.Z,{title:"JSON metadata for the vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),children:(0,a.jsx)(S.default.TextArea,{rows:4,value:u,onChange:e=>p(e.target.value),placeholder:'{"key": "value"}'})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,a.jsx)(U.ZP,{onClick:()=>h(!1),children:"Cancel"}),(0,a.jsx)(U.ZP,{type:"primary",htmlType:"submit",children:"Save Changes"})]})]})})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(G.Z,{children:"Vector Store Details"}),l&&(0,a.jsx)(R.Z,{onClick:()=>h(!0),children:"Edit Vector Store"})]}),(0,a.jsx)(B.Z,{children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"ID"}),(0,a.jsx)(K.Z,{children:d.vector_store_id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Name"}),(0,a.jsx)(K.Z,{children:d.vector_store_name||"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Description"}),(0,a.jsx)(K.Z,{children:d.vector_store_description||"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Provider"}),(0,a.jsx)("div",{className:"flex items-center space-x-2 mt-1",children:(()=>{let e=d.custom_llm_provider||"bedrock",{displayName:t,logo:r}=(()=>{let t=Object.keys(f.fK).find(t=>f.fK[t].toLowerCase()===e.toLowerCase());if(!t)return{displayName:e,logo:""};let r=f.Cl[t],s=f.cd[r];return{displayName:r,logo:s}})();return(0,a.jsxs)(a.Fragment,{children:[r&&(0,a.jsx)("img",{src:r,alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let r=e.target,s=r.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,r)}}}),(0,a.jsx)(z.Z,{color:"blue",children:t})]})})()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Metadata"}),(0,a.jsx)("div",{className:"bg-gray-50 p-3 rounded mt-2 font-mono text-xs overflow-auto max-h-48",children:(0,a.jsx)("pre",{children:u})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Created"}),(0,a.jsx)(K.Z,{children:d.created_at?new Date(d.created_at).toLocaleString():"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Last Updated"}),(0,a.jsx)(K.Z,{children:d.updated_at?new Date(d.updated_at).toLocaleString():"-"})]})]})})]})}),(0,a.jsx)(J.Z,{children:(0,a.jsx)(ec,{vectorStoreId:d.vector_store_id,accessToken:s||""})})]})]})]}):(0,a.jsx)("div",{children:"Loading..."})},ed=r(20347),ex=e=>{let{accessToken:t,userID:r,userRole:s}=e,[l,d]=(0,o.useState)([]),[x,m]=(0,o.useState)(!1),[h,u]=(0,o.useState)(!1),[p,v]=(0,o.useState)(null),[j,g]=(0,o.useState)(""),[f,y]=(0,o.useState)([]),[b,N]=(0,o.useState)(null),[w,Z]=(0,o.useState)(!1),S=async()=>{if(t)try{let e=await (0,i.vectorStoreListCall)(t);console.log("List vector stores response:",e),d(e.data||[])}catch(e){console.error("Error fetching vector stores:",e),V.Z.fromBackend("Error fetching vector stores: "+e)}},C=async()=>{if(t)try{let e=await (0,i.credentialListCall)(t);console.log("List credentials response:",e),y(e.credentials||[])}catch(e){console.error("Error fetching credentials:",e),V.Z.fromBackend("Error fetching credentials: "+e)}},I=async e=>{v(e),u(!0)},k=async()=>{if(t&&p){try{await (0,i.vectorStoreDeleteCall)(t,p),V.Z.success("Vector store deleted successfully"),S()}catch(e){console.error("Error deleting vector store:",e),V.Z.fromBackend("Error deleting vector store: "+e)}u(!1),v(null)}};return(0,o.useEffect)(()=>{S(),C()},[t]),b?(0,a.jsx)("div",{className:"w-full h-full",children:(0,a.jsx)(ei,{vectorStoreId:b,onClose:()=>{N(null),Z(!1),S()},accessToken:t,is_admin:(0,ed.tY)(s||""),editVectorStore:w})}):(0,a.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,a.jsxs)("div",{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)("div",{className:"flex justify-between mt-2 w-full items-center mb-4",children:[(0,a.jsx)("h1",{children:"Vector Store Management"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[j&&(0,a.jsxs)(n.xv,{children:["Last Refreshed: ",j]}),(0,a.jsx)(n.JO,{icon:c.Z,variant:"shadow",size:"xs",className:"self-center cursor-pointer",onClick:()=>{S(),C(),g(new Date().toLocaleString())}})]})]}),(0,a.jsx)(n.xv,{className:"mb-4",children:(0,a.jsx)("p",{children:"You can use vector stores to store and retrieve LLM embeddings.."})}),(0,a.jsx)(n.zx,{className:"mb-4",onClick:()=>m(!0),children:"+ Add Vector Store"}),(0,a.jsx)(n.rj,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,a.jsx)(n.JX,{numColSpan:1,children:(0,a.jsx)(_,{data:l,onView:e=>{N(e),Z(!1)},onEdit:e=>{N(e),Z(!0)},onDelete:I})})}),(0,a.jsx)(D,{isVisible:x,onCancel:()=>m(!1),onSuccess:()=>{m(!1),S()},accessToken:t,credentials:f}),(0,a.jsx)(O,{isVisible:h,onCancel:()=>u(!1),onConfirm:k})]})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6204],{45822:function(e,t,r){r.d(t,{JO:function(){return o.Z},JX:function(){return l.Z},rj:function(){return a.Z},xv:function(){return n.Z},zx:function(){return s.Z}});var s=r(20831),l=r(49804),a=r(67101),o=r(47323),n=r(84264)},10178:function(e,t,r){r.d(t,{JO:function(){return s.Z},RM:function(){return a.Z},SC:function(){return i.Z},iA:function(){return l.Z},pj:function(){return o.Z},ss:function(){return n.Z},xs:function(){return c.Z}});var s=r(47323),l=r(21626),a=r(97214),o=r(28241),n=r(58834),c=r(69552),i=r(71876)},6204:function(e,t,r){r.d(t,{Z:function(){return ex}});var s,l,a=r(57437),o=r(2265),n=r(45822),c=r(23628),i=r(19250),d=r(10178),x=r(53410),m=r(74998),h=r(44633),u=r(86462),p=r(49084),v=r(89970),j=r(71594),g=r(24525),f=r(42673),_=e=>{let{data:t,onView:r,onEdit:s,onDelete:l}=e,[n,c]=o.useState([{id:"created_at",desc:!0}]),i=[{header:"Vector Store ID",accessorKey:"vector_store_id",cell:e=>{let{row:t}=e,s=t.original;return(0,a.jsx)("button",{onClick:()=>r(s.vector_store_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:s.vector_store_id.length>15?"".concat(s.vector_store_id.slice(0,15),"..."):s.vector_store_id})}},{header:"Name",accessorKey:"vector_store_name",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)(v.Z,{title:r.vector_store_name,children:(0,a.jsx)("span",{className:"text-xs",children:r.vector_store_name||"-"})})}},{header:"Description",accessorKey:"vector_store_description",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)(v.Z,{title:r.vector_store_description,children:(0,a.jsx)("span",{className:"text-xs",children:r.vector_store_description||"-"})})}},{header:"Provider",accessorKey:"custom_llm_provider",cell:e=>{let{row:t}=e,r=t.original,{displayName:s,logo:l}=(0,f.dr)(r.custom_llm_provider);return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,a.jsx)("img",{src:l,alt:s,className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-xs",children:s})]})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)("span",{className:"text-xs",children:new Date(r.created_at).toLocaleDateString()})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)("span",{className:"text-xs",children:new Date(r.updated_at).toLocaleDateString()})}},{id:"actions",header:"",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)(d.JO,{icon:x.Z,size:"sm",onClick:()=>s(r.vector_store_id),className:"cursor-pointer"}),(0,a.jsx)(d.JO,{icon:m.Z,size:"sm",onClick:()=>l(r.vector_store_id),className:"cursor-pointer"})]})}}],_=(0,j.b7)({data:t,columns:i,state:{sorting:n},onSortingChange:c,getCoreRowModel:(0,g.sC)(),getSortedRowModel:(0,g.tj)(),enableSorting:!0});return(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(d.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(d.ss,{children:_.getHeaderGroups().map(e=>(0,a.jsx)(d.SC,{children:e.headers.map(e=>(0,a.jsx)(d.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,j.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(h.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(u.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(p.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,a.jsx)(d.RM,{children:_.getRowModel().rows.length>0?_.getRowModel().rows.map(e=>(0,a.jsx)(d.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,a.jsx)(d.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,j.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,a.jsx)(d.SC,{children:(0,a.jsx)(d.pj,{colSpan:i.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No vector stores found"})})})})})]})})})},y=r(64504),b=r(13634),N=r(82680),w=r(52787),Z=r(61778),S=r(64482),C=r(15424);(s=l||(l={})).Bedrock="Amazon Bedrock",s.PgVector="PostgreSQL pgvector (LiteLLM Connector)",s.VertexRagEngine="Vertex AI RAG Engine",s.OpenAI="OpenAI",s.Azure="Azure OpenAI";let I={Bedrock:"bedrock",PgVector:"pg_vector",VertexRagEngine:"vertex_ai",OpenAI:"openai",Azure:"azure"},k="../ui/assets/logos/",A={"Amazon Bedrock":"".concat(k,"bedrock.svg"),"PostgreSQL pgvector (LiteLLM Connector)":"".concat(k,"postgresql.svg"),"Vertex AI RAG Engine":"".concat(k,"google.svg"),OpenAI:"".concat(k,"openai_small.svg"),"Azure OpenAI":"".concat(k,"microsoft_azure.svg")},E={bedrock:[],pg_vector:[{name:"api_base",label:"API Base",tooltip:"Enter the base URL of your deployed litellm-pgvector server (e.g., http://your-server:8000)",placeholder:"http://your-deployed-server:8000",required:!0,type:"text"},{name:"api_key",label:"API Key",tooltip:"Enter the API key from your deployed litellm-pgvector server",placeholder:"your-deployed-api-key",required:!0,type:"password"}],vertex_rag_engine:[],openai:[{name:"api_key",label:"API Key",tooltip:"Enter your OpenAI API key",placeholder:"sk-...",required:!0,type:"password"}],azure:[{name:"api_key",label:"API Key",tooltip:"Enter your Azure OpenAI API key",placeholder:"your-azure-api-key",required:!0,type:"password"},{name:"api_base",label:"API Base",tooltip:"Enter your Azure OpenAI endpoint (e.g., https://your-resource.openai.azure.com/)",placeholder:"https://your-resource.openai.azure.com/",required:!0,type:"text"}]},L=e=>E[e]||[];var V=r(9114),D=e=>{let{isVisible:t,onCancel:r,onSuccess:s,accessToken:n,credentials:c}=e,[d]=b.Z.useForm(),[x,m]=(0,o.useState)("{}"),[h,u]=(0,o.useState)("bedrock"),p=async e=>{if(n)try{let t={};try{t=x.trim()?JSON.parse(x):{}}catch(e){V.Z.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t,litellm_credential_name:e.litellm_credential_name},l=L(e.custom_llm_provider).reduce((t,r)=>(t[r.name]=e[r.name],t),{});r.litellm_params=l,await (0,i.vectorStoreCreateCall)(n,r),V.Z.success("Vector store created successfully"),d.resetFields(),m("{}"),s()}catch(e){console.error("Error creating vector store:",e),V.Z.fromBackend("Error creating vector store: "+e)}},j=()=>{d.resetFields(),m("{}"),u("bedrock"),r()};return(0,a.jsx)(N.Z,{title:"Add New Vector Store",visible:t,width:1e3,footer:null,onCancel:j,children:(0,a.jsxs)(b.Z,{form:d,onFinish:p,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Provider"," ",(0,a.jsx)(v.Z,{title:"Select the provider for this vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],initialValue:"bedrock",children:(0,a.jsx)(w.default,{onChange:e=>u(e),children:Object.entries(l).map(e=>{let[t,r]=e;return(0,a.jsx)(w.default.Option,{value:I[t],children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("img",{src:A[r],alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let t=e.target,s=t.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=r.charAt(0),s.replaceChild(e,t)}}}),(0,a.jsx)("span",{children:r})]})},t)})})}),"pg_vector"===h&&(0,a.jsx)(Z.Z,{message:"PG Vector Setup Required",description:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:"LiteLLM provides a server to connect to PG Vector. To use this provider:"}),(0,a.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,a.jsxs)("li",{children:["Deploy the litellm-pgvector server from:"," ",(0,a.jsx)("a",{href:"https://github.com/BerriAI/litellm-pgvector",target:"_blank",rel:"noopener noreferrer",children:"https://github.com/BerriAI/litellm-pgvector"})]}),(0,a.jsx)("li",{children:"Configure your PostgreSQL database with pgvector extension"}),(0,a.jsx)("li",{children:"Start the server and note the API base URL and API key"}),(0,a.jsx)("li",{children:"Enter those details in the fields below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),"vertex_rag_engine"===h&&(0,a.jsx)(Z.Z,{message:"Vertex AI RAG Engine Setup",description:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:"To use Vertex AI RAG Engine:"}),(0,a.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,a.jsxs)("li",{children:["Set up your Vertex AI RAG Engine corpus following the guide:"," ",(0,a.jsx)("a",{href:"https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/rag-overview",target:"_blank",rel:"noopener noreferrer",children:"Vertex AI RAG Engine Overview"})]}),(0,a.jsx)("li",{children:"Create a corpus in your Google Cloud project"}),(0,a.jsx)("li",{children:"Note the corpus ID from the Vertex AI console"}),(0,a.jsx)("li",{children:"Enter the corpus ID in the Vector Store ID field below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Vector Store ID"," ",(0,a.jsx)(v.Z,{title:"Enter the vector store ID from your api provider",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"vector_store_id",rules:[{required:!0,message:"Please input the vector store ID from your api provider"}],children:(0,a.jsx)(y.o,{placeholder:"vertex_rag_engine"===h?"6917529027641081856 (Get corpus ID from Vertex AI console)":"Enter vector store ID from your provider"})}),L(h).map(e=>(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:[e.label," ",(0,a.jsx)(v.Z,{title:e.tooltip,children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:e.name,rules:e.required?[{required:!0,message:"Please input the ".concat(e.label.toLowerCase())}]:[],children:(0,a.jsx)(y.o,{type:e.type||"text",placeholder:e.placeholder})},e.name)),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Vector Store Name"," ",(0,a.jsx)(v.Z,{title:"Custom name you want to give to the vector store, this name will be rendered on the LiteLLM UI",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"vector_store_name",children:(0,a.jsx)(y.o,{})}),(0,a.jsx)(b.Z.Item,{label:"Description",name:"vector_store_description",children:(0,a.jsx)(S.default.TextArea,{rows:4})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Existing Credentials"," ",(0,a.jsx)(v.Z,{title:"Optionally select API provider credentials for this vector store eg. Bedrock API KEY",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"litellm_credential_name",children:(0,a.jsx)(w.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>{var r;return(null!==(r=null==t?void 0:t.label)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...c.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Metadata"," ",(0,a.jsx)(v.Z,{title:"JSON metadata for the vector store (optional)",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),children:(0,a.jsx)(S.default.TextArea,{rows:4,value:x,onChange:e=>m(e.target.value),placeholder:'{"key": "value"}'})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-3",children:[(0,a.jsx)(y.z,{onClick:j,variant:"secondary",children:"Cancel"}),(0,a.jsx)(y.z,{variant:"primary",type:"submit",children:"Create"})]})]})})},P=r(16312),O=e=>{let{isVisible:t,onCancel:r,onConfirm:s}=e;return(0,a.jsxs)(N.Z,{title:"Delete Vector Store",visible:t,footer:null,onCancel:r,children:[(0,a.jsx)("p",{children:"Are you sure you want to delete this vector store? This action cannot be undone."}),(0,a.jsxs)("div",{className:"px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(P.z,{onClick:s,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(P.z,{onClick:r,variant:"primary",children:"Cancel"})]})]})},z=r(41649),R=r(20831),B=r(12514),T=r(12485),q=r(18135),F=r(35242),J=r(29706),M=r(77991),K=r(84264),G=r(96761),U=r(73002),Q=r(10900),H=r(93192),Y=r(42264),X=r(67960),W=r(23496),$=r(87908),ee=r(44625),et=r(70464),er=r(77565),es=r(61935),el=r(23907);let{TextArea:ea}=S.default,{Text:eo,Title:en}=H.default;var ec=e=>{let{vectorStoreId:t,accessToken:r,className:s=""}=e,[l,n]=(0,o.useState)(""),[c,d]=(0,o.useState)(!1),[x,m]=(0,o.useState)([]),[h,u]=(0,o.useState)({}),p=async()=>{if(!l.trim()){Y.ZP.warning("Please enter a search query");return}d(!0);try{let e=await (0,i.vectorStoreSearchCall)(r,t,l),s={query:l,response:e,timestamp:Date.now()};m(e=>[s,...e]),n("")}catch(e){console.error("Error searching vector store:",e),V.Z.fromBackend("Failed to search vector store")}finally{d(!1)}},v=e=>new Date(e).toLocaleString(),j=(e,t)=>{let r="".concat(e,"-").concat(t);u(e=>({...e,[r]:!e[r]}))};return(0,a.jsx)(X.Z,{className:"w-full rounded-xl shadow-md",children:(0,a.jsxs)("div",{className:"flex flex-col h-[600px]",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(ee.Z,{className:"mr-2 text-blue-500"}),(0,a.jsx)(en,{level:4,className:"mb-0",children:"Test Vector Store"})]}),x.length>0&&(0,a.jsx)(U.ZP,{onClick:()=>{m([]),u({}),V.Z.success("Search history cleared")},size:"small",children:"Clear History"})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===x.length?(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)(ee.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,a.jsx)(eo,{children:"Test your vector store by entering a search query below"})]}):(0,a.jsx)("div",{className:"space-y-4",children:x.map((e,t)=>{var r;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-right",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-blue-50 border border-blue-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("strong",{className:"text-sm",children:"Query"}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:v(e.timestamp)})]}),(0,a.jsx)("div",{className:"text-left",children:e.query})]})}),(0,a.jsx)("div",{className:"text-left",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-white border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)(ee.Z,{className:"text-green-500"}),(0,a.jsx)("strong",{className:"text-sm",children:"Vector Store Results"}),e.response&&(0,a.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600",children:[(null===(r=e.response.data)||void 0===r?void 0:r.length)||0," results"]})]}),e.response&&e.response.data&&e.response.data.length>0?(0,a.jsx)("div",{className:"space-y-3",children:e.response.data.map((e,r)=>{let s=h["".concat(t,"-").concat(r)]||!1;return(0,a.jsxs)("div",{className:"border rounded-lg overflow-hidden bg-gray-50",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center p-3 cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>j(t,r),children:[(0,a.jsxs)("div",{className:"flex items-center",children:[s?(0,a.jsx)(et.Z,{className:"text-gray-500 mr-2"}):(0,a.jsx)(er.Z,{className:"text-gray-500 mr-2"}),(0,a.jsxs)("span",{className:"font-medium text-sm",children:["Result ",r+1]}),!s&&e.content&&e.content[0]&&(0,a.jsxs)("span",{className:"ml-2 text-xs text-gray-500 truncate max-w-md",children:["- ",e.content[0].text.substring(0,100),"..."]})]}),(0,a.jsxs)("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:["Score: ",e.score.toFixed(4)]})]}),s&&(0,a.jsxs)("div",{className:"border-t bg-white p-3",children:[e.content&&e.content.map((e,t)=>(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsxs)("div",{className:"text-xs text-gray-500 mb-1",children:["Content (",e.type,")"]}),(0,a.jsx)("div",{className:"text-sm bg-gray-50 p-3 rounded border text-gray-800 max-h-40 overflow-y-auto",children:e.text})]},t)),(e.file_id||e.filename||e.attributes)&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:[(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-2 font-medium",children:"Metadata"}),(0,a.jsxs)("div",{className:"space-y-2 text-xs",children:[e.file_id&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium",children:"File ID:"})," ",e.file_id]}),e.filename&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium",children:"Filename:"})," ",e.filename]}),e.attributes&&Object.keys(e.attributes).length>0&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium block mb-1",children:"Attributes:"}),(0,a.jsx)("pre",{className:"text-xs bg-white p-2 rounded border overflow-x-auto",children:JSON.stringify(e.attributes,null,2)})]})]})]})]})]},r)})}):(0,a.jsx)("div",{className:"text-gray-500 text-sm",children:"No results found"})]})}),tn(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),p())},placeholder:"Enter your search query... (Shift+Enter for new line)",disabled:c,autoSize:{minRows:1,maxRows:4},style:{resize:"none"}})}),(0,a.jsx)(U.ZP,{type:"primary",onClick:p,disabled:c||!l.trim(),icon:(0,a.jsx)(el.Z,{}),loading:c,children:"Search"})]})})]})})},ei=e=>{let{vectorStoreId:t,onClose:r,accessToken:s,is_admin:l,editVectorStore:n}=e,[c]=b.Z.useForm(),[d,x]=(0,o.useState)(null),[m,h]=(0,o.useState)(n),[u,p]=(0,o.useState)("{}"),[j,g]=(0,o.useState)([]),[_,y]=(0,o.useState)("details"),N=async()=>{if(s)try{let e=await (0,i.vectorStoreInfoCall)(s,t);if(e&&e.vector_store){if(x(e.vector_store),e.vector_store.vector_store_metadata){let t="string"==typeof e.vector_store.vector_store_metadata?JSON.parse(e.vector_store.vector_store_metadata):e.vector_store.vector_store_metadata;p(JSON.stringify(t,null,2))}n&&c.setFieldsValue({vector_store_id:e.vector_store.vector_store_id,custom_llm_provider:e.vector_store.custom_llm_provider,vector_store_name:e.vector_store.vector_store_name,vector_store_description:e.vector_store.vector_store_description})}}catch(e){console.error("Error fetching vector store details:",e),V.Z.fromBackend("Error fetching vector store details: "+e)}},Z=async()=>{if(s)try{let e=await (0,i.credentialListCall)(s);console.log("List credentials response:",e),g(e.credentials||[])}catch(e){console.error("Error fetching credentials:",e)}};(0,o.useEffect)(()=>{N(),Z()},[t,s]);let I=async e=>{if(s)try{let t={};try{t=u?JSON.parse(u):{}}catch(e){V.Z.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t};await (0,i.vectorStoreUpdateCall)(s,r),V.Z.success("Vector store updated successfully"),h(!1),N()}catch(e){console.error("Error updating vector store:",e),V.Z.fromBackend("Error updating vector store: "+e)}};return d?(0,a.jsxs)("div",{className:"p-4 max-w-full",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(R.Z,{icon:Q.Z,variant:"light",className:"mb-4",onClick:r,children:"Back to Vector Stores"}),(0,a.jsxs)(G.Z,{children:["Vector Store ID: ",d.vector_store_id]}),(0,a.jsx)(K.Z,{className:"text-gray-500",children:d.vector_store_description||"No description"})]}),l&&!m&&(0,a.jsx)(R.Z,{onClick:()=>h(!0),children:"Edit Vector Store"})]}),(0,a.jsxs)(q.Z,{children:[(0,a.jsxs)(F.Z,{className:"mb-6",children:[(0,a.jsx)(T.Z,{children:"Details"}),(0,a.jsx)(T.Z,{children:"Test Vector Store"})]}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(J.Z,{children:m?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,a.jsx)(G.Z,{children:"Edit Vector Store"})}),(0,a.jsx)(B.Z,{children:(0,a.jsxs)(b.Z,{form:c,onFinish:I,layout:"vertical",initialValues:d,children:[(0,a.jsx)(b.Z.Item,{label:"Vector Store ID",name:"vector_store_id",rules:[{required:!0,message:"Please input a vector store ID"}],children:(0,a.jsx)(S.default,{disabled:!0})}),(0,a.jsx)(b.Z.Item,{label:"Vector Store Name",name:"vector_store_name",children:(0,a.jsx)(S.default,{})}),(0,a.jsx)(b.Z.Item,{label:"Description",name:"vector_store_description",children:(0,a.jsx)(S.default.TextArea,{rows:4})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Provider"," ",(0,a.jsx)(v.Z,{title:"Select the provider for this vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,a.jsx)(w.default,{children:Object.entries(f.Cl).map(e=>{let[t,r]=e;return"Bedrock"===t?(0,a.jsx)(w.default.Option,{value:f.fK[t],children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("img",{src:f.cd[r],alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let t=e.target,s=t.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=r.charAt(0),s.replaceChild(e,t)}}}),(0,a.jsx)("span",{children:r})]})},t):null})})}),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(K.Z,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter provider credentials below"})}),(0,a.jsx)(b.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",children:(0,a.jsx)(w.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>{var r;return(null!==(r=null==t?void 0:t.label)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...j.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,a.jsxs)("div",{className:"flex items-center my-4",children:[(0,a.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,a.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,a.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Metadata"," ",(0,a.jsx)(v.Z,{title:"JSON metadata for the vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),children:(0,a.jsx)(S.default.TextArea,{rows:4,value:u,onChange:e=>p(e.target.value),placeholder:'{"key": "value"}'})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,a.jsx)(U.ZP,{onClick:()=>h(!1),children:"Cancel"}),(0,a.jsx)(U.ZP,{type:"primary",htmlType:"submit",children:"Save Changes"})]})]})})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(G.Z,{children:"Vector Store Details"}),l&&(0,a.jsx)(R.Z,{onClick:()=>h(!0),children:"Edit Vector Store"})]}),(0,a.jsx)(B.Z,{children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"ID"}),(0,a.jsx)(K.Z,{children:d.vector_store_id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Name"}),(0,a.jsx)(K.Z,{children:d.vector_store_name||"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Description"}),(0,a.jsx)(K.Z,{children:d.vector_store_description||"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Provider"}),(0,a.jsx)("div",{className:"flex items-center space-x-2 mt-1",children:(()=>{let e=d.custom_llm_provider||"bedrock",{displayName:t,logo:r}=(()=>{let t=Object.keys(f.fK).find(t=>f.fK[t].toLowerCase()===e.toLowerCase());if(!t)return{displayName:e,logo:""};let r=f.Cl[t],s=f.cd[r];return{displayName:r,logo:s}})();return(0,a.jsxs)(a.Fragment,{children:[r&&(0,a.jsx)("img",{src:r,alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let r=e.target,s=r.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,r)}}}),(0,a.jsx)(z.Z,{color:"blue",children:t})]})})()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Metadata"}),(0,a.jsx)("div",{className:"bg-gray-50 p-3 rounded mt-2 font-mono text-xs overflow-auto max-h-48",children:(0,a.jsx)("pre",{children:u})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Created"}),(0,a.jsx)(K.Z,{children:d.created_at?new Date(d.created_at).toLocaleString():"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Last Updated"}),(0,a.jsx)(K.Z,{children:d.updated_at?new Date(d.updated_at).toLocaleString():"-"})]})]})})]})}),(0,a.jsx)(J.Z,{children:(0,a.jsx)(ec,{vectorStoreId:d.vector_store_id,accessToken:s||""})})]})]})]}):(0,a.jsx)("div",{children:"Loading..."})},ed=r(20347),ex=e=>{let{accessToken:t,userID:r,userRole:s}=e,[l,d]=(0,o.useState)([]),[x,m]=(0,o.useState)(!1),[h,u]=(0,o.useState)(!1),[p,v]=(0,o.useState)(null),[j,g]=(0,o.useState)(""),[f,y]=(0,o.useState)([]),[b,N]=(0,o.useState)(null),[w,Z]=(0,o.useState)(!1),S=async()=>{if(t)try{let e=await (0,i.vectorStoreListCall)(t);console.log("List vector stores response:",e),d(e.data||[])}catch(e){console.error("Error fetching vector stores:",e),V.Z.fromBackend("Error fetching vector stores: "+e)}},C=async()=>{if(t)try{let e=await (0,i.credentialListCall)(t);console.log("List credentials response:",e),y(e.credentials||[])}catch(e){console.error("Error fetching credentials:",e),V.Z.fromBackend("Error fetching credentials: "+e)}},I=async e=>{v(e),u(!0)},k=async()=>{if(t&&p){try{await (0,i.vectorStoreDeleteCall)(t,p),V.Z.success("Vector store deleted successfully"),S()}catch(e){console.error("Error deleting vector store:",e),V.Z.fromBackend("Error deleting vector store: "+e)}u(!1),v(null)}};return(0,o.useEffect)(()=>{S(),C()},[t]),b?(0,a.jsx)("div",{className:"w-full h-full",children:(0,a.jsx)(ei,{vectorStoreId:b,onClose:()=>{N(null),Z(!1),S()},accessToken:t,is_admin:(0,ed.tY)(s||""),editVectorStore:w})}):(0,a.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,a.jsxs)("div",{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)("div",{className:"flex justify-between mt-2 w-full items-center mb-4",children:[(0,a.jsx)("h1",{children:"Vector Store Management"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[j&&(0,a.jsxs)(n.xv,{children:["Last Refreshed: ",j]}),(0,a.jsx)(n.JO,{icon:c.Z,variant:"shadow",size:"xs",className:"self-center cursor-pointer",onClick:()=>{S(),C(),g(new Date().toLocaleString())}})]})]}),(0,a.jsx)(n.xv,{className:"mb-4",children:(0,a.jsx)("p",{children:"You can use vector stores to store and retrieve LLM embeddings.."})}),(0,a.jsx)(n.zx,{className:"mb-4",onClick:()=>m(!0),children:"+ Add Vector Store"}),(0,a.jsx)(n.rj,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,a.jsx)(n.JX,{numColSpan:1,children:(0,a.jsx)(_,{data:l,onView:e=>{N(e),Z(!1)},onEdit:e=>{N(e),Z(!0)},onDelete:I})})}),(0,a.jsx)(D,{isVisible:x,onCancel:()=>m(!1),onSuccess:()=>{m(!1),S()},accessToken:t,credentials:f}),(0,a.jsx)(O,{isVisible:h,onCancel:()=>u(!1),onConfirm:k})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7526-64e8890047228caf.js b/litellm/proxy/_experimental/out/_next/static/chunks/7526-64e8890047228caf.js index 8e1809ac4f..7105f9f1cd 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/7526-64e8890047228caf.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/7526-64e8890047228caf.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7526],{19130:function(e,t,n){n.d(t,{RM:function(){return s.Z},SC:function(){return l.Z},iA:function(){return a.Z},pj:function(){return r.Z},ss:function(){return i.Z},xs:function(){return o.Z}});var a=n(21626),s=n(97214),r=n(28241),i=n(58834),o=n(69552),l=n(71876)},88658:function(e,t,n){n.d(t,{L:function(){return s}});var a=n(49817);let s=e=>{let t;let{apiKeySource:n,accessToken:s,apiKey:r,inputMessage:i,chatHistory:o,selectedTags:l,selectedVectorStores:c,selectedGuardrails:d,selectedMCPTools:m,selectedVoice:p,endpointType:u,selectedModel:g,selectedSdk:h}=e,x="session"===n?s:r,f=window.location.origin,_=i||"Your prompt here",b=_.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n"),j=o.filter(e=>!e.isImage).map(e=>{let{role:t,content:n}=e;return{role:t,content:n}}),v={};l.length>0&&(v.tags=l),c.length>0&&(v.vector_stores=c),d.length>0&&(v.guardrails=d);let y=g||"your-model-name",N="azure"===h?'import openai\n\nclient = openai.AzureOpenAI(\n api_key="'.concat(x||"YOUR_LITELLM_API_KEY",'",\n azure_endpoint="').concat(f,'",\n api_version="2024-02-01"\n)'):'import openai\n\nclient = openai.OpenAI(\n api_key="'.concat(x||"YOUR_LITELLM_API_KEY",'",\n base_url="').concat(f,'"\n)');switch(u){case a.KP.CHAT:{let e=Object.keys(v).length>0,n="";if(e){let e=JSON.stringify({metadata:v},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();n=",\n extra_body=".concat(e)}let a=j.length>0?j:[{role:"user",content:_}];t='\nimport base64\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# Example with text only\nresponse = client.chat.completions.create(\n model="'.concat(y,'",\n messages=').concat(JSON.stringify(a,null,4)).concat(n,'\n)\n\nprint(response)\n\n# Example with image or PDF (uncomment and provide file path to use)\n# base64_file = encode_image("path/to/your/file.jpg") # or .pdf\n# response_with_file = client.chat.completions.create(\n# model="').concat(y,'",\n# messages=[\n# {\n# "role": "user",\n# "content": [\n# {\n# "type": "text",\n# "text": "').concat(b,'"\n# },\n# {\n# "type": "image_url",\n# "image_url": {\n# "url": f"data:image/jpeg;base64,{base64_file}" # or data:application/pdf;base64,{base64_file}\n# }\n# }\n# ]\n# }\n# ]').concat(n,"\n# )\n# print(response_with_file)\n");break}case a.KP.RESPONSES:{let e=Object.keys(v).length>0,n="";if(e){let e=JSON.stringify({metadata:v},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();n=",\n extra_body=".concat(e)}let a=j.length>0?j:[{role:"user",content:_}];t='\nimport base64\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# Example with text only\nresponse = client.responses.create(\n model="'.concat(y,'",\n input=').concat(JSON.stringify(a,null,4)).concat(n,'\n)\n\nprint(response.output_text)\n\n# Example with image or PDF (uncomment and provide file path to use)\n# base64_file = encode_image("path/to/your/file.jpg") # or .pdf\n# response_with_file = client.responses.create(\n# model="').concat(y,'",\n# input=[\n# {\n# "role": "user",\n# "content": [\n# {"type": "input_text", "text": "').concat(b,'"},\n# {\n# "type": "input_image",\n# "image_url": f"data:image/jpeg;base64,{base64_file}", # or data:application/pdf;base64,{base64_file}\n# },\n# ],\n# }\n# ]').concat(n,"\n# )\n# print(response_with_file.output_text)\n");break}case a.KP.IMAGE:t="azure"===h?"\n# NOTE: The Azure SDK does not have a direct equivalent to the multi-modal 'responses.create' method shown for OpenAI.\n# This snippet uses 'client.images.generate' and will create a new image based on your prompt.\n# It does not use the uploaded image, as 'client.images.generate' does not support image inputs in this context.\nimport os\nimport requests\nimport json\nimport time\nfrom PIL import Image\n\nresult = client.images.generate(\n model=\"".concat(y,'",\n prompt="').concat(i,'",\n n=1\n)\n\njson_response = json.loads(result.model_dump_json())\n\n# Set the directory for the stored image\nimage_dir = os.path.join(os.curdir, \'images\')\n\n# If the directory doesn\'t exist, create it\nif not os.path.isdir(image_dir):\n os.mkdir(image_dir)\n\n# Initialize the image path\nimage_filename = f"generated_image_{int(time.time())}.png"\nimage_path = os.path.join(image_dir, image_filename)\n\ntry:\n # Retrieve the generated image\n if json_response.get("data") && len(json_response["data"]) > 0 && json_response["data"][0].get("url"):\n image_url = json_response["data"][0]["url"]\n generated_image = requests.get(image_url).content\n with open(image_path, "wb") as image_file:\n image_file.write(generated_image)\n\n print(f"Image saved to {image_path}")\n # Display the image\n image = Image.open(image_path)\n image.show()\n else:\n print("Could not find image URL in response.")\n print("Full response:", json_response)\nexcept Exception as e:\n print(f"An error occurred: {e}")\n print("Full response:", json_response)\n'):"\nimport base64\nimport os\nimport time\nimport json\nfrom PIL import Image\nimport requests\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, \"rb\") as image_file:\n return base64.b64encode(image_file.read()).decode('utf-8')\n\n# Helper function to create a file (simplified for this example)\ndef create_file(image_path):\n # In a real implementation, this would upload the file to OpenAI\n # For this example, we'll just return a placeholder ID\n return f\"file_{os.path.basename(image_path).replace('.', '_')}\"\n\n# The prompt entered by the user\nprompt = \"".concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n');break;case a.KP.IMAGE_EDITS:t="azure"===h?'\nimport base64\nimport os\nimport time\nimport json\nfrom PIL import Image\nimport requests\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# The prompt entered by the user\nprompt = "'.concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n'):"\nimport base64\nimport os\nimport time\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, \"rb\") as image_file:\n return base64.b64encode(image_file.read()).decode('utf-8')\n\n# Helper function to create a file (simplified for this example)\ndef create_file(image_path):\n # In a real implementation, this would upload the file to OpenAI\n # For this example, we'll just return a placeholder ID\n return f\"file_{os.path.basename(image_path).replace('.', '_')}\"\n\n# The prompt entered by the user\nprompt = \"".concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n');break;case a.KP.EMBEDDINGS:t='\nresponse = client.embeddings.create(\n input="'.concat(i||"Your string here",'",\n model="').concat(y,'",\n encoding_format="base64" # or "float"\n)\n\nprint(response.data[0].embedding)\n');break;case a.KP.TRANSCRIPTION:t='\n# Open the audio file\naudio_file = open("path/to/your/audio/file.mp3", "rb")\n\n# Make the transcription request\nresponse = client.audio.transcriptions.create(\n model="'.concat(y,'",\n file=audio_file').concat(i?',\n prompt="'.concat(i.replace(/"/g,'\\"'),'"'):"","\n)\n\nprint(response.text)\n");break;case a.KP.SPEECH:t='\n# Make the text-to-speech request\nresponse = client.audio.speech.create(\n model="'.concat(y,'",\n input="').concat(i||"Your text to convert to speech here",'",\n voice="').concat(p,'" # Options: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer\n)\n\n# Save the audio to a file\noutput_filename = "output_speech.mp3"\nresponse.stream_to_file(output_filename)\nprint(f"Audio saved to {output_filename}")\n\n# Optional: Customize response format and speed\n# response = client.audio.speech.create(\n# model="').concat(y,'",\n# input="').concat(i||"Your text to convert to speech here",'",\n# voice="alloy",\n# response_format="mp3", # Options: mp3, opus, aac, flac, wav, pcm\n# speed=1.0 # Range: 0.25 to 4.0\n# )\n# response.stream_to_file("output_speech.mp3")\n');break;default:t="\n# Code generation for this endpoint is not implemented yet."}return"".concat(N,"\n").concat(t)}},49817:function(e,t,n){var a,s,r,i;n.d(t,{KP:function(){return s},vf:function(){return l}}),(r=a||(a={})).AUDIO_SPEECH="audio_speech",r.AUDIO_TRANSCRIPTION="audio_transcription",r.IMAGE_GENERATION="image_generation",r.VIDEO_GENERATION="video_generation",r.CHAT="chat",r.RESPONSES="responses",r.IMAGE_EDITS="image_edits",r.ANTHROPIC_MESSAGES="anthropic_messages",(i=s||(s={})).IMAGE="image",i.VIDEO="video",i.CHAT="chat",i.RESPONSES="responses",i.IMAGE_EDITS="image_edits",i.ANTHROPIC_MESSAGES="anthropic_messages",i.EMBEDDINGS="embeddings",i.SPEECH="speech",i.TRANSCRIPTION="transcription";let o={image_generation:"image",video_generation:"video",chat:"chat",responses:"responses",image_edits:"image_edits",anthropic_messages:"anthropic_messages",audio_speech:"speech",audio_transcription:"transcription"},l=e=>{if(console.log("getEndpointType:",e),Object.values(a).includes(e)){let t=o[e];return console.log("endpointType:",t),t}return"chat"}},8048:function(e,t,n){n.d(t,{C:function(){return m}});var a=n(57437),s=n(71594),r=n(24525),i=n(2265),o=n(19130),l=n(44633),c=n(86462),d=n(49084);function m(e){let{data:t=[],columns:n,isLoading:m=!1,table:p,defaultSorting:u=[]}=e,[g,h]=i.useState(u),[x]=i.useState("onChange"),[f,_]=i.useState({}),[b,j]=i.useState({}),v=(0,s.b7)({data:t,columns:n,state:{sorting:g,columnSizing:f,columnVisibility:b},columnResizeMode:x,onSortingChange:h,onColumnSizingChange:_,onColumnVisibilityChange:j,getCoreRowModel:(0,r.sC)(),getSortedRowModel:(0,r.tj)(),enableSorting:!0,enableColumnResizing:!0,defaultColumn:{minSize:40,maxSize:500}});return i.useEffect(()=>{p&&(p.current=v)},[v,p]),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("div",{className:"relative min-w-full",children:(0,a.jsxs)(o.iA,{className:"[&_td]:py-2 [&_th]:py-2 w-full",children:[(0,a.jsx)(o.ss,{children:v.getHeaderGroups().map(e=>(0,a.jsx)(o.SC,{children:e.headers.map(e=>{var t;return(0,a.jsxs)(o.xs,{className:"py-1 h-8 relative ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(t=e.column.columnDef.meta)||void 0===t?void 0:t.className)||""),style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,s.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(l.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"})})]}),e.column.getCanResize()&&(0,a.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ".concat(e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200")})]},e.id)})},e.id))}),(0,a.jsx)(o.RM,{children:m?(0,a.jsx)(o.SC,{children:(0,a.jsx)(o.pj,{colSpan:n.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"\uD83D\uDE85 Loading models..."})})})}):v.getRowModel().rows.length>0?v.getRowModel().rows.map(e=>(0,a.jsx)(o.SC,{children:e.getVisibleCells().map(e=>{var t;return(0,a.jsx)(o.pj,{className:"py-0.5 ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(t=e.column.columnDef.meta)||void 0===t?void 0:t.className)||""),style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,s.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)):(0,a.jsx)(o.SC,{children:(0,a.jsx)(o.pj,{colSpan:n.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No models found"})})})})})]})})})})}},65373:function(e,t,n){n.d(t,{Z:function(){return v}});var a=n(57437),s=n(27648),r=n(2265),i=n(89970),o=n(63709),l=n(80795),c=n(19250),d=n(15883),m=n(46346),p=n(57400),u=n(91870),g=n(40428),h=n(83884),x=n(45524),f=n(3914);let _=async e=>{if(!e)return null;try{return await (0,c.getProxyUISettings)(e)}catch(e){return console.error("Error fetching proxy settings:",e),null}};var b=n(69734),j=n(31857),v=e=>{let{userID:t,userEmail:n,userRole:v,premiumUser:y,proxySettings:N,setProxySettings:w,accessToken:I,isPublicPage:A=!1,sidebarCollapsed:S=!1,onToggleSidebar:k}=e,C=(0,c.getProxyBaseUrl)(),[E,Z]=(0,r.useState)(""),{logoUrl:O}=(0,b.F)(),{refactoredUIFlag:T,setRefactoredUIFlag:M}=(0,j.Z)();(0,r.useEffect)(()=>{(async()=>{if(I){let e=await _(I);console.log("response from fetchProxySettings",e),e&&w(e)}})()},[I]),(0,r.useEffect)(()=>{Z((null==N?void 0:N.PROXY_LOGOUT_URL)||"")},[N]);let P=[{key:"user-info",onClick:e=>{var t;return null===(t=e.domEvent)||void 0===t?void 0:t.stopPropagation()},label:(0,a.jsxs)("div",{className:"px-3 py-3 border-b border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-2 text-gray-700"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:t})]}),y?(0,a.jsx)(i.Z,{title:"Premium User",placement:"left",children:(0,a.jsxs)("div",{className:"flex items-center bg-gradient-to-r from-amber-500 to-yellow-500 text-white px-2 py-0.5 rounded-full cursor-help",children:[(0,a.jsx)(m.Z,{className:"mr-1 text-xs"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Premium"})]})}):(0,a.jsx)(i.Z,{title:"Upgrade to Premium for advanced features",placement:"left",children:(0,a.jsxs)("div",{className:"flex items-center bg-gray-100 text-gray-500 px-2 py-0.5 rounded-full cursor-help",children:[(0,a.jsx)(m.Z,{className:"mr-1 text-xs"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Standard"})]})})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center text-sm",children:[(0,a.jsx)(p.Z,{className:"mr-2 text-gray-400 text-xs"}),(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Role"}),(0,a.jsx)("span",{className:"ml-auto text-gray-700 font-medium",children:v})]}),(0,a.jsxs)("div",{className:"flex items-center text-sm",children:[(0,a.jsx)(u.Z,{className:"mr-2 text-gray-400 text-xs"}),(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Email"}),(0,a.jsx)("span",{className:"ml-auto text-gray-700 font-medium truncate max-w-[150px]",title:n||"Unknown",children:n||"Unknown"})]}),(0,a.jsxs)("div",{className:"flex items-center text-sm pt-2 mt-2 border-t border-gray-100",children:[(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Refactored UI"}),(0,a.jsx)(o.Z,{className:"ml-auto",size:"small",checked:T,onChange:e=>M(e),"aria-label":"Toggle refactored UI feature flag"})]})]})]})},{key:"logout",label:(0,a.jsxs)("div",{className:"flex items-center py-2 px-3 hover:bg-gray-50 rounded-md mx-1 my-1",onClick:()=>{(0,f.b)(),window.location.href=E},children:[(0,a.jsx)(g.Z,{className:"mr-3 text-gray-600"}),(0,a.jsx)("span",{className:"text-gray-800",children:"Logout"})]})}];return(0,a.jsx)("nav",{className:"bg-white border-b border-gray-200 sticky top-0 z-10",children:(0,a.jsx)("div",{className:"w-full",children:(0,a.jsxs)("div",{className:"flex items-center h-14 px-4",children:[" ",(0,a.jsxs)("div",{className:"flex items-center flex-shrink-0",children:[k&&(0,a.jsx)("button",{onClick:k,className:"flex items-center justify-center w-10 h-10 mr-2 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded transition-colors",title:S?"Expand sidebar":"Collapse sidebar",children:(0,a.jsx)("span",{className:"text-lg",children:S?(0,a.jsx)(h.Z,{}):(0,a.jsx)(x.Z,{})})}),(0,a.jsx)(s.default,{href:"/",className:"flex items-center",children:(0,a.jsx)("img",{src:O||"".concat(C,"/get_image"),alt:"LiteLLM Brand",className:"h-10 w-auto"})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-5 ml-auto",children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 hover:text-gray-900 transition-colors",children:"Docs"}),!A&&(0,a.jsx)(l.Z,{menu:{items:P,className:"min-w-[200px]",style:{padding:"8px",marginTop:"8px",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.08)"}},overlayStyle:{minWidth:"200px"},children:(0,a.jsxs)("button",{className:"inline-flex items-center text-sm text-gray-600 hover:text-gray-900 transition-colors",children:["User",(0,a.jsx)("svg",{className:"ml-1 w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M19 9l-7 7-7-7"})})]})})]})]})})})}},42673:function(e,t,n){var a,s;n.d(t,{Cl:function(){return a},bK:function(){return d},cd:function(){return o},dr:function(){return l},fK:function(){return r},ph:function(){return c}}),(s=a||(a={})).AIML="AI/ML API",s.Bedrock="Amazon Bedrock",s.Anthropic="Anthropic",s.AssemblyAI="AssemblyAI",s.SageMaker="AWS SageMaker",s.Azure="Azure",s.Azure_AI_Studio="Azure AI Foundry (Studio)",s.Cerebras="Cerebras",s.Cohere="Cohere",s.Dashscope="Dashscope",s.Databricks="Databricks (Qwen API)",s.DeepInfra="DeepInfra",s.Deepgram="Deepgram",s.Deepseek="Deepseek",s.ElevenLabs="ElevenLabs",s.FalAI="Fal AI",s.FireworksAI="Fireworks AI",s.Google_AI_Studio="Google AI Studio",s.GradientAI="GradientAI",s.Groq="Groq",s.Hosted_Vllm="vllm",s.Infinity="Infinity",s.JinaAI="Jina AI",s.MistralAI="Mistral AI",s.Ollama="Ollama",s.OpenAI="OpenAI",s.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",s.OpenAI_Text="OpenAI Text Completion",s.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",s.Openrouter="Openrouter",s.Oracle="Oracle Cloud Infrastructure (OCI)",s.Perplexity="Perplexity",s.Sambanova="Sambanova",s.Snowflake="Snowflake",s.TogetherAI="TogetherAI",s.Triton="Triton",s.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",s.VolcEngine="VolcEngine",s.Voyage="Voyage AI",s.xAI="xAI";let r={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="/ui/assets/logos/",o={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},l=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:o[e],displayName:e}}let t=Object.keys(r).find(t=>r[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let n=a[t];return{logo:o[n],displayName:n}},c=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},d=(e,t)=>{console.log("Provider key: ".concat(e));let n=r[e];console.log("Provider mapped to: ".concat(n));let a=[];return e&&"object"==typeof t&&(Object.entries(t).forEach(e=>{let[t,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&(s.litellm_provider===n||s.litellm_provider.includes(n))&&a.push(t)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(t).forEach(e=>{let[t,n]=e;null!==n&&"object"==typeof n&&"litellm_provider"in n&&"cohere_chat"===n.litellm_provider&&a.push(t)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(t).forEach(e=>{let[t,n]=e;null!==n&&"object"==typeof n&&"litellm_provider"in n&&"sagemaker_chat"===n.litellm_provider&&a.push(t)}))),a}},87526:function(e,t,n){n.d(t,{Z:function(){return I}});var a=n(57437),s=n(2265),r=n(19250),i=n(8048),o=n(20831),l=n(12514),c=n(84264),d=n(96761),m=n(89970),p=n(3810),u=n(52787),g=n(82680),h=n(3477),x=n(17732),f=n(33245),_=n(78867),b=n(88658),j=n(49817),v=n(42673),y=n(65373),N=n(69734),w=n(9114),I=e=>{var t,n;let{accessToken:I}=e,[A,S]=(0,s.useState)(null),[k,C]=(0,s.useState)("LiteLLM Gateway"),[E,Z]=(0,s.useState)(null),[O,T]=(0,s.useState)(""),[M,P]=(0,s.useState)({}),[D,L]=(0,s.useState)(!0),[z,R]=(0,s.useState)(""),[F,G]=(0,s.useState)([]),[H,K]=(0,s.useState)([]),[V,U]=(0,s.useState)([]),[q,W]=(0,s.useState)("I'm alive! ✓"),[B,J]=(0,s.useState)(!1),[Y,$]=(0,s.useState)(null),[Q,X]=(0,s.useState)({}),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=async()=>{try{L(!0);let e=await (0,r.modelHubPublicModelsCall)();console.log("ModelHubData:",e),S(e)}catch(e){console.error("There was an error fetching the public model data",e),W("Service unavailable")}finally{L(!1)}};(async()=>{let e=await (0,r.getPublicModelHubInfo)();console.log("Public Model Hub Info:",e),C(e.docs_title),Z(e.custom_docs_description),T(e.litellm_version),P(e.useful_links||{})})(),e()},[]),(0,s.useEffect)(()=>{},[z,F,H,V]);let et=(0,s.useMemo)(()=>{if(!A)return[];let e=A;if(z.trim()){let t=z.toLowerCase(),n=t.split(/\s+/),a=A.filter(e=>{let a=e.model_group.toLowerCase();return!!a.includes(t)||n.every(e=>a.includes(e))});a.length>0&&(e=a.sort((e,n)=>{let a=e.model_group.toLowerCase(),s=n.model_group.toLowerCase(),r=a===t?1e3:0,i=s===t?1e3:0,o=a.startsWith(t)?100:0,l=s.startsWith(t)?100:0,c=t.split(/\s+/).every(e=>a.includes(e))?50:0,d=t.split(/\s+/).every(e=>s.includes(e))?50:0,m=a.length;return i+l+d+(1e3-s.length)-(r+o+c+(1e3-m))}))}return e.filter(e=>{let t=0===F.length||F.some(t=>e.providers.includes(t)),n=0===H.length||H.includes(e.mode||""),a=0===V.length||Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).some(e=>{let[t]=e,n=t.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");return V.includes(n)});return t&&n&&a})},[A,z,F,H,V]),en=e=>{$(e),J(!0)},ea=e=>{navigator.clipboard.writeText(e),w.Z.success("Copied to clipboard!")},es=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),er=e=>Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).map(e=>{let[t]=e;return t}),ei=e=>"$".concat((1e6*e).toFixed(4)),eo=e=>e?e>=1e3?"".concat((e/1e3).toFixed(0),"K"):e.toString():"N/A",el=(e,t)=>{let n=[];return e&&n.push("RPM: ".concat(e.toLocaleString())),t&&n.push("TPM: ".concat(t.toLocaleString())),n.length>0?n.join(", "):"N/A"};return(0,a.jsx)(N.f,{accessToken:I,children:(0,a.jsxs)("div",{className:"min-h-screen bg-white",children:[(0,a.jsx)(y.Z,{userID:null,userEmail:null,userRole:null,premiumUser:!1,setProxySettings:X,proxySettings:Q,accessToken:I||null,isPublicPage:!0}),(0,a.jsxs)("div",{className:"w-full px-8 py-12",children:[(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"About"}),(0,a.jsx)("p",{className:"text-gray-700 mb-6 text-base leading-relaxed",children:E||"Proxy Server to call 100+ LLMs in the OpenAI format."}),(0,a.jsx)("div",{className:"flex items-center space-x-3 text-sm text-gray-600",children:(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)("span",{className:"w-4 h-4 mr-2",children:"\uD83D\uDD27"}),"Built with litellm: v",O]})})]}),M&&Object.keys(M).length>0&&(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"Useful Links"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Object.entries(M||{}).map(e=>{let[t,n]=e;return(0,a.jsxs)("button",{onClick:()=>window.open(n,"_blank"),className:"flex items-center space-x-3 text-blue-600 hover:text-blue-800 transition-colors p-3 rounded-lg hover:bg-blue-50 border border-gray-200",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),(0,a.jsx)(c.Z,{className:"text-sm font-medium",children:t})]},t)})})]}),(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"Health and Endpoint Status"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:(0,a.jsxs)(c.Z,{className:"text-green-600 font-medium text-sm",children:["Service status: ",q]})})]}),(0,a.jsxs)(l.Z,{className:"p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-8",children:(0,a.jsx)(d.Z,{className:"text-2xl font-semibold text-gray-900",children:"Available Models"})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 mb-3",children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium text-gray-700",children:"Search Models:"}),(0,a.jsx)(m.Z,{title:"Smart search with relevance ranking - finds models containing your search terms, ranked by relevance. Try searching 'xai grok-4', 'claude-4', 'gpt-4', or 'sonnet'",placement:"top",children:(0,a.jsx)(f.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(x.Z,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names... (smart search enabled)",value:z,onChange:e=>R(e.target.value),className:"border border-gray-300 rounded-lg pl-10 pr-4 py-2 w-full text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Provider:"}),(0,a.jsx)(u.default,{mode:"multiple",value:F,onChange:e=>G(e),placeholder:"Select providers",className:"w-full",size:"large",allowClear:!0,optionRender:e=>{let{logo:t}=(0,v.dr)(e.value);return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,a.jsx)("img",{src:t,alt:e.label,className:"w-5 h-5 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e.label})]})},children:A&&(e=>{let t=new Set;return e.forEach(e=>{e.providers.forEach(e=>t.add(e))}),Array.from(t)})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Mode:"}),(0,a.jsx)(u.default,{mode:"multiple",value:H,onChange:e=>K(e),placeholder:"Select modes",className:"w-full",size:"large",allowClear:!0,children:A&&(e=>{let t=new Set;return e.forEach(e=>{e.mode&&t.add(e.mode)}),Array.from(t)})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Features:"}),(0,a.jsx)(u.default,{mode:"multiple",value:V,onChange:e=>U(e),placeholder:"Select features",className:"w-full",size:"large",allowClear:!0,children:A&&(e=>{let t=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).forEach(e=>{let[n]=e,a=n.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");t.add(a)})}),Array.from(t).sort()})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]})]}),(0,a.jsx)(i.C,{columns:[{header:"Model Name",accessorKey:"model_group",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsx)(m.Z,{title:t.original.model_group,children:(0,a.jsx)(o.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left",onClick:()=>en(t.original),children:t.original.model_group})})})},size:150},{header:"Providers",accessorKey:"providers",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.providers;return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:n.map(e=>{let{logo:t}=(0,v.dr)(e);return(0,a.jsxs)("div",{className:"flex items-center space-x-1 px-2 py-1 bg-gray-100 rounded text-xs",children:[t&&(0,a.jsx)("img",{src:t,alt:e,className:"w-3 h-3 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e})]},e)})})},size:120},{header:"Mode",accessorKey:"mode",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.mode;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:(e=>{switch(null==e?void 0:e.toLowerCase()){case"chat":return"\uD83D\uDCAC";case"rerank":return"\uD83D\uDD04";case"embedding":return"\uD83D\uDCC4";default:return"\uD83E\uDD16"}})(n||"")}),(0,a.jsx)(c.Z,{children:n||"Chat"})]})},size:100},{header:"Max Input",accessorKey:"max_input_tokens",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)(c.Z,{className:"text-center",children:eo(t.original.max_input_tokens)})},size:100,meta:{className:"text-center"}},{header:"Max Output",accessorKey:"max_output_tokens",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)(c.Z,{className:"text-center",children:eo(t.original.max_output_tokens)})},size:100,meta:{className:"text-center"}},{header:"Input $/1M",accessorKey:"input_cost_per_token",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.input_cost_per_token;return(0,a.jsx)(c.Z,{className:"text-center",children:n?ei(n):"Free"})},size:100,meta:{className:"text-center"}},{header:"Output $/1M",accessorKey:"output_cost_per_token",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.output_cost_per_token;return(0,a.jsx)(c.Z,{className:"text-center",children:n?ei(n):"Free"})},size:100,meta:{className:"text-center"}},{header:"Features",accessorKey:"supports_vision",enableSorting:!1,cell:e=>{let{row:t}=e,n=Object.entries(t.original).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).map(e=>{let[t]=e;return es(t)});return 0===n.length?(0,a.jsx)(c.Z,{className:"text-gray-400",children:"-"}):1===n.length?(0,a.jsx)("div",{className:"h-6 flex items-center",children:(0,a.jsx)(p.Z,{color:"blue",className:"text-xs",children:n[0]})}):(0,a.jsxs)("div",{className:"h-6 flex items-center space-x-1",children:[(0,a.jsx)(p.Z,{color:"blue",className:"text-xs",children:n[0]}),(0,a.jsx)(m.Z,{title:(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("div",{className:"font-medium",children:"All Features:"}),n.map((e,t)=>(0,a.jsxs)("div",{className:"text-xs",children:["• ",e]},t))]}),trigger:"click",placement:"topLeft",children:(0,a.jsxs)("span",{className:"text-xs text-blue-600 cursor-pointer hover:text-blue-800 hover:underline",onClick:e=>e.stopPropagation(),children:["+",n.length-1]})})]})},size:120},{header:"Limits",accessorKey:"rpm",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original;return(0,a.jsx)(c.Z,{className:"text-xs text-gray-600",children:el(n.rpm,n.tpm)})},size:150}],data:et,isLoading:D,table:ee,defaultSorting:[{id:"model_group",desc:!1}]}),(0,a.jsx)("div",{className:"mt-8 text-center",children:(0,a.jsxs)(c.Z,{className:"text-sm text-gray-600",children:["Showing ",et.length," of ",(null==A?void 0:A.length)||0," models"]})})]})]}),(0,a.jsx)(g.Z,{title:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:(null==Y?void 0:Y.model_group)||"Model Details"}),Y&&(0,a.jsx)(m.Z,{title:"Copy model name",children:(0,a.jsx)(_.Z,{onClick:()=>ea(Y.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 w-4 h-4"})})]}),width:1e3,open:B,footer:null,onOk:()=>{J(!1),$(null)},onCancel:()=>{J(!1),$(null)},children:Y&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Model Name:"}),(0,a.jsx)(c.Z,{children:Y.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(c.Z,{children:Y.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:Y.providers.map(e=>{let{logo:t}=(0,v.dr)(e);return(0,a.jsx)(p.Z,{color:"blue",children:(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[t&&(0,a.jsx)("img",{src:t,alt:e,className:"w-3 h-3 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e})]})},e)})})]})]}),Y.model_group.includes("*")&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4",children:(0,a.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,a.jsx)(f.Z,{className:"w-4 h-4 text-blue-600 mt-0.5 flex-shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium text-blue-900 mb-2",children:"Wildcard Routing"}),(0,a.jsxs)(c.Z,{className:"text-sm text-blue-800 mb-2",children:["This model uses wildcard routing. You can pass any value where you see the"," ",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:"*"})," symbol."]}),(0,a.jsxs)(c.Z,{className:"text-sm text-blue-800",children:["For example, with"," ",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:Y.model_group}),", you can use any string (",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:Y.model_group.replace("*","my-custom-value")}),") that matches this pattern."]})]})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(c.Z,{children:(null===(t=Y.max_input_tokens)||void 0===t?void 0:t.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(c.Z,{children:(null===(n=Y.max_output_tokens)||void 0===n?void 0:n.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(c.Z,{children:Y.input_cost_per_token?ei(Y.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(c.Z,{children:Y.output_cost_per_token?ei(Y.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=er(Y),t=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(c.Z,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,n)=>(0,a.jsx)(p.Z,{color:t[n%t.length],children:es(e)},e))})()})]}),(Y.tpm||Y.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[Y.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(c.Z,{children:Y.tpm.toLocaleString()})]}),Y.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(c.Z,{children:Y.rpm.toLocaleString()})]})]})]}),Y.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Y.supported_openai_params.map(e=>(0,a.jsx)(p.Z,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto",children:(0,a.jsx)("pre",{className:"text-sm",children:(0,b.L)({apiKeySource:"custom",accessToken:null,apiKey:"your_api_key",inputMessage:"Hello, how are you?",chatHistory:[{role:"user",content:"Hello, how are you?",isImage:!1}],selectedTags:[],selectedVectorStores:[],selectedGuardrails:[],selectedMCPTools:[],endpointType:(0,j.vf)(Y.mode||"chat"),selectedModel:Y.model_group,selectedSdk:"openai"})})}),(0,a.jsx)("div",{className:"mt-2 text-right",children:(0,a.jsx)("button",{onClick:()=>{ea((0,b.L)({apiKeySource:"custom",accessToken:null,apiKey:"your_api_key",inputMessage:"Hello, how are you?",chatHistory:[{role:"user",content:"Hello, how are you?",isImage:!1}],selectedTags:[],selectedVectorStores:[],selectedGuardrails:[],selectedMCPTools:[],endpointType:(0,j.vf)(Y.mode||"chat"),selectedModel:Y.model_group,selectedSdk:"openai"}))},className:"text-sm text-blue-600 hover:text-blue-800 cursor-pointer",children:"Copy to clipboard"})})]})]})})]})})}},69734:function(e,t,n){n.d(t,{F:function(){return o},f:function(){return l}});var a=n(57437),s=n(2265),r=n(19250);let i=(0,s.createContext)(void 0),o=()=>{let e=(0,s.useContext)(i);if(!e)throw Error("useTheme must be used within a ThemeProvider");return e},l=e=>{let{children:t,accessToken:n}=e,[o,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(async()=>{try{let t=(0,r.getProxyBaseUrl)(),n=await fetch(t?"".concat(t,"/get/ui_theme_settings"):"/get/ui_theme_settings",{method:"GET",headers:{"Content-Type":"application/json"}});if(n.ok){var e;let t=await n.json();(null===(e=t.values)||void 0===e?void 0:e.logo_url)&&l(t.values.logo_url)}}catch(e){console.warn("Failed to load logo settings from backend:",e)}})()},[]),(0,a.jsx)(i.Provider,{value:{logoUrl:o,setLogoUrl:l},children:t})}},31857:function(e,t,n){n.d(t,{FeatureFlagsProvider:function(){return m}});var a=n(57437),s=n(2265),r=n(99376),i=n(19250);let o=()=>{let e="ui/".replace(/^\/+|\/+$/g,""),t=e?"/".concat(e,"/"):"/";if(i.serverRootPath&&"/"!==i.serverRootPath){let e=i.serverRootPath.replace(/\/+$/,""),n=t.replace(/^\/+/,"");return"".concat(e,"/").concat(n)}return t},l="feature.refactoredUIFlag",c=(0,s.createContext)(null);function d(e){try{localStorage.setItem(l,String(e))}catch(e){}}let m=e=>{let{children:t}=e,n=(0,r.useRouter)(),[i,m]=(0,s.useState)(()=>(function(){try{let e=localStorage.getItem(l);if(null===e)return localStorage.setItem(l,"false"),!1;let t=e.trim().toLowerCase();if("true"===t||"1"===t)return!0;if("false"===t||"0"===t)return!1;let n=JSON.parse(e);if("boolean"==typeof n)return n;return localStorage.setItem(l,"false"),!1}catch(e){try{localStorage.setItem(l,"false")}catch(e){}return!1}})());return(0,s.useEffect)(()=>{let e=e=>{if(e.key===l&&null!=e.newValue){let t=e.newValue.trim().toLowerCase();m("true"===t||"1"===t)}e.key===l&&null===e.newValue&&(d(!1),m(!1))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[]),(0,s.useEffect)(()=>{if(i)return;let e=setTimeout(()=>{let e;let t=o(),a=(e=window.location.pathname).endsWith("/")?e:e+"/";a.includes("/ui")||a===t||n.replace(t)},100);return()=>clearTimeout(e)},[i,n]),(0,a.jsx)(c.Provider,{value:{refactoredUIFlag:i,setRefactoredUIFlag:e=>{m(e),d(e)}},children:t})};t.Z=()=>{let e=(0,s.useContext)(c);if(!e)throw Error("useFeatureFlags must be used within FeatureFlagsProvider");return e}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7526],{19130:function(e,t,n){n.d(t,{RM:function(){return s.Z},SC:function(){return l.Z},iA:function(){return a.Z},pj:function(){return r.Z},ss:function(){return i.Z},xs:function(){return o.Z}});var a=n(21626),s=n(97214),r=n(28241),i=n(58834),o=n(69552),l=n(71876)},88658:function(e,t,n){n.d(t,{L:function(){return s}});var a=n(49817);let s=e=>{let t;let{apiKeySource:n,accessToken:s,apiKey:r,inputMessage:i,chatHistory:o,selectedTags:l,selectedVectorStores:c,selectedGuardrails:d,selectedMCPTools:m,selectedVoice:p,endpointType:u,selectedModel:g,selectedSdk:h}=e,x="session"===n?s:r,f=window.location.origin,_=i||"Your prompt here",b=_.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n"),j=o.filter(e=>!e.isImage).map(e=>{let{role:t,content:n}=e;return{role:t,content:n}}),v={};l.length>0&&(v.tags=l),c.length>0&&(v.vector_stores=c),d.length>0&&(v.guardrails=d);let y=g||"your-model-name",N="azure"===h?'import openai\n\nclient = openai.AzureOpenAI(\n api_key="'.concat(x||"YOUR_LITELLM_API_KEY",'",\n azure_endpoint="').concat(f,'",\n api_version="2024-02-01"\n)'):'import openai\n\nclient = openai.OpenAI(\n api_key="'.concat(x||"YOUR_LITELLM_API_KEY",'",\n base_url="').concat(f,'"\n)');switch(u){case a.KP.CHAT:{let e=Object.keys(v).length>0,n="";if(e){let e=JSON.stringify({metadata:v},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();n=",\n extra_body=".concat(e)}let a=j.length>0?j:[{role:"user",content:_}];t='\nimport base64\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# Example with text only\nresponse = client.chat.completions.create(\n model="'.concat(y,'",\n messages=').concat(JSON.stringify(a,null,4)).concat(n,'\n)\n\nprint(response)\n\n# Example with image or PDF (uncomment and provide file path to use)\n# base64_file = encode_image("path/to/your/file.jpg") # or .pdf\n# response_with_file = client.chat.completions.create(\n# model="').concat(y,'",\n# messages=[\n# {\n# "role": "user",\n# "content": [\n# {\n# "type": "text",\n# "text": "').concat(b,'"\n# },\n# {\n# "type": "image_url",\n# "image_url": {\n# "url": f"data:image/jpeg;base64,{base64_file}" # or data:application/pdf;base64,{base64_file}\n# }\n# }\n# ]\n# }\n# ]').concat(n,"\n# )\n# print(response_with_file)\n");break}case a.KP.RESPONSES:{let e=Object.keys(v).length>0,n="";if(e){let e=JSON.stringify({metadata:v},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();n=",\n extra_body=".concat(e)}let a=j.length>0?j:[{role:"user",content:_}];t='\nimport base64\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# Example with text only\nresponse = client.responses.create(\n model="'.concat(y,'",\n input=').concat(JSON.stringify(a,null,4)).concat(n,'\n)\n\nprint(response.output_text)\n\n# Example with image or PDF (uncomment and provide file path to use)\n# base64_file = encode_image("path/to/your/file.jpg") # or .pdf\n# response_with_file = client.responses.create(\n# model="').concat(y,'",\n# input=[\n# {\n# "role": "user",\n# "content": [\n# {"type": "input_text", "text": "').concat(b,'"},\n# {\n# "type": "input_image",\n# "image_url": f"data:image/jpeg;base64,{base64_file}", # or data:application/pdf;base64,{base64_file}\n# },\n# ],\n# }\n# ]').concat(n,"\n# )\n# print(response_with_file.output_text)\n");break}case a.KP.IMAGE:t="azure"===h?"\n# NOTE: The Azure SDK does not have a direct equivalent to the multi-modal 'responses.create' method shown for OpenAI.\n# This snippet uses 'client.images.generate' and will create a new image based on your prompt.\n# It does not use the uploaded image, as 'client.images.generate' does not support image inputs in this context.\nimport os\nimport requests\nimport json\nimport time\nfrom PIL import Image\n\nresult = client.images.generate(\n model=\"".concat(y,'",\n prompt="').concat(i,'",\n n=1\n)\n\njson_response = json.loads(result.model_dump_json())\n\n# Set the directory for the stored image\nimage_dir = os.path.join(os.curdir, \'images\')\n\n# If the directory doesn\'t exist, create it\nif not os.path.isdir(image_dir):\n os.mkdir(image_dir)\n\n# Initialize the image path\nimage_filename = f"generated_image_{int(time.time())}.png"\nimage_path = os.path.join(image_dir, image_filename)\n\ntry:\n # Retrieve the generated image\n if json_response.get("data") && len(json_response["data"]) > 0 && json_response["data"][0].get("url"):\n image_url = json_response["data"][0]["url"]\n generated_image = requests.get(image_url).content\n with open(image_path, "wb") as image_file:\n image_file.write(generated_image)\n\n print(f"Image saved to {image_path}")\n # Display the image\n image = Image.open(image_path)\n image.show()\n else:\n print("Could not find image URL in response.")\n print("Full response:", json_response)\nexcept Exception as e:\n print(f"An error occurred: {e}")\n print("Full response:", json_response)\n'):"\nimport base64\nimport os\nimport time\nimport json\nfrom PIL import Image\nimport requests\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, \"rb\") as image_file:\n return base64.b64encode(image_file.read()).decode('utf-8')\n\n# Helper function to create a file (simplified for this example)\ndef create_file(image_path):\n # In a real implementation, this would upload the file to OpenAI\n # For this example, we'll just return a placeholder ID\n return f\"file_{os.path.basename(image_path).replace('.', '_')}\"\n\n# The prompt entered by the user\nprompt = \"".concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n');break;case a.KP.IMAGE_EDITS:t="azure"===h?'\nimport base64\nimport os\nimport time\nimport json\nfrom PIL import Image\nimport requests\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# The prompt entered by the user\nprompt = "'.concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n'):"\nimport base64\nimport os\nimport time\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, \"rb\") as image_file:\n return base64.b64encode(image_file.read()).decode('utf-8')\n\n# Helper function to create a file (simplified for this example)\ndef create_file(image_path):\n # In a real implementation, this would upload the file to OpenAI\n # For this example, we'll just return a placeholder ID\n return f\"file_{os.path.basename(image_path).replace('.', '_')}\"\n\n# The prompt entered by the user\nprompt = \"".concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n');break;case a.KP.EMBEDDINGS:t='\nresponse = client.embeddings.create(\n input="'.concat(i||"Your string here",'",\n model="').concat(y,'",\n encoding_format="base64" # or "float"\n)\n\nprint(response.data[0].embedding)\n');break;case a.KP.TRANSCRIPTION:t='\n# Open the audio file\naudio_file = open("path/to/your/audio/file.mp3", "rb")\n\n# Make the transcription request\nresponse = client.audio.transcriptions.create(\n model="'.concat(y,'",\n file=audio_file').concat(i?',\n prompt="'.concat(i.replace(/"/g,'\\"'),'"'):"","\n)\n\nprint(response.text)\n");break;case a.KP.SPEECH:t='\n# Make the text-to-speech request\nresponse = client.audio.speech.create(\n model="'.concat(y,'",\n input="').concat(i||"Your text to convert to speech here",'",\n voice="').concat(p,'" # Options: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer\n)\n\n# Save the audio to a file\noutput_filename = "output_speech.mp3"\nresponse.stream_to_file(output_filename)\nprint(f"Audio saved to {output_filename}")\n\n# Optional: Customize response format and speed\n# response = client.audio.speech.create(\n# model="').concat(y,'",\n# input="').concat(i||"Your text to convert to speech here",'",\n# voice="alloy",\n# response_format="mp3", # Options: mp3, opus, aac, flac, wav, pcm\n# speed=1.0 # Range: 0.25 to 4.0\n# )\n# response.stream_to_file("output_speech.mp3")\n');break;default:t="\n# Code generation for this endpoint is not implemented yet."}return"".concat(N,"\n").concat(t)}},49817:function(e,t,n){var a,s,r,i;n.d(t,{KP:function(){return s},vf:function(){return l}}),(r=a||(a={})).AUDIO_SPEECH="audio_speech",r.AUDIO_TRANSCRIPTION="audio_transcription",r.IMAGE_GENERATION="image_generation",r.VIDEO_GENERATION="video_generation",r.CHAT="chat",r.RESPONSES="responses",r.IMAGE_EDITS="image_edits",r.ANTHROPIC_MESSAGES="anthropic_messages",(i=s||(s={})).IMAGE="image",i.VIDEO="video",i.CHAT="chat",i.RESPONSES="responses",i.IMAGE_EDITS="image_edits",i.ANTHROPIC_MESSAGES="anthropic_messages",i.EMBEDDINGS="embeddings",i.SPEECH="speech",i.TRANSCRIPTION="transcription";let o={image_generation:"image",video_generation:"video",chat:"chat",responses:"responses",image_edits:"image_edits",anthropic_messages:"anthropic_messages",audio_speech:"speech",audio_transcription:"transcription"},l=e=>{if(console.log("getEndpointType:",e),Object.values(a).includes(e)){let t=o[e];return console.log("endpointType:",t),t}return"chat"}},8048:function(e,t,n){n.d(t,{C:function(){return m}});var a=n(57437),s=n(71594),r=n(24525),i=n(2265),o=n(19130),l=n(44633),c=n(86462),d=n(49084);function m(e){let{data:t=[],columns:n,isLoading:m=!1,table:p,defaultSorting:u=[]}=e,[g,h]=i.useState(u),[x]=i.useState("onChange"),[f,_]=i.useState({}),[b,j]=i.useState({}),v=(0,s.b7)({data:t,columns:n,state:{sorting:g,columnSizing:f,columnVisibility:b},columnResizeMode:x,onSortingChange:h,onColumnSizingChange:_,onColumnVisibilityChange:j,getCoreRowModel:(0,r.sC)(),getSortedRowModel:(0,r.tj)(),enableSorting:!0,enableColumnResizing:!0,defaultColumn:{minSize:40,maxSize:500}});return i.useEffect(()=>{p&&(p.current=v)},[v,p]),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("div",{className:"relative min-w-full",children:(0,a.jsxs)(o.iA,{className:"[&_td]:py-2 [&_th]:py-2 w-full",children:[(0,a.jsx)(o.ss,{children:v.getHeaderGroups().map(e=>(0,a.jsx)(o.SC,{children:e.headers.map(e=>{var t;return(0,a.jsxs)(o.xs,{className:"py-1 h-8 relative ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(t=e.column.columnDef.meta)||void 0===t?void 0:t.className)||""),style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,s.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(l.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"})})]}),e.column.getCanResize()&&(0,a.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ".concat(e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200")})]},e.id)})},e.id))}),(0,a.jsx)(o.RM,{children:m?(0,a.jsx)(o.SC,{children:(0,a.jsx)(o.pj,{colSpan:n.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"\uD83D\uDE85 Loading models..."})})})}):v.getRowModel().rows.length>0?v.getRowModel().rows.map(e=>(0,a.jsx)(o.SC,{children:e.getVisibleCells().map(e=>{var t;return(0,a.jsx)(o.pj,{className:"py-0.5 ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(t=e.column.columnDef.meta)||void 0===t?void 0:t.className)||""),style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,s.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)):(0,a.jsx)(o.SC,{children:(0,a.jsx)(o.pj,{colSpan:n.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No models found"})})})})})]})})})})}},65373:function(e,t,n){n.d(t,{Z:function(){return v}});var a=n(57437),s=n(27648),r=n(2265),i=n(89970),o=n(63709),l=n(80795),c=n(19250),d=n(15883),m=n(46346),p=n(57400),u=n(91870),g=n(40428),h=n(83884),x=n(45524),f=n(3914);let _=async e=>{if(!e)return null;try{return await (0,c.getProxyUISettings)(e)}catch(e){return console.error("Error fetching proxy settings:",e),null}};var b=n(69734),j=n(31857),v=e=>{let{userID:t,userEmail:n,userRole:v,premiumUser:y,proxySettings:N,setProxySettings:w,accessToken:I,isPublicPage:A=!1,sidebarCollapsed:S=!1,onToggleSidebar:k}=e,C=(0,c.getProxyBaseUrl)(),[E,Z]=(0,r.useState)(""),{logoUrl:O}=(0,b.F)(),{refactoredUIFlag:T,setRefactoredUIFlag:M}=(0,j.Z)();(0,r.useEffect)(()=>{(async()=>{if(I){let e=await _(I);console.log("response from fetchProxySettings",e),e&&w(e)}})()},[I]),(0,r.useEffect)(()=>{Z((null==N?void 0:N.PROXY_LOGOUT_URL)||"")},[N]);let P=[{key:"user-info",onClick:e=>{var t;return null===(t=e.domEvent)||void 0===t?void 0:t.stopPropagation()},label:(0,a.jsxs)("div",{className:"px-3 py-3 border-b border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-2 text-gray-700"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:t})]}),y?(0,a.jsx)(i.Z,{title:"Premium User",placement:"left",children:(0,a.jsxs)("div",{className:"flex items-center bg-gradient-to-r from-amber-500 to-yellow-500 text-white px-2 py-0.5 rounded-full cursor-help",children:[(0,a.jsx)(m.Z,{className:"mr-1 text-xs"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Premium"})]})}):(0,a.jsx)(i.Z,{title:"Upgrade to Premium for advanced features",placement:"left",children:(0,a.jsxs)("div",{className:"flex items-center bg-gray-100 text-gray-500 px-2 py-0.5 rounded-full cursor-help",children:[(0,a.jsx)(m.Z,{className:"mr-1 text-xs"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Standard"})]})})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center text-sm",children:[(0,a.jsx)(p.Z,{className:"mr-2 text-gray-400 text-xs"}),(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Role"}),(0,a.jsx)("span",{className:"ml-auto text-gray-700 font-medium",children:v})]}),(0,a.jsxs)("div",{className:"flex items-center text-sm",children:[(0,a.jsx)(u.Z,{className:"mr-2 text-gray-400 text-xs"}),(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Email"}),(0,a.jsx)("span",{className:"ml-auto text-gray-700 font-medium truncate max-w-[150px]",title:n||"Unknown",children:n||"Unknown"})]}),(0,a.jsxs)("div",{className:"flex items-center text-sm pt-2 mt-2 border-t border-gray-100",children:[(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Refactored UI"}),(0,a.jsx)(o.Z,{className:"ml-auto",size:"small",checked:T,onChange:e=>M(e),"aria-label":"Toggle refactored UI feature flag"})]})]})]})},{key:"logout",label:(0,a.jsxs)("div",{className:"flex items-center py-2 px-3 hover:bg-gray-50 rounded-md mx-1 my-1",onClick:()=>{(0,f.b)(),window.location.href=E},children:[(0,a.jsx)(g.Z,{className:"mr-3 text-gray-600"}),(0,a.jsx)("span",{className:"text-gray-800",children:"Logout"})]})}];return(0,a.jsx)("nav",{className:"bg-white border-b border-gray-200 sticky top-0 z-10",children:(0,a.jsx)("div",{className:"w-full",children:(0,a.jsxs)("div",{className:"flex items-center h-14 px-4",children:[" ",(0,a.jsxs)("div",{className:"flex items-center flex-shrink-0",children:[k&&(0,a.jsx)("button",{onClick:k,className:"flex items-center justify-center w-10 h-10 mr-2 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded transition-colors",title:S?"Expand sidebar":"Collapse sidebar",children:(0,a.jsx)("span",{className:"text-lg",children:S?(0,a.jsx)(h.Z,{}):(0,a.jsx)(x.Z,{})})}),(0,a.jsx)(s.default,{href:"/",className:"flex items-center",children:(0,a.jsx)("img",{src:O||"".concat(C,"/get_image"),alt:"LiteLLM Brand",className:"h-10 w-auto"})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-5 ml-auto",children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 hover:text-gray-900 transition-colors",children:"Docs"}),!A&&(0,a.jsx)(l.Z,{menu:{items:P,className:"min-w-[200px]",style:{padding:"8px",marginTop:"8px",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.08)"}},overlayStyle:{minWidth:"200px"},children:(0,a.jsxs)("button",{className:"inline-flex items-center text-sm text-gray-600 hover:text-gray-900 transition-colors",children:["User",(0,a.jsx)("svg",{className:"ml-1 w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M19 9l-7 7-7-7"})})]})})]})]})})})}},42673:function(e,t,n){var a,s;n.d(t,{Cl:function(){return a},bK:function(){return d},cd:function(){return o},dr:function(){return l},fK:function(){return r},ph:function(){return c}}),(s=a||(a={})).AIML="AI/ML API",s.Bedrock="Amazon Bedrock",s.Anthropic="Anthropic",s.AssemblyAI="AssemblyAI",s.SageMaker="AWS SageMaker",s.Azure="Azure",s.Azure_AI_Studio="Azure AI Foundry (Studio)",s.Cerebras="Cerebras",s.Cohere="Cohere",s.Dashscope="Dashscope",s.Databricks="Databricks (Qwen API)",s.DeepInfra="DeepInfra",s.Deepgram="Deepgram",s.Deepseek="Deepseek",s.ElevenLabs="ElevenLabs",s.FalAI="Fal AI",s.FireworksAI="Fireworks AI",s.Google_AI_Studio="Google AI Studio",s.GradientAI="GradientAI",s.Groq="Groq",s.Hosted_Vllm="vllm",s.Infinity="Infinity",s.JinaAI="Jina AI",s.MistralAI="Mistral AI",s.Ollama="Ollama",s.OpenAI="OpenAI",s.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",s.OpenAI_Text="OpenAI Text Completion",s.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",s.Openrouter="Openrouter",s.Oracle="Oracle Cloud Infrastructure (OCI)",s.Perplexity="Perplexity",s.Sambanova="Sambanova",s.Snowflake="Snowflake",s.TogetherAI="TogetherAI",s.Triton="Triton",s.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",s.VolcEngine="VolcEngine",s.Voyage="Voyage AI",s.xAI="xAI";let r={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="../ui/assets/logos/",o={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},l=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:o[e],displayName:e}}let t=Object.keys(r).find(t=>r[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let n=a[t];return{logo:o[n],displayName:n}},c=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},d=(e,t)=>{console.log("Provider key: ".concat(e));let n=r[e];console.log("Provider mapped to: ".concat(n));let a=[];return e&&"object"==typeof t&&(Object.entries(t).forEach(e=>{let[t,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&(s.litellm_provider===n||s.litellm_provider.includes(n))&&a.push(t)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(t).forEach(e=>{let[t,n]=e;null!==n&&"object"==typeof n&&"litellm_provider"in n&&"cohere_chat"===n.litellm_provider&&a.push(t)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(t).forEach(e=>{let[t,n]=e;null!==n&&"object"==typeof n&&"litellm_provider"in n&&"sagemaker_chat"===n.litellm_provider&&a.push(t)}))),a}},87526:function(e,t,n){n.d(t,{Z:function(){return I}});var a=n(57437),s=n(2265),r=n(19250),i=n(8048),o=n(20831),l=n(12514),c=n(84264),d=n(96761),m=n(89970),p=n(3810),u=n(52787),g=n(82680),h=n(3477),x=n(17732),f=n(33245),_=n(78867),b=n(88658),j=n(49817),v=n(42673),y=n(65373),N=n(69734),w=n(9114),I=e=>{var t,n;let{accessToken:I}=e,[A,S]=(0,s.useState)(null),[k,C]=(0,s.useState)("LiteLLM Gateway"),[E,Z]=(0,s.useState)(null),[O,T]=(0,s.useState)(""),[M,P]=(0,s.useState)({}),[D,L]=(0,s.useState)(!0),[z,R]=(0,s.useState)(""),[F,G]=(0,s.useState)([]),[H,K]=(0,s.useState)([]),[V,U]=(0,s.useState)([]),[q,W]=(0,s.useState)("I'm alive! ✓"),[B,J]=(0,s.useState)(!1),[Y,$]=(0,s.useState)(null),[Q,X]=(0,s.useState)({}),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=async()=>{try{L(!0);let e=await (0,r.modelHubPublicModelsCall)();console.log("ModelHubData:",e),S(e)}catch(e){console.error("There was an error fetching the public model data",e),W("Service unavailable")}finally{L(!1)}};(async()=>{let e=await (0,r.getPublicModelHubInfo)();console.log("Public Model Hub Info:",e),C(e.docs_title),Z(e.custom_docs_description),T(e.litellm_version),P(e.useful_links||{})})(),e()},[]),(0,s.useEffect)(()=>{},[z,F,H,V]);let et=(0,s.useMemo)(()=>{if(!A)return[];let e=A;if(z.trim()){let t=z.toLowerCase(),n=t.split(/\s+/),a=A.filter(e=>{let a=e.model_group.toLowerCase();return!!a.includes(t)||n.every(e=>a.includes(e))});a.length>0&&(e=a.sort((e,n)=>{let a=e.model_group.toLowerCase(),s=n.model_group.toLowerCase(),r=a===t?1e3:0,i=s===t?1e3:0,o=a.startsWith(t)?100:0,l=s.startsWith(t)?100:0,c=t.split(/\s+/).every(e=>a.includes(e))?50:0,d=t.split(/\s+/).every(e=>s.includes(e))?50:0,m=a.length;return i+l+d+(1e3-s.length)-(r+o+c+(1e3-m))}))}return e.filter(e=>{let t=0===F.length||F.some(t=>e.providers.includes(t)),n=0===H.length||H.includes(e.mode||""),a=0===V.length||Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).some(e=>{let[t]=e,n=t.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");return V.includes(n)});return t&&n&&a})},[A,z,F,H,V]),en=e=>{$(e),J(!0)},ea=e=>{navigator.clipboard.writeText(e),w.Z.success("Copied to clipboard!")},es=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),er=e=>Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).map(e=>{let[t]=e;return t}),ei=e=>"$".concat((1e6*e).toFixed(4)),eo=e=>e?e>=1e3?"".concat((e/1e3).toFixed(0),"K"):e.toString():"N/A",el=(e,t)=>{let n=[];return e&&n.push("RPM: ".concat(e.toLocaleString())),t&&n.push("TPM: ".concat(t.toLocaleString())),n.length>0?n.join(", "):"N/A"};return(0,a.jsx)(N.f,{accessToken:I,children:(0,a.jsxs)("div",{className:"min-h-screen bg-white",children:[(0,a.jsx)(y.Z,{userID:null,userEmail:null,userRole:null,premiumUser:!1,setProxySettings:X,proxySettings:Q,accessToken:I||null,isPublicPage:!0}),(0,a.jsxs)("div",{className:"w-full px-8 py-12",children:[(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"About"}),(0,a.jsx)("p",{className:"text-gray-700 mb-6 text-base leading-relaxed",children:E||"Proxy Server to call 100+ LLMs in the OpenAI format."}),(0,a.jsx)("div",{className:"flex items-center space-x-3 text-sm text-gray-600",children:(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)("span",{className:"w-4 h-4 mr-2",children:"\uD83D\uDD27"}),"Built with litellm: v",O]})})]}),M&&Object.keys(M).length>0&&(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"Useful Links"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Object.entries(M||{}).map(e=>{let[t,n]=e;return(0,a.jsxs)("button",{onClick:()=>window.open(n,"_blank"),className:"flex items-center space-x-3 text-blue-600 hover:text-blue-800 transition-colors p-3 rounded-lg hover:bg-blue-50 border border-gray-200",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),(0,a.jsx)(c.Z,{className:"text-sm font-medium",children:t})]},t)})})]}),(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"Health and Endpoint Status"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:(0,a.jsxs)(c.Z,{className:"text-green-600 font-medium text-sm",children:["Service status: ",q]})})]}),(0,a.jsxs)(l.Z,{className:"p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-8",children:(0,a.jsx)(d.Z,{className:"text-2xl font-semibold text-gray-900",children:"Available Models"})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 mb-3",children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium text-gray-700",children:"Search Models:"}),(0,a.jsx)(m.Z,{title:"Smart search with relevance ranking - finds models containing your search terms, ranked by relevance. Try searching 'xai grok-4', 'claude-4', 'gpt-4', or 'sonnet'",placement:"top",children:(0,a.jsx)(f.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(x.Z,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names... (smart search enabled)",value:z,onChange:e=>R(e.target.value),className:"border border-gray-300 rounded-lg pl-10 pr-4 py-2 w-full text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Provider:"}),(0,a.jsx)(u.default,{mode:"multiple",value:F,onChange:e=>G(e),placeholder:"Select providers",className:"w-full",size:"large",allowClear:!0,optionRender:e=>{let{logo:t}=(0,v.dr)(e.value);return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,a.jsx)("img",{src:t,alt:e.label,className:"w-5 h-5 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e.label})]})},children:A&&(e=>{let t=new Set;return e.forEach(e=>{e.providers.forEach(e=>t.add(e))}),Array.from(t)})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Mode:"}),(0,a.jsx)(u.default,{mode:"multiple",value:H,onChange:e=>K(e),placeholder:"Select modes",className:"w-full",size:"large",allowClear:!0,children:A&&(e=>{let t=new Set;return e.forEach(e=>{e.mode&&t.add(e.mode)}),Array.from(t)})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Features:"}),(0,a.jsx)(u.default,{mode:"multiple",value:V,onChange:e=>U(e),placeholder:"Select features",className:"w-full",size:"large",allowClear:!0,children:A&&(e=>{let t=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).forEach(e=>{let[n]=e,a=n.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");t.add(a)})}),Array.from(t).sort()})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]})]}),(0,a.jsx)(i.C,{columns:[{header:"Model Name",accessorKey:"model_group",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsx)(m.Z,{title:t.original.model_group,children:(0,a.jsx)(o.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left",onClick:()=>en(t.original),children:t.original.model_group})})})},size:150},{header:"Providers",accessorKey:"providers",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.providers;return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:n.map(e=>{let{logo:t}=(0,v.dr)(e);return(0,a.jsxs)("div",{className:"flex items-center space-x-1 px-2 py-1 bg-gray-100 rounded text-xs",children:[t&&(0,a.jsx)("img",{src:t,alt:e,className:"w-3 h-3 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e})]},e)})})},size:120},{header:"Mode",accessorKey:"mode",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.mode;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:(e=>{switch(null==e?void 0:e.toLowerCase()){case"chat":return"\uD83D\uDCAC";case"rerank":return"\uD83D\uDD04";case"embedding":return"\uD83D\uDCC4";default:return"\uD83E\uDD16"}})(n||"")}),(0,a.jsx)(c.Z,{children:n||"Chat"})]})},size:100},{header:"Max Input",accessorKey:"max_input_tokens",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)(c.Z,{className:"text-center",children:eo(t.original.max_input_tokens)})},size:100,meta:{className:"text-center"}},{header:"Max Output",accessorKey:"max_output_tokens",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)(c.Z,{className:"text-center",children:eo(t.original.max_output_tokens)})},size:100,meta:{className:"text-center"}},{header:"Input $/1M",accessorKey:"input_cost_per_token",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.input_cost_per_token;return(0,a.jsx)(c.Z,{className:"text-center",children:n?ei(n):"Free"})},size:100,meta:{className:"text-center"}},{header:"Output $/1M",accessorKey:"output_cost_per_token",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.output_cost_per_token;return(0,a.jsx)(c.Z,{className:"text-center",children:n?ei(n):"Free"})},size:100,meta:{className:"text-center"}},{header:"Features",accessorKey:"supports_vision",enableSorting:!1,cell:e=>{let{row:t}=e,n=Object.entries(t.original).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).map(e=>{let[t]=e;return es(t)});return 0===n.length?(0,a.jsx)(c.Z,{className:"text-gray-400",children:"-"}):1===n.length?(0,a.jsx)("div",{className:"h-6 flex items-center",children:(0,a.jsx)(p.Z,{color:"blue",className:"text-xs",children:n[0]})}):(0,a.jsxs)("div",{className:"h-6 flex items-center space-x-1",children:[(0,a.jsx)(p.Z,{color:"blue",className:"text-xs",children:n[0]}),(0,a.jsx)(m.Z,{title:(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("div",{className:"font-medium",children:"All Features:"}),n.map((e,t)=>(0,a.jsxs)("div",{className:"text-xs",children:["• ",e]},t))]}),trigger:"click",placement:"topLeft",children:(0,a.jsxs)("span",{className:"text-xs text-blue-600 cursor-pointer hover:text-blue-800 hover:underline",onClick:e=>e.stopPropagation(),children:["+",n.length-1]})})]})},size:120},{header:"Limits",accessorKey:"rpm",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original;return(0,a.jsx)(c.Z,{className:"text-xs text-gray-600",children:el(n.rpm,n.tpm)})},size:150}],data:et,isLoading:D,table:ee,defaultSorting:[{id:"model_group",desc:!1}]}),(0,a.jsx)("div",{className:"mt-8 text-center",children:(0,a.jsxs)(c.Z,{className:"text-sm text-gray-600",children:["Showing ",et.length," of ",(null==A?void 0:A.length)||0," models"]})})]})]}),(0,a.jsx)(g.Z,{title:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:(null==Y?void 0:Y.model_group)||"Model Details"}),Y&&(0,a.jsx)(m.Z,{title:"Copy model name",children:(0,a.jsx)(_.Z,{onClick:()=>ea(Y.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 w-4 h-4"})})]}),width:1e3,open:B,footer:null,onOk:()=>{J(!1),$(null)},onCancel:()=>{J(!1),$(null)},children:Y&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Model Name:"}),(0,a.jsx)(c.Z,{children:Y.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(c.Z,{children:Y.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:Y.providers.map(e=>{let{logo:t}=(0,v.dr)(e);return(0,a.jsx)(p.Z,{color:"blue",children:(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[t&&(0,a.jsx)("img",{src:t,alt:e,className:"w-3 h-3 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e})]})},e)})})]})]}),Y.model_group.includes("*")&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4",children:(0,a.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,a.jsx)(f.Z,{className:"w-4 h-4 text-blue-600 mt-0.5 flex-shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium text-blue-900 mb-2",children:"Wildcard Routing"}),(0,a.jsxs)(c.Z,{className:"text-sm text-blue-800 mb-2",children:["This model uses wildcard routing. You can pass any value where you see the"," ",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:"*"})," symbol."]}),(0,a.jsxs)(c.Z,{className:"text-sm text-blue-800",children:["For example, with"," ",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:Y.model_group}),", you can use any string (",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:Y.model_group.replace("*","my-custom-value")}),") that matches this pattern."]})]})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(c.Z,{children:(null===(t=Y.max_input_tokens)||void 0===t?void 0:t.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(c.Z,{children:(null===(n=Y.max_output_tokens)||void 0===n?void 0:n.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(c.Z,{children:Y.input_cost_per_token?ei(Y.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(c.Z,{children:Y.output_cost_per_token?ei(Y.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=er(Y),t=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(c.Z,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,n)=>(0,a.jsx)(p.Z,{color:t[n%t.length],children:es(e)},e))})()})]}),(Y.tpm||Y.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[Y.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(c.Z,{children:Y.tpm.toLocaleString()})]}),Y.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(c.Z,{children:Y.rpm.toLocaleString()})]})]})]}),Y.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Y.supported_openai_params.map(e=>(0,a.jsx)(p.Z,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto",children:(0,a.jsx)("pre",{className:"text-sm",children:(0,b.L)({apiKeySource:"custom",accessToken:null,apiKey:"your_api_key",inputMessage:"Hello, how are you?",chatHistory:[{role:"user",content:"Hello, how are you?",isImage:!1}],selectedTags:[],selectedVectorStores:[],selectedGuardrails:[],selectedMCPTools:[],endpointType:(0,j.vf)(Y.mode||"chat"),selectedModel:Y.model_group,selectedSdk:"openai"})})}),(0,a.jsx)("div",{className:"mt-2 text-right",children:(0,a.jsx)("button",{onClick:()=>{ea((0,b.L)({apiKeySource:"custom",accessToken:null,apiKey:"your_api_key",inputMessage:"Hello, how are you?",chatHistory:[{role:"user",content:"Hello, how are you?",isImage:!1}],selectedTags:[],selectedVectorStores:[],selectedGuardrails:[],selectedMCPTools:[],endpointType:(0,j.vf)(Y.mode||"chat"),selectedModel:Y.model_group,selectedSdk:"openai"}))},className:"text-sm text-blue-600 hover:text-blue-800 cursor-pointer",children:"Copy to clipboard"})})]})]})})]})})}},69734:function(e,t,n){n.d(t,{F:function(){return o},f:function(){return l}});var a=n(57437),s=n(2265),r=n(19250);let i=(0,s.createContext)(void 0),o=()=>{let e=(0,s.useContext)(i);if(!e)throw Error("useTheme must be used within a ThemeProvider");return e},l=e=>{let{children:t,accessToken:n}=e,[o,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(async()=>{try{let t=(0,r.getProxyBaseUrl)(),n=await fetch(t?"".concat(t,"/get/ui_theme_settings"):"/get/ui_theme_settings",{method:"GET",headers:{"Content-Type":"application/json"}});if(n.ok){var e;let t=await n.json();(null===(e=t.values)||void 0===e?void 0:e.logo_url)&&l(t.values.logo_url)}}catch(e){console.warn("Failed to load logo settings from backend:",e)}})()},[]),(0,a.jsx)(i.Provider,{value:{logoUrl:o,setLogoUrl:l},children:t})}},31857:function(e,t,n){n.d(t,{FeatureFlagsProvider:function(){return m}});var a=n(57437),s=n(2265),r=n(99376),i=n(19250);let o=()=>{let e="ui/".replace(/^\/+|\/+$/g,""),t=e?"/".concat(e,"/"):"/";if(i.serverRootPath&&"/"!==i.serverRootPath){let e=i.serverRootPath.replace(/\/+$/,""),n=t.replace(/^\/+/,"");return"".concat(e,"/").concat(n)}return t},l="feature.refactoredUIFlag",c=(0,s.createContext)(null);function d(e){try{localStorage.setItem(l,String(e))}catch(e){}}let m=e=>{let{children:t}=e,n=(0,r.useRouter)(),[i,m]=(0,s.useState)(()=>(function(){try{let e=localStorage.getItem(l);if(null===e)return localStorage.setItem(l,"false"),!1;let t=e.trim().toLowerCase();if("true"===t||"1"===t)return!0;if("false"===t||"0"===t)return!1;let n=JSON.parse(e);if("boolean"==typeof n)return n;return localStorage.setItem(l,"false"),!1}catch(e){try{localStorage.setItem(l,"false")}catch(e){}return!1}})());return(0,s.useEffect)(()=>{let e=e=>{if(e.key===l&&null!=e.newValue){let t=e.newValue.trim().toLowerCase();m("true"===t||"1"===t)}e.key===l&&null===e.newValue&&(d(!1),m(!1))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[]),(0,s.useEffect)(()=>{if(i)return;let e=setTimeout(()=>{let e;let t=o(),a=(e=window.location.pathname).endsWith("/")?e:e+"/";a.includes("/ui")||a===t||n.replace(t)},100);return()=>clearTimeout(e)},[i,n]),(0,a.jsx)(c.Provider,{value:{refactoredUIFlag:i,setRefactoredUIFlag:e=>{m(e),d(e)}},children:t})};t.Z=()=>{let e=(0,s.useContext)(c);if(!e)throw Error("useFeatureFlags must be used within FeatureFlagsProvider");return e}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js index 6bc1a80862..c5b4cb9963 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2100],{15956:function(e,n,o){Promise.resolve().then(o.bind(o,19056))},19130:function(e,n,o){"use strict";o.d(n,{RM:function(){return t.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return a.Z},ss:function(){return i.Z},xs:function(){return l.Z}});var r=o(21626),t=o(97214),a=o(28241),i=o(58834),l=o(69552),c=o(71876)},11318:function(e,n,o){"use strict";o.d(n,{Z:function(){return l}});var r=o(2265),t=o(80443),a=o(19250);let i=async(e,n,o,r)=>"Admin"!=o&&"Admin Viewer"!=o?await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null,n):await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null);var l=()=>{let[e,n]=(0,r.useState)([]),{accessToken:o,userId:a,userRole:l}=(0,t.Z)();return(0,r.useEffect)(()=>{(async()=>{n(await i(o,a,l,null))})()},[o,a,l]),{teams:e,setTeams:n}}},19056:function(e,n,o){"use strict";o.r(n);var r=o(57437),t=o(33801),a=o(80443),i=o(11318),l=o(21623),c=o(29827);n.default=()=>{let{accessToken:e,token:n,userRole:o,userId:s,premiumUser:u}=(0,a.Z)(),{teams:p}=(0,i.Z)(),d=new l.S;return(0,r.jsx)(c.aH,{client:d,children:(0,r.jsx)(t.Z,{accessToken:e,token:n,userRole:o,userID:s,allTeams:p||[],premiumUser:u})})}},42673:function(e,n,o){"use strict";var r,t;o.d(n,{Cl:function(){return r},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return a},ph:function(){return s}}),(t=r||(r={})).AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI";let a={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="/ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(a).find(n=>a[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let o=r[n];return{logo:l[o],displayName:o}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let o=a[e];console.log("Provider mapped to: ".concat(o));let r=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&(t.litellm_provider===o||t.litellm_provider.includes(o))&&r.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&"cohere_chat"===o.litellm_provider&&r.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&"sagemaker_chat"===o.litellm_provider&&r.push(n)}))),r}},60493:function(e,n,o){"use strict";o.d(n,{w:function(){return c}});var r=o(57437),t=o(2265),a=o(71594),i=o(24525),l=o(19130);function c(e){let{data:n=[],columns:o,getRowCanExpand:c,renderSubComponent:s,isLoading:u=!1,loadingMessage:p="\uD83D\uDE85 Loading logs...",noDataMessage:d="No logs found"}=e,g=(0,a.b7)({data:n,columns:o,getRowCanExpand:c,getRowId:(e,n)=>{var o;return null!==(o=null==e?void 0:e.request_id)&&void 0!==o?o:String(n)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,r.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,r.jsxs)(l.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,r.jsx)(l.ss,{children:g.getHeaderGroups().map(e=>(0,r.jsx)(l.SC,{children:e.headers.map(e=>(0,r.jsx)(l.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,a.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,r.jsx)(l.RM,{children:u?(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:o.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:p})})})}):g.getRowModel().rows.length>0?g.getRowModel().rows.map(e=>(0,r.jsxs)(t.Fragment,{children:[(0,r.jsx)(l.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,r.jsx)(l.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,r.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:s({row:e})})})})]},e.id)):(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:o.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:d})})})})})]})})}}},function(e){e.O(0,[6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,9343,1264,1116,4688,131,2202,874,4292,3801,2971,2117,1744],function(){return e(e.s=15956)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2100],{15956:function(e,n,o){Promise.resolve().then(o.bind(o,19056))},19130:function(e,n,o){"use strict";o.d(n,{RM:function(){return t.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return a.Z},ss:function(){return i.Z},xs:function(){return l.Z}});var r=o(21626),t=o(97214),a=o(28241),i=o(58834),l=o(69552),c=o(71876)},11318:function(e,n,o){"use strict";o.d(n,{Z:function(){return l}});var r=o(2265),t=o(80443),a=o(19250);let i=async(e,n,o,r)=>"Admin"!=o&&"Admin Viewer"!=o?await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null,n):await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null);var l=()=>{let[e,n]=(0,r.useState)([]),{accessToken:o,userId:a,userRole:l}=(0,t.Z)();return(0,r.useEffect)(()=>{(async()=>{n(await i(o,a,l,null))})()},[o,a,l]),{teams:e,setTeams:n}}},19056:function(e,n,o){"use strict";o.r(n);var r=o(57437),t=o(33801),a=o(80443),i=o(11318),l=o(21623),c=o(29827);n.default=()=>{let{accessToken:e,token:n,userRole:o,userId:s,premiumUser:u}=(0,a.Z)(),{teams:p}=(0,i.Z)(),d=new l.S;return(0,r.jsx)(c.aH,{client:d,children:(0,r.jsx)(t.Z,{accessToken:e,token:n,userRole:o,userID:s,allTeams:p||[],premiumUser:u})})}},42673:function(e,n,o){"use strict";var r,t;o.d(n,{Cl:function(){return r},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return a},ph:function(){return s}}),(t=r||(r={})).AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI";let a={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="../ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(a).find(n=>a[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let o=r[n];return{logo:l[o],displayName:o}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let o=a[e];console.log("Provider mapped to: ".concat(o));let r=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&(t.litellm_provider===o||t.litellm_provider.includes(o))&&r.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&"cohere_chat"===o.litellm_provider&&r.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&"sagemaker_chat"===o.litellm_provider&&r.push(n)}))),r}},60493:function(e,n,o){"use strict";o.d(n,{w:function(){return c}});var r=o(57437),t=o(2265),a=o(71594),i=o(24525),l=o(19130);function c(e){let{data:n=[],columns:o,getRowCanExpand:c,renderSubComponent:s,isLoading:u=!1,loadingMessage:p="\uD83D\uDE85 Loading logs...",noDataMessage:d="No logs found"}=e,g=(0,a.b7)({data:n,columns:o,getRowCanExpand:c,getRowId:(e,n)=>{var o;return null!==(o=null==e?void 0:e.request_id)&&void 0!==o?o:String(n)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,r.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,r.jsxs)(l.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,r.jsx)(l.ss,{children:g.getHeaderGroups().map(e=>(0,r.jsx)(l.SC,{children:e.headers.map(e=>(0,r.jsx)(l.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,a.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,r.jsx)(l.RM,{children:u?(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:o.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:p})})})}):g.getRowModel().rows.length>0?g.getRowModel().rows.map(e=>(0,r.jsxs)(t.Fragment,{children:[(0,r.jsx)(l.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,r.jsx)(l.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,r.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:s({row:e})})})})]},e.id)):(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:o.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:d})})})})})]})})}}},function(e){e.O(0,[6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,9343,1264,1116,4688,131,2202,874,4292,3801,2971,2117,1744],function(){return e(e.s=15956)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js index 6f940caf69..ee1308843d 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1664],{18530:function(e,a,s){Promise.resolve().then(s.bind(s,6121))},40728:function(e,a,s){"use strict";s.d(a,{C:function(){return r.Z},x:function(){return t.Z}});var r=s(41649),t=s(84264)},19130:function(e,a,s){"use strict";s.d(a,{RM:function(){return t.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return l.Z},ss:function(){return n.Z},xs:function(){return i.Z}});var r=s(21626),t=s(97214),l=s(28241),n=s(58834),i=s(69552),c=s(71876)},6121:function(e,a,s){"use strict";s.r(a);var r=s(57437),t=s(80443),l=s(11318),n=s(2265),i=s(81598);a.default=()=>{let{token:e,accessToken:a,userRole:s,userId:c,premiumUser:o}=(0,t.Z)(),[d,m]=(0,n.useState)([]),{teams:u}=(0,l.Z)();return(0,r.jsx)(i.Z,{accessToken:a,token:e,userRole:s,userID:c,modelData:{data:[]},keys:d,setModelData:()=>{},premiumUser:o,teams:u})}},84376:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(52787);a.Z=e=>{let{teams:a,value:s,onChange:l,disabled:n}=e;return console.log("disabled",n),(0,r.jsx)(t.default,{showSearch:!0,placeholder:"Search or select a team",value:s,onChange:l,disabled:n,filterOption:(e,s)=>{if(!s)return!1;let r=null==a?void 0:a.find(e=>e.team_id===s.key);if(!r)return!1;let t=e.toLowerCase().trim(),l=(r.team_alias||"").toLowerCase(),n=(r.team_id||"").toLowerCase();return l.includes(t)||n.includes(t)},optionFilterProp:"children",children:null==a?void 0:a.map(e=>(0,r.jsxs)(t.default.Option,{value:e.team_id,children:[(0,r.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,r.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},33860:function(e,a,s){"use strict";var r=s(57437),t=s(2265),l=s(13634),n=s(82680),i=s(52787),c=s(89970),o=s(73002),d=s(7310),m=s.n(d),u=s(19250);a.Z=e=>{let{isVisible:a,onCancel:s,onSubmit:d,accessToken:x,title:g="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:h="user"}=e,[f]=l.Z.useForm(),[v,b]=(0,t.useState)([]),[j,y]=(0,t.useState)(!1),[_,A]=(0,t.useState)("user_email"),N=async(e,a)=>{if(!e){b([]);return}y(!0);try{let s=new URLSearchParams;if(s.append(a,e),null==x)return;let r=(await (0,u.userFilterUICall)(x,s)).map(e=>({label:"user_email"===a?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===a?e.user_email:e.user_id,user:e}));b(r)}catch(e){console.error("Error fetching users:",e)}finally{y(!1)}},I=(0,t.useCallback)(m()((e,a)=>N(e,a),300),[]),w=(e,a)=>{A(a),I(e,a)},C=(e,a)=>{let s=a.user;f.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:f.getFieldValue("role")})};return(0,r.jsx)(n.Z,{title:g,open:a,onCancel:()=>{f.resetFields(),b([]),s()},footer:null,width:800,children:(0,r.jsxs)(l.Z,{form:f,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:h},children:[(0,r.jsx)(l.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,r.jsx)(i.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>w(e,"user_email"),onSelect:(e,a)=>C(e,a),options:"user_email"===_?v:[],loading:j,allowClear:!0})}),(0,r.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,r.jsx)(l.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,r.jsx)(i.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>w(e,"user_id"),onSelect:(e,a)=>C(e,a),options:"user_id"===_?v:[],loading:j,allowClear:!0})}),(0,r.jsx)(l.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,r.jsx)(i.default,{defaultValue:h,children:p.map(e=>(0,r.jsx)(i.default.Option,{value:e.value,children:(0,r.jsxs)(c.Z,{title:e.description,children:[(0,r.jsx)("span",{className:"font-medium",children:e.label}),(0,r.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,r.jsx)("div",{className:"text-right mt-4",children:(0,r.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},27799:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(40728),l=s(82182),n=s(91777),i=s(97434);a.Z=function(e){let{loggingConfigs:a=[],disabledCallbacks:s=[],variant:c="card",className:o=""}=e,d=e=>{var a;return(null===(a=Object.entries(i.Lo).find(a=>{let[s,r]=a;return r===e}))||void 0===a?void 0:a[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,r.jsx)(t.C,{color:"blue",size:"xs",children:a.length})]}),a.length>0?(0,r.jsx)("div",{className:"space-y-3",children:a.map((e,a)=>{var s;let n=d(e.callback_name),c=null===(s=i.Dg[n])||void 0===s?void 0:s.logo;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,r.jsx)("img",{src:c,alt:n,className:"w-5 h-5 object-contain"}):(0,r.jsx)(l.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-medium text-blue-800",children:n}),(0,r.jsxs)(t.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,r.jsx)(t.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(t.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(n.Z,{className:"h-4 w-4 text-red-600"}),(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,r.jsx)(t.C,{color:"red",size:"xs",children:s.length})]}),s.length>0?(0,r.jsx)("div",{className:"space-y-3",children:s.map((e,a)=>{var s;let l=i.RD[e]||e,c=null===(s=i.Dg[l])||void 0===s?void 0:s.logo;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,r.jsx)("img",{src:c,alt:l,className:"w-5 h-5 object-contain"}):(0,r.jsx)(n.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-medium text-red-800",children:l}),(0,r.jsx)(t.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,r.jsx)(t.C,{color:"red",size:"sm",children:"Disabled"})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(t.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===c?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,r.jsx)(t.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,r.jsxs)("div",{className:"".concat(o),children:[(0,r.jsx)(t.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},8048:function(e,a,s){"use strict";s.d(a,{C:function(){return m}});var r=s(57437),t=s(71594),l=s(24525),n=s(2265),i=s(19130),c=s(44633),o=s(86462),d=s(49084);function m(e){let{data:a=[],columns:s,isLoading:m=!1,table:u,defaultSorting:x=[]}=e,[g,p]=n.useState(x),[h]=n.useState("onChange"),[f,v]=n.useState({}),[b,j]=n.useState({}),y=(0,t.b7)({data:a,columns:s,state:{sorting:g,columnSizing:f,columnVisibility:b},columnResizeMode:h,onSortingChange:p,onColumnSizingChange:v,onColumnVisibilityChange:j,getCoreRowModel:(0,l.sC)(),getSortedRowModel:(0,l.tj)(),enableSorting:!0,enableColumnResizing:!0,defaultColumn:{minSize:40,maxSize:500}});return n.useEffect(()=>{u&&(u.current=y)},[y,u]),(0,r.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsx)("div",{className:"relative min-w-full",children:(0,r.jsxs)(i.iA,{className:"[&_td]:py-2 [&_th]:py-2 w-full",children:[(0,r.jsx)(i.ss,{children:y.getHeaderGroups().map(e=>(0,r.jsx)(i.SC,{children:e.headers.map(e=>{var a;return(0,r.jsxs)(i.xs,{className:"py-1 h-8 relative ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(a=e.column.columnDef.meta)||void 0===a?void 0:a.className)||""),style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,t.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,r.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,r.jsx)(c.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,r.jsx)(o.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,r.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"})})]}),e.column.getCanResize()&&(0,r.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ".concat(e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200")})]},e.id)})},e.id))}),(0,r.jsx)(i.RM,{children:m?(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:s.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:"\uD83D\uDE85 Loading models..."})})})}):y.getRowModel().rows.length>0?y.getRowModel().rows.map(e=>(0,r.jsx)(i.SC,{children:e.getVisibleCells().map(e=>{var a;return(0,r.jsx)(i.pj,{className:"py-0.5 ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(a=e.column.columnDef.meta)||void 0===a?void 0:a.className)||""),style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,t.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)):(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:s.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:"No models found"})})})})})]})})})})}},98015:function(e,a,s){"use strict";s.d(a,{Z:function(){return p}});var r=s(57437),t=s(2265),l=s(92280),n=s(40728),i=s(79814),c=s(19250),o=function(e){let{vectorStores:a,accessToken:s}=e,[l,o]=(0,t.useState)([]);(0,t.useEffect)(()=>{(async()=>{if(s&&0!==a.length)try{let e=await (0,c.vectorStoreListCall)(s);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[s,a.length]);let d=e=>{let a=l.find(a=>a.vector_store_id===e);return a?"".concat(a.vector_store_name||a.vector_store_id," (").concat(a.vector_store_id,")"):e};return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(n.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,r.jsx)(n.C,{color:"blue",size:"xs",children:a.length})]}),a.length>0?(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map((e,a)=>(0,r.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:d(e)},a))}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(n.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},d=s(25327),m=s(86462),u=s(47686),x=s(89970),g=function(e){let{mcpServers:a,mcpAccessGroups:l=[],mcpToolPermissions:i={},accessToken:o}=e,[g,p]=(0,t.useState)([]),[h,f]=(0,t.useState)([]),[v,b]=(0,t.useState)(new Set),j=e=>{b(a=>{let s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s})};(0,t.useEffect)(()=>{(async()=>{if(o&&a.length>0)try{let e=await (0,c.fetchMCPServers)(o);e&&Array.isArray(e)?p(e):e.data&&Array.isArray(e.data)&&p(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,a.length]),(0,t.useEffect)(()=>{(async()=>{if(o&&l.length>0)try{let e=await Promise.resolve().then(s.bind(s,19250)).then(e=>e.fetchMCPAccessGroups(o));f(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,l.length]);let y=e=>{let a=g.find(a=>a.server_id===e);if(a){let s=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(a.alias," (").concat(s,")")}return e},_=e=>e,A=[...a.map(e=>({type:"server",value:e})),...l.map(e=>({type:"accessGroup",value:e}))],N=A.length;return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(n.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,r.jsx)(n.C,{color:"blue",size:"xs",children:N})]}),N>0?(0,r.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:A.map((e,a)=>{let s="server"===e.type?i[e.value]:void 0,t=s&&s.length>0,l=v.has(e.value);return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{onClick:()=>t&&j(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(t?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,r.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:y(e.value)})]})}):(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)}),(0,r.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),t&&(0,r.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-gray-600",children:s.length}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:1===s.length?"tool":"tools"}),l?(0,r.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,r.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),t&&l&&(0,r.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.map((e,a)=>(0,r.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},a))})})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(n.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},p=function(e){let{objectPermission:a,variant:s="card",className:t="",accessToken:n}=e,i=(null==a?void 0:a.vector_stores)||[],c=(null==a?void 0:a.mcp_servers)||[],d=(null==a?void 0:a.mcp_access_groups)||[],m=(null==a?void 0:a.mcp_tool_permissions)||{},u=(0,r.jsxs)("div",{className:"card"===s?"grid grid-cols-1 md:grid-cols-2 gap-6":"space-y-4",children:[(0,r.jsx)(o,{vectorStores:i,accessToken:n}),(0,r.jsx)(g,{mcpServers:c,mcpAccessGroups:d,mcpToolPermissions:m,accessToken:n})]});return"card"===s?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(t),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,r.jsx)(l.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),u]}):(0,r.jsxs)("div",{className:"".concat(t),children:[(0,r.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),u]})}},42673:function(e,a,s){"use strict";var r,t;s.d(a,{Cl:function(){return r},bK:function(){return d},cd:function(){return i},dr:function(){return c},fK:function(){return l},ph:function(){return o}}),(t=r||(r={})).AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI";let l={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},n="/ui/assets/logos/",i={"AI/ML API":"".concat(n,"aiml_api.svg"),Anthropic:"".concat(n,"anthropic.svg"),AssemblyAI:"".concat(n,"assemblyai_small.png"),Azure:"".concat(n,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(n,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(n,"bedrock.svg"),"AWS SageMaker":"".concat(n,"bedrock.svg"),Cerebras:"".concat(n,"cerebras.svg"),Cohere:"".concat(n,"cohere.svg"),"Databricks (Qwen API)":"".concat(n,"databricks.svg"),Dashscope:"".concat(n,"dashscope.svg"),Deepseek:"".concat(n,"deepseek.svg"),"Fireworks AI":"".concat(n,"fireworks.svg"),Groq:"".concat(n,"groq.svg"),"Google AI Studio":"".concat(n,"google.svg"),vllm:"".concat(n,"vllm.png"),Infinity:"".concat(n,"infinity.png"),"Mistral AI":"".concat(n,"mistral.svg"),Ollama:"".concat(n,"ollama.svg"),OpenAI:"".concat(n,"openai_small.svg"),"OpenAI Text Completion":"".concat(n,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(n,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(n,"openai_small.svg"),Openrouter:"".concat(n,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(n,"oracle.svg"),Perplexity:"".concat(n,"perplexity-ai.svg"),Sambanova:"".concat(n,"sambanova.svg"),Snowflake:"".concat(n,"snowflake.svg"),TogetherAI:"".concat(n,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(n,"google.svg"),xAI:"".concat(n,"xai.svg"),GradientAI:"".concat(n,"gradientai.svg"),Triton:"".concat(n,"nvidia_triton.png"),Deepgram:"".concat(n,"deepgram.png"),ElevenLabs:"".concat(n,"elevenlabs.png"),"Fal AI":"".concat(n,"fal_ai.jpg"),"Voyage AI":"".concat(n,"voyage.webp"),"Jina AI":"".concat(n,"jina.png"),VolcEngine:"".concat(n,"volcengine.png"),DeepInfra:"".concat(n,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:i[e],displayName:e}}let a=Object.keys(l).find(a=>l[a].toLowerCase()===e.toLowerCase());if(!a)return{logo:"",displayName:e};let s=r[a];return{logo:i[s],displayName:s}},o=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},d=(e,a)=>{console.log("Provider key: ".concat(e));let s=l[e];console.log("Provider mapped to: ".concat(s));let r=[];return e&&"object"==typeof a&&(Object.entries(a).forEach(e=>{let[a,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&(t.litellm_provider===s||t.litellm_provider.includes(s))&&r.push(a)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(a).forEach(e=>{let[a,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&"cohere_chat"===s.litellm_provider&&r.push(a)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(a).forEach(e=>{let[a,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&"sagemaker_chat"===s.litellm_provider&&r.push(a)}))),r}},21425:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(54507);a.Z=e=>{let{value:a,onChange:s,disabledCallbacks:l=[],onDisabledCallbacksChange:n}=e;return(0,r.jsx)(t.Z,{value:a,onChange:s,disabledCallbacks:l,onDisabledCallbacksChange:n})}},10901:function(e,a,s){"use strict";s.d(a,{Z:function(){return x}});var r=s(57437),t=s(2265),l=s(13634),n=s(82680),i=s(73002),c=s(27281),o=s(57365),d=s(49566),m=s(92280),u=s(24199),x=e=>{var a,s,x;let{visible:g,onCancel:p,onSubmit:h,initialData:f,mode:v,config:b}=e,[j]=l.Z.useForm();console.log("Initial Data:",f),(0,t.useEffect)(()=>{if(g){if("edit"===v&&f){let e={...f,role:f.role||b.defaultRole,max_budget_in_team:f.max_budget_in_team||null,tpm_limit:f.tpm_limit||null,rpm_limit:f.rpm_limit||null};console.log("Setting form values:",e),j.setFieldsValue(e)}else{var e;j.resetFields(),j.setFieldsValue({role:b.defaultRole||(null===(e=b.roleOptions[0])||void 0===e?void 0:e.value)})}}},[g,f,v,j,b.defaultRole,b.roleOptions]);let y=async e=>{try{let a=Object.entries(e).reduce((e,a)=>{let[s,r]=a;if("string"==typeof r){let a=r.trim();return""===a&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:a}}return{...e,[s]:r}},{});console.log("Submitting form data:",a),h(a),j.resetFields()}catch(e){console.error("Form submission error:",e)}},_=e=>{switch(e.type){case"input":return(0,r.jsx)(d.Z,{placeholder:e.placeholder});case"numerical":return(0,r.jsx)(u.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var a;return(0,r.jsx)(c.Z,{children:null===(a=e.options)||void 0===a?void 0:a.map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value))});default:return null}};return(0,r.jsx)(n.Z,{title:b.title||("add"===v?"Add Member":"Edit Member"),open:g,width:1e3,footer:null,onCancel:p,children:(0,r.jsxs)(l.Z,{form:j,onFinish:y,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[b.showEmail&&(0,r.jsx)(l.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,r.jsx)(d.Z,{placeholder:"user@example.com"})}),b.showEmail&&b.showUserId&&(0,r.jsx)("div",{className:"text-center mb-4",children:(0,r.jsx)(m.x,{children:"OR"})}),b.showUserId&&(0,r.jsx)(l.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,r.jsx)(d.Z,{placeholder:"user_123"})}),(0,r.jsx)(l.Z.Item,{label:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{children:"Role"}),"edit"===v&&f&&(0,r.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=f.role,(null===(x=b.roleOptions.find(e=>e.value===s))||void 0===x?void 0:x.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,r.jsx)(c.Z,{children:"edit"===v&&f?[...b.roleOptions.filter(e=>e.value===f.role),...b.roleOptions.filter(e=>e.value!==f.role)].map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value)):b.roleOptions.map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value))})}),null===(a=b.additionalFields)||void 0===a?void 0:a.map(e=>(0,r.jsx)(l.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:_(e)},e.name)),(0,r.jsxs)("div",{className:"text-right mt-6",children:[(0,r.jsx)(i.ZP,{onClick:p,className:"mr-2",children:"Cancel"}),(0,r.jsx)(i.ZP,{type:"default",htmlType:"submit",children:"add"===v?"Add Member":"Save Changes"})]})]})})}},33304:function(e,a,s){"use strict";function r(e){return""===e?null:e}s.d(a,{C:function(){return r}})}},function(e){e.O(0,[1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,7281,8077,2344,1487,7732,4851,722,1486,4688,131,2012,1598,2971,2117,1744],function(){return e(e.s=18530)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1664],{18530:function(e,a,s){Promise.resolve().then(s.bind(s,6121))},40728:function(e,a,s){"use strict";s.d(a,{C:function(){return r.Z},x:function(){return t.Z}});var r=s(41649),t=s(84264)},19130:function(e,a,s){"use strict";s.d(a,{RM:function(){return t.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return l.Z},ss:function(){return n.Z},xs:function(){return i.Z}});var r=s(21626),t=s(97214),l=s(28241),n=s(58834),i=s(69552),c=s(71876)},6121:function(e,a,s){"use strict";s.r(a);var r=s(57437),t=s(80443),l=s(11318),n=s(2265),i=s(81598);a.default=()=>{let{token:e,accessToken:a,userRole:s,userId:c,premiumUser:o}=(0,t.Z)(),[d,m]=(0,n.useState)([]),{teams:u}=(0,l.Z)();return(0,r.jsx)(i.Z,{accessToken:a,token:e,userRole:s,userID:c,modelData:{data:[]},keys:d,setModelData:()=>{},premiumUser:o,teams:u})}},84376:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(52787);a.Z=e=>{let{teams:a,value:s,onChange:l,disabled:n}=e;return console.log("disabled",n),(0,r.jsx)(t.default,{showSearch:!0,placeholder:"Search or select a team",value:s,onChange:l,disabled:n,filterOption:(e,s)=>{if(!s)return!1;let r=null==a?void 0:a.find(e=>e.team_id===s.key);if(!r)return!1;let t=e.toLowerCase().trim(),l=(r.team_alias||"").toLowerCase(),n=(r.team_id||"").toLowerCase();return l.includes(t)||n.includes(t)},optionFilterProp:"children",children:null==a?void 0:a.map(e=>(0,r.jsxs)(t.default.Option,{value:e.team_id,children:[(0,r.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,r.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},33860:function(e,a,s){"use strict";var r=s(57437),t=s(2265),l=s(13634),n=s(82680),i=s(52787),c=s(89970),o=s(73002),d=s(7310),m=s.n(d),u=s(19250);a.Z=e=>{let{isVisible:a,onCancel:s,onSubmit:d,accessToken:x,title:g="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:h="user"}=e,[f]=l.Z.useForm(),[v,b]=(0,t.useState)([]),[j,y]=(0,t.useState)(!1),[_,A]=(0,t.useState)("user_email"),N=async(e,a)=>{if(!e){b([]);return}y(!0);try{let s=new URLSearchParams;if(s.append(a,e),null==x)return;let r=(await (0,u.userFilterUICall)(x,s)).map(e=>({label:"user_email"===a?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===a?e.user_email:e.user_id,user:e}));b(r)}catch(e){console.error("Error fetching users:",e)}finally{y(!1)}},I=(0,t.useCallback)(m()((e,a)=>N(e,a),300),[]),w=(e,a)=>{A(a),I(e,a)},C=(e,a)=>{let s=a.user;f.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:f.getFieldValue("role")})};return(0,r.jsx)(n.Z,{title:g,open:a,onCancel:()=>{f.resetFields(),b([]),s()},footer:null,width:800,children:(0,r.jsxs)(l.Z,{form:f,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:h},children:[(0,r.jsx)(l.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,r.jsx)(i.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>w(e,"user_email"),onSelect:(e,a)=>C(e,a),options:"user_email"===_?v:[],loading:j,allowClear:!0})}),(0,r.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,r.jsx)(l.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,r.jsx)(i.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>w(e,"user_id"),onSelect:(e,a)=>C(e,a),options:"user_id"===_?v:[],loading:j,allowClear:!0})}),(0,r.jsx)(l.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,r.jsx)(i.default,{defaultValue:h,children:p.map(e=>(0,r.jsx)(i.default.Option,{value:e.value,children:(0,r.jsxs)(c.Z,{title:e.description,children:[(0,r.jsx)("span",{className:"font-medium",children:e.label}),(0,r.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,r.jsx)("div",{className:"text-right mt-4",children:(0,r.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},27799:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(40728),l=s(82182),n=s(91777),i=s(97434);a.Z=function(e){let{loggingConfigs:a=[],disabledCallbacks:s=[],variant:c="card",className:o=""}=e,d=e=>{var a;return(null===(a=Object.entries(i.Lo).find(a=>{let[s,r]=a;return r===e}))||void 0===a?void 0:a[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,r.jsx)(t.C,{color:"blue",size:"xs",children:a.length})]}),a.length>0?(0,r.jsx)("div",{className:"space-y-3",children:a.map((e,a)=>{var s;let n=d(e.callback_name),c=null===(s=i.Dg[n])||void 0===s?void 0:s.logo;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,r.jsx)("img",{src:c,alt:n,className:"w-5 h-5 object-contain"}):(0,r.jsx)(l.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-medium text-blue-800",children:n}),(0,r.jsxs)(t.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,r.jsx)(t.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(t.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(n.Z,{className:"h-4 w-4 text-red-600"}),(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,r.jsx)(t.C,{color:"red",size:"xs",children:s.length})]}),s.length>0?(0,r.jsx)("div",{className:"space-y-3",children:s.map((e,a)=>{var s;let l=i.RD[e]||e,c=null===(s=i.Dg[l])||void 0===s?void 0:s.logo;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,r.jsx)("img",{src:c,alt:l,className:"w-5 h-5 object-contain"}):(0,r.jsx)(n.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-medium text-red-800",children:l}),(0,r.jsx)(t.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,r.jsx)(t.C,{color:"red",size:"sm",children:"Disabled"})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(t.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===c?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,r.jsx)(t.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,r.jsxs)("div",{className:"".concat(o),children:[(0,r.jsx)(t.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},8048:function(e,a,s){"use strict";s.d(a,{C:function(){return m}});var r=s(57437),t=s(71594),l=s(24525),n=s(2265),i=s(19130),c=s(44633),o=s(86462),d=s(49084);function m(e){let{data:a=[],columns:s,isLoading:m=!1,table:u,defaultSorting:x=[]}=e,[g,p]=n.useState(x),[h]=n.useState("onChange"),[f,v]=n.useState({}),[b,j]=n.useState({}),y=(0,t.b7)({data:a,columns:s,state:{sorting:g,columnSizing:f,columnVisibility:b},columnResizeMode:h,onSortingChange:p,onColumnSizingChange:v,onColumnVisibilityChange:j,getCoreRowModel:(0,l.sC)(),getSortedRowModel:(0,l.tj)(),enableSorting:!0,enableColumnResizing:!0,defaultColumn:{minSize:40,maxSize:500}});return n.useEffect(()=>{u&&(u.current=y)},[y,u]),(0,r.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsx)("div",{className:"relative min-w-full",children:(0,r.jsxs)(i.iA,{className:"[&_td]:py-2 [&_th]:py-2 w-full",children:[(0,r.jsx)(i.ss,{children:y.getHeaderGroups().map(e=>(0,r.jsx)(i.SC,{children:e.headers.map(e=>{var a;return(0,r.jsxs)(i.xs,{className:"py-1 h-8 relative ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(a=e.column.columnDef.meta)||void 0===a?void 0:a.className)||""),style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,t.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,r.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,r.jsx)(c.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,r.jsx)(o.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,r.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"})})]}),e.column.getCanResize()&&(0,r.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ".concat(e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200")})]},e.id)})},e.id))}),(0,r.jsx)(i.RM,{children:m?(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:s.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:"\uD83D\uDE85 Loading models..."})})})}):y.getRowModel().rows.length>0?y.getRowModel().rows.map(e=>(0,r.jsx)(i.SC,{children:e.getVisibleCells().map(e=>{var a;return(0,r.jsx)(i.pj,{className:"py-0.5 ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(a=e.column.columnDef.meta)||void 0===a?void 0:a.className)||""),style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,t.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)):(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:s.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:"No models found"})})})})})]})})})})}},98015:function(e,a,s){"use strict";s.d(a,{Z:function(){return p}});var r=s(57437),t=s(2265),l=s(92280),n=s(40728),i=s(79814),c=s(19250),o=function(e){let{vectorStores:a,accessToken:s}=e,[l,o]=(0,t.useState)([]);(0,t.useEffect)(()=>{(async()=>{if(s&&0!==a.length)try{let e=await (0,c.vectorStoreListCall)(s);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[s,a.length]);let d=e=>{let a=l.find(a=>a.vector_store_id===e);return a?"".concat(a.vector_store_name||a.vector_store_id," (").concat(a.vector_store_id,")"):e};return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(n.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,r.jsx)(n.C,{color:"blue",size:"xs",children:a.length})]}),a.length>0?(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map((e,a)=>(0,r.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:d(e)},a))}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(n.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},d=s(25327),m=s(86462),u=s(47686),x=s(89970),g=function(e){let{mcpServers:a,mcpAccessGroups:l=[],mcpToolPermissions:i={},accessToken:o}=e,[g,p]=(0,t.useState)([]),[h,f]=(0,t.useState)([]),[v,b]=(0,t.useState)(new Set),j=e=>{b(a=>{let s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s})};(0,t.useEffect)(()=>{(async()=>{if(o&&a.length>0)try{let e=await (0,c.fetchMCPServers)(o);e&&Array.isArray(e)?p(e):e.data&&Array.isArray(e.data)&&p(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,a.length]),(0,t.useEffect)(()=>{(async()=>{if(o&&l.length>0)try{let e=await Promise.resolve().then(s.bind(s,19250)).then(e=>e.fetchMCPAccessGroups(o));f(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,l.length]);let y=e=>{let a=g.find(a=>a.server_id===e);if(a){let s=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(a.alias," (").concat(s,")")}return e},_=e=>e,A=[...a.map(e=>({type:"server",value:e})),...l.map(e=>({type:"accessGroup",value:e}))],N=A.length;return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(n.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,r.jsx)(n.C,{color:"blue",size:"xs",children:N})]}),N>0?(0,r.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:A.map((e,a)=>{let s="server"===e.type?i[e.value]:void 0,t=s&&s.length>0,l=v.has(e.value);return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{onClick:()=>t&&j(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(t?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,r.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:y(e.value)})]})}):(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)}),(0,r.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),t&&(0,r.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-gray-600",children:s.length}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:1===s.length?"tool":"tools"}),l?(0,r.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,r.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),t&&l&&(0,r.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.map((e,a)=>(0,r.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},a))})})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(n.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},p=function(e){let{objectPermission:a,variant:s="card",className:t="",accessToken:n}=e,i=(null==a?void 0:a.vector_stores)||[],c=(null==a?void 0:a.mcp_servers)||[],d=(null==a?void 0:a.mcp_access_groups)||[],m=(null==a?void 0:a.mcp_tool_permissions)||{},u=(0,r.jsxs)("div",{className:"card"===s?"grid grid-cols-1 md:grid-cols-2 gap-6":"space-y-4",children:[(0,r.jsx)(o,{vectorStores:i,accessToken:n}),(0,r.jsx)(g,{mcpServers:c,mcpAccessGroups:d,mcpToolPermissions:m,accessToken:n})]});return"card"===s?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(t),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,r.jsx)(l.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),u]}):(0,r.jsxs)("div",{className:"".concat(t),children:[(0,r.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),u]})}},42673:function(e,a,s){"use strict";var r,t;s.d(a,{Cl:function(){return r},bK:function(){return d},cd:function(){return i},dr:function(){return c},fK:function(){return l},ph:function(){return o}}),(t=r||(r={})).AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI";let l={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},n="../ui/assets/logos/",i={"AI/ML API":"".concat(n,"aiml_api.svg"),Anthropic:"".concat(n,"anthropic.svg"),AssemblyAI:"".concat(n,"assemblyai_small.png"),Azure:"".concat(n,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(n,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(n,"bedrock.svg"),"AWS SageMaker":"".concat(n,"bedrock.svg"),Cerebras:"".concat(n,"cerebras.svg"),Cohere:"".concat(n,"cohere.svg"),"Databricks (Qwen API)":"".concat(n,"databricks.svg"),Dashscope:"".concat(n,"dashscope.svg"),Deepseek:"".concat(n,"deepseek.svg"),"Fireworks AI":"".concat(n,"fireworks.svg"),Groq:"".concat(n,"groq.svg"),"Google AI Studio":"".concat(n,"google.svg"),vllm:"".concat(n,"vllm.png"),Infinity:"".concat(n,"infinity.png"),"Mistral AI":"".concat(n,"mistral.svg"),Ollama:"".concat(n,"ollama.svg"),OpenAI:"".concat(n,"openai_small.svg"),"OpenAI Text Completion":"".concat(n,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(n,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(n,"openai_small.svg"),Openrouter:"".concat(n,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(n,"oracle.svg"),Perplexity:"".concat(n,"perplexity-ai.svg"),Sambanova:"".concat(n,"sambanova.svg"),Snowflake:"".concat(n,"snowflake.svg"),TogetherAI:"".concat(n,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(n,"google.svg"),xAI:"".concat(n,"xai.svg"),GradientAI:"".concat(n,"gradientai.svg"),Triton:"".concat(n,"nvidia_triton.png"),Deepgram:"".concat(n,"deepgram.png"),ElevenLabs:"".concat(n,"elevenlabs.png"),"Fal AI":"".concat(n,"fal_ai.jpg"),"Voyage AI":"".concat(n,"voyage.webp"),"Jina AI":"".concat(n,"jina.png"),VolcEngine:"".concat(n,"volcengine.png"),DeepInfra:"".concat(n,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:i[e],displayName:e}}let a=Object.keys(l).find(a=>l[a].toLowerCase()===e.toLowerCase());if(!a)return{logo:"",displayName:e};let s=r[a];return{logo:i[s],displayName:s}},o=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},d=(e,a)=>{console.log("Provider key: ".concat(e));let s=l[e];console.log("Provider mapped to: ".concat(s));let r=[];return e&&"object"==typeof a&&(Object.entries(a).forEach(e=>{let[a,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&(t.litellm_provider===s||t.litellm_provider.includes(s))&&r.push(a)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(a).forEach(e=>{let[a,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&"cohere_chat"===s.litellm_provider&&r.push(a)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(a).forEach(e=>{let[a,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&"sagemaker_chat"===s.litellm_provider&&r.push(a)}))),r}},21425:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(54507);a.Z=e=>{let{value:a,onChange:s,disabledCallbacks:l=[],onDisabledCallbacksChange:n}=e;return(0,r.jsx)(t.Z,{value:a,onChange:s,disabledCallbacks:l,onDisabledCallbacksChange:n})}},10901:function(e,a,s){"use strict";s.d(a,{Z:function(){return x}});var r=s(57437),t=s(2265),l=s(13634),n=s(82680),i=s(73002),c=s(27281),o=s(57365),d=s(49566),m=s(92280),u=s(24199),x=e=>{var a,s,x;let{visible:g,onCancel:p,onSubmit:h,initialData:f,mode:v,config:b}=e,[j]=l.Z.useForm();console.log("Initial Data:",f),(0,t.useEffect)(()=>{if(g){if("edit"===v&&f){let e={...f,role:f.role||b.defaultRole,max_budget_in_team:f.max_budget_in_team||null,tpm_limit:f.tpm_limit||null,rpm_limit:f.rpm_limit||null};console.log("Setting form values:",e),j.setFieldsValue(e)}else{var e;j.resetFields(),j.setFieldsValue({role:b.defaultRole||(null===(e=b.roleOptions[0])||void 0===e?void 0:e.value)})}}},[g,f,v,j,b.defaultRole,b.roleOptions]);let y=async e=>{try{let a=Object.entries(e).reduce((e,a)=>{let[s,r]=a;if("string"==typeof r){let a=r.trim();return""===a&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:a}}return{...e,[s]:r}},{});console.log("Submitting form data:",a),h(a),j.resetFields()}catch(e){console.error("Form submission error:",e)}},_=e=>{switch(e.type){case"input":return(0,r.jsx)(d.Z,{placeholder:e.placeholder});case"numerical":return(0,r.jsx)(u.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var a;return(0,r.jsx)(c.Z,{children:null===(a=e.options)||void 0===a?void 0:a.map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value))});default:return null}};return(0,r.jsx)(n.Z,{title:b.title||("add"===v?"Add Member":"Edit Member"),open:g,width:1e3,footer:null,onCancel:p,children:(0,r.jsxs)(l.Z,{form:j,onFinish:y,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[b.showEmail&&(0,r.jsx)(l.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,r.jsx)(d.Z,{placeholder:"user@example.com"})}),b.showEmail&&b.showUserId&&(0,r.jsx)("div",{className:"text-center mb-4",children:(0,r.jsx)(m.x,{children:"OR"})}),b.showUserId&&(0,r.jsx)(l.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,r.jsx)(d.Z,{placeholder:"user_123"})}),(0,r.jsx)(l.Z.Item,{label:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{children:"Role"}),"edit"===v&&f&&(0,r.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=f.role,(null===(x=b.roleOptions.find(e=>e.value===s))||void 0===x?void 0:x.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,r.jsx)(c.Z,{children:"edit"===v&&f?[...b.roleOptions.filter(e=>e.value===f.role),...b.roleOptions.filter(e=>e.value!==f.role)].map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value)):b.roleOptions.map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value))})}),null===(a=b.additionalFields)||void 0===a?void 0:a.map(e=>(0,r.jsx)(l.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:_(e)},e.name)),(0,r.jsxs)("div",{className:"text-right mt-6",children:[(0,r.jsx)(i.ZP,{onClick:p,className:"mr-2",children:"Cancel"}),(0,r.jsx)(i.ZP,{type:"default",htmlType:"submit",children:"add"===v?"Add Member":"Save Changes"})]})]})})}},33304:function(e,a,s){"use strict";function r(e){return""===e?null:e}s.d(a,{C:function(){return r}})}},function(e){e.O(0,[1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,7281,8077,2344,1487,7732,4851,722,1486,4688,131,2012,1598,2971,2117,1744],function(){return e(e.s=18530)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9879d5f79e798cff.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9879d5f79e798cff.js index 3692bddd78..1c5be3e194 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9879d5f79e798cff.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9879d5f79e798cff.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2445],{96354:function(e,n,a){Promise.resolve().then(a.bind(a,72719))},80443:function(e,n,a){"use strict";var t=a(2265),r=a(99376),s=a(14474),i=a(3914);n.Z=()=>{var e,n,a,o,l,g,u;let _=(0,r.useRouter)(),p="undefined"!=typeof document?(0,i.e)("token"):null;(0,t.useEffect)(()=>{p||_.replace("/sso/key/generate")},[p,_]);let d=(0,t.useMemo)(()=>{if(!p)return null;try{return(0,s.o)(p)}catch(e){return(0,i.b)(),_.replace("/sso/key/generate"),null}},[p,_]);return{token:p,accessToken:null!==(e=null==d?void 0:d.key)&&void 0!==e?e:null,userId:null!==(n=null==d?void 0:d.user_id)&&void 0!==n?n:null,userEmail:null!==(a=null==d?void 0:d.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(o=null==d?void 0:d.user_role)&&void 0!==o?o:null),premiumUser:null!==(l=null==d?void 0:d.premium_user)&&void 0!==l?l:null,disabledPersonalKeyCreation:null!==(g=null==d?void 0:d.disabled_non_admin_personal_key_creation)&&void 0!==g?g:null,showSSOBanner:(null==d?void 0:d.login_method)==="username_password"}}},72719:function(e,n,a){"use strict";a.r(n);var t=a(57437),r=a(6925),s=a(80443);n.default=()=>{let{accessToken:e,userRole:n,userId:a,premiumUser:i}=(0,s.Z)();return(0,t.jsx)(r.Z,{accessToken:e,userRole:n,userID:a,premiumUser:i})}},97434:function(e,n,a){"use strict";a.d(n,{Dg:function(){return s},Lo:function(){return i},O0:function(){return r},PA:function(){return g},RD:function(){return o},Z3:function(){return l},_3:function(){return u}});let t="/ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(t,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(t,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(t,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(t,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(t,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(t,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(t,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(t,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(t,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(t,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(t,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"}],s=r.reduce((e,n)=>(e[n.displayName]=n,e),{}),i=r.reduce((e,n)=>(e[n.displayName]=n.id,e),{}),o=r.reduce((e,n)=>(e[n.id]=n.displayName,e),{}),l=e=>e.map(e=>i[e]||e),g=e=>e.map(e=>o[e]||e),u=e=>r.find(n=>n.id===e)}},function(e){e.O(0,[1114,1491,4556,2417,2926,9775,2284,7908,9678,226,4688,6925,2971,2117,1744],function(){return e(e.s=96354)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2445],{96354:function(e,n,a){Promise.resolve().then(a.bind(a,72719))},80443:function(e,n,a){"use strict";var t=a(2265),r=a(99376),s=a(14474),i=a(3914);n.Z=()=>{var e,n,a,o,l,g,u;let _=(0,r.useRouter)(),p="undefined"!=typeof document?(0,i.e)("token"):null;(0,t.useEffect)(()=>{p||_.replace("/sso/key/generate")},[p,_]);let d=(0,t.useMemo)(()=>{if(!p)return null;try{return(0,s.o)(p)}catch(e){return(0,i.b)(),_.replace("/sso/key/generate"),null}},[p,_]);return{token:p,accessToken:null!==(e=null==d?void 0:d.key)&&void 0!==e?e:null,userId:null!==(n=null==d?void 0:d.user_id)&&void 0!==n?n:null,userEmail:null!==(a=null==d?void 0:d.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(o=null==d?void 0:d.user_role)&&void 0!==o?o:null),premiumUser:null!==(l=null==d?void 0:d.premium_user)&&void 0!==l?l:null,disabledPersonalKeyCreation:null!==(g=null==d?void 0:d.disabled_non_admin_personal_key_creation)&&void 0!==g?g:null,showSSOBanner:(null==d?void 0:d.login_method)==="username_password"}}},72719:function(e,n,a){"use strict";a.r(n);var t=a(57437),r=a(6925),s=a(80443);n.default=()=>{let{accessToken:e,userRole:n,userId:a,premiumUser:i}=(0,s.Z)();return(0,t.jsx)(r.Z,{accessToken:e,userRole:n,userID:a,premiumUser:i})}},97434:function(e,n,a){"use strict";a.d(n,{Dg:function(){return s},Lo:function(){return i},O0:function(){return r},PA:function(){return g},RD:function(){return o},Z3:function(){return l},_3:function(){return u}});let t="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(t,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(t,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(t,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(t,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(t,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(t,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(t,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(t,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(t,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(t,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(t,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"}],s=r.reduce((e,n)=>(e[n.displayName]=n,e),{}),i=r.reduce((e,n)=>(e[n.displayName]=n.id,e),{}),o=r.reduce((e,n)=>(e[n.id]=n.displayName,e),{}),l=e=>e.map(e=>i[e]||e),g=e=>e.map(e=>o[e]||e),u=e=>r.find(n=>n.id===e)}},function(e){e.O(0,[1114,1491,4556,2417,2926,9775,2284,7908,9678,226,4688,6925,2971,2117,1744],function(){return e(e.s=96354)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js index 4b4b71c959..820b34bec9 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6248],{64362:function(e,n,r){Promise.resolve().then(r.bind(r,77438))},16312:function(e,n,r){"use strict";r.d(n,{z:function(){return o.Z}});var o=r(20831)},64504:function(e,n,r){"use strict";r.d(n,{o:function(){return a.Z},z:function(){return o.Z}});var o=r(20831),a=r(49566)},80443:function(e,n,r){"use strict";var o=r(2265),a=r(99376),t=r(14474),i=r(3914);n.Z=()=>{var e,n,r,l,c,s,u;let p=(0,a.useRouter)(),d="undefined"!=typeof document?(0,i.e)("token"):null;(0,o.useEffect)(()=>{d||p.replace("/sso/key/generate")},[d,p]);let A=(0,o.useMemo)(()=>{if(!d)return null;try{return(0,t.o)(d)}catch(e){return(0,i.b)(),p.replace("/sso/key/generate"),null}},[d,p]);return{token:d,accessToken:null!==(e=null==A?void 0:A.key)&&void 0!==e?e:null,userId:null!==(n=null==A?void 0:A.user_id)&&void 0!==n?n:null,userEmail:null!==(r=null==A?void 0:A.user_email)&&void 0!==r?r:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(l=null==A?void 0:A.user_role)&&void 0!==l?l:null),premiumUser:null!==(c=null==A?void 0:A.premium_user)&&void 0!==c?c:null,disabledPersonalKeyCreation:null!==(s=null==A?void 0:A.disabled_non_admin_personal_key_creation)&&void 0!==s?s:null,showSSOBanner:(null==A?void 0:A.login_method)==="username_password"}}},77438:function(e,n,r){"use strict";r.r(n);var o=r(57437),a=r(6204),t=r(80443);n.default=()=>{let{accessToken:e,userId:n,userRole:r}=(0,t.Z)();return(0,o.jsx)(a.Z,{accessToken:e,userID:n,userRole:r})}},42673:function(e,n,r){"use strict";var o,a;r.d(n,{Cl:function(){return o},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return t},ph:function(){return s}}),(a=o||(o={})).AIML="AI/ML API",a.Bedrock="Amazon Bedrock",a.Anthropic="Anthropic",a.AssemblyAI="AssemblyAI",a.SageMaker="AWS SageMaker",a.Azure="Azure",a.Azure_AI_Studio="Azure AI Foundry (Studio)",a.Cerebras="Cerebras",a.Cohere="Cohere",a.Dashscope="Dashscope",a.Databricks="Databricks (Qwen API)",a.DeepInfra="DeepInfra",a.Deepgram="Deepgram",a.Deepseek="Deepseek",a.ElevenLabs="ElevenLabs",a.FalAI="Fal AI",a.FireworksAI="Fireworks AI",a.Google_AI_Studio="Google AI Studio",a.GradientAI="GradientAI",a.Groq="Groq",a.Hosted_Vllm="vllm",a.Infinity="Infinity",a.JinaAI="Jina AI",a.MistralAI="Mistral AI",a.Ollama="Ollama",a.OpenAI="OpenAI",a.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",a.OpenAI_Text="OpenAI Text Completion",a.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",a.Openrouter="Openrouter",a.Oracle="Oracle Cloud Infrastructure (OCI)",a.Perplexity="Perplexity",a.Sambanova="Sambanova",a.Snowflake="Snowflake",a.TogetherAI="TogetherAI",a.Triton="Triton",a.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",a.VolcEngine="VolcEngine",a.Voyage="Voyage AI",a.xAI="xAI";let t={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="/ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(t).find(n=>t[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let r=o[n];return{logo:l[r],displayName:r}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let r=t[e];console.log("Provider mapped to: ".concat(r));let o=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,a]=e;null!==a&&"object"==typeof a&&"litellm_provider"in a&&(a.litellm_provider===r||a.litellm_provider.includes(r))&&o.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,r]=e;null!==r&&"object"==typeof r&&"litellm_provider"in r&&"cohere_chat"===r.litellm_provider&&o.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,r]=e;null!==r&&"object"==typeof r&&"litellm_provider"in r&&"sagemaker_chat"===r.litellm_provider&&o.push(n)}))),o}},20347:function(e,n,r){"use strict";r.d(n,{LQ:function(){return t},ZL:function(){return o},lo:function(){return a},tY:function(){return i}});let o=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],a=["Internal User","Internal Viewer"],t=["Internal User","Admin","proxy_admin"],i=e=>o.includes(e)}},function(e){e.O(0,[1114,1491,4556,2417,2926,1529,9775,2525,7908,8077,704,4688,6204,2971,2117,1744],function(){return e(e.s=64362)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6248],{64362:function(e,n,r){Promise.resolve().then(r.bind(r,77438))},16312:function(e,n,r){"use strict";r.d(n,{z:function(){return o.Z}});var o=r(20831)},64504:function(e,n,r){"use strict";r.d(n,{o:function(){return a.Z},z:function(){return o.Z}});var o=r(20831),a=r(49566)},80443:function(e,n,r){"use strict";var o=r(2265),a=r(99376),t=r(14474),i=r(3914);n.Z=()=>{var e,n,r,l,c,s,u;let p=(0,a.useRouter)(),d="undefined"!=typeof document?(0,i.e)("token"):null;(0,o.useEffect)(()=>{d||p.replace("/sso/key/generate")},[d,p]);let A=(0,o.useMemo)(()=>{if(!d)return null;try{return(0,t.o)(d)}catch(e){return(0,i.b)(),p.replace("/sso/key/generate"),null}},[d,p]);return{token:d,accessToken:null!==(e=null==A?void 0:A.key)&&void 0!==e?e:null,userId:null!==(n=null==A?void 0:A.user_id)&&void 0!==n?n:null,userEmail:null!==(r=null==A?void 0:A.user_email)&&void 0!==r?r:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(l=null==A?void 0:A.user_role)&&void 0!==l?l:null),premiumUser:null!==(c=null==A?void 0:A.premium_user)&&void 0!==c?c:null,disabledPersonalKeyCreation:null!==(s=null==A?void 0:A.disabled_non_admin_personal_key_creation)&&void 0!==s?s:null,showSSOBanner:(null==A?void 0:A.login_method)==="username_password"}}},77438:function(e,n,r){"use strict";r.r(n);var o=r(57437),a=r(6204),t=r(80443);n.default=()=>{let{accessToken:e,userId:n,userRole:r}=(0,t.Z)();return(0,o.jsx)(a.Z,{accessToken:e,userID:n,userRole:r})}},42673:function(e,n,r){"use strict";var o,a;r.d(n,{Cl:function(){return o},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return t},ph:function(){return s}}),(a=o||(o={})).AIML="AI/ML API",a.Bedrock="Amazon Bedrock",a.Anthropic="Anthropic",a.AssemblyAI="AssemblyAI",a.SageMaker="AWS SageMaker",a.Azure="Azure",a.Azure_AI_Studio="Azure AI Foundry (Studio)",a.Cerebras="Cerebras",a.Cohere="Cohere",a.Dashscope="Dashscope",a.Databricks="Databricks (Qwen API)",a.DeepInfra="DeepInfra",a.Deepgram="Deepgram",a.Deepseek="Deepseek",a.ElevenLabs="ElevenLabs",a.FalAI="Fal AI",a.FireworksAI="Fireworks AI",a.Google_AI_Studio="Google AI Studio",a.GradientAI="GradientAI",a.Groq="Groq",a.Hosted_Vllm="vllm",a.Infinity="Infinity",a.JinaAI="Jina AI",a.MistralAI="Mistral AI",a.Ollama="Ollama",a.OpenAI="OpenAI",a.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",a.OpenAI_Text="OpenAI Text Completion",a.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",a.Openrouter="Openrouter",a.Oracle="Oracle Cloud Infrastructure (OCI)",a.Perplexity="Perplexity",a.Sambanova="Sambanova",a.Snowflake="Snowflake",a.TogetherAI="TogetherAI",a.Triton="Triton",a.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",a.VolcEngine="VolcEngine",a.Voyage="Voyage AI",a.xAI="xAI";let t={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="../ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(t).find(n=>t[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let r=o[n];return{logo:l[r],displayName:r}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let r=t[e];console.log("Provider mapped to: ".concat(r));let o=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,a]=e;null!==a&&"object"==typeof a&&"litellm_provider"in a&&(a.litellm_provider===r||a.litellm_provider.includes(r))&&o.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,r]=e;null!==r&&"object"==typeof r&&"litellm_provider"in r&&"cohere_chat"===r.litellm_provider&&o.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,r]=e;null!==r&&"object"==typeof r&&"litellm_provider"in r&&"sagemaker_chat"===r.litellm_provider&&o.push(n)}))),o}},20347:function(e,n,r){"use strict";r.d(n,{LQ:function(){return t},ZL:function(){return o},lo:function(){return a},tY:function(){return i}});let o=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],a=["Internal User","Internal Viewer"],t=["Internal User","Admin","proxy_admin"],i=e=>o.includes(e)}},function(e){e.O(0,[1114,1491,4556,2417,2926,1529,9775,2525,7908,8077,704,4688,6204,2971,2117,1744],function(){return e(e.s=64362)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-e277e34746497b13.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-e277e34746497b13.js index 3bd5d8a4c7..68816205ab 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-e277e34746497b13.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-e277e34746497b13.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4746],{58109:function(e,n,t){Promise.resolve().then(t.bind(t,26661))},5540:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},i=t(55015),l=o.forwardRef(function(e,n){return o.createElement(i.Z,(0,r.Z)({},e,{ref:n,icon:a}))})},16312:function(e,n,t){"use strict";t.d(n,{z:function(){return r.Z}});var r=t(20831)},19130:function(e,n,t){"use strict";t.d(n,{RM:function(){return o.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return a.Z},ss:function(){return i.Z},xs:function(){return l.Z}});var r=t(21626),o=t(97214),a=t(28241),i=t(58834),l=t(69552),c=t(71876)},11318:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(2265),o=t(80443),a=t(19250);let i=async(e,n,t,r)=>"Admin"!=t&&"Admin Viewer"!=t?await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null,n):await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null);var l=()=>{let[e,n]=(0,r.useState)([]),{accessToken:t,userId:a,userRole:l}=(0,o.Z)();return(0,r.useEffect)(()=>{(async()=>{n(await i(t,a,l,null))})()},[t,a,l]),{teams:e,setTeams:n}}},26661:function(e,n,t){"use strict";t.r(n);var r=t(57437),o=t(67164),a=t(80443),i=t(11318);n.default=()=>{let{accessToken:e,userRole:n,userId:t,premiumUser:l}=(0,a.Z)(),{teams:c}=(0,i.Z)();return(0,r.jsx)(o.Z,{accessToken:e,userRole:n,userID:t,teams:null!=c?c:[],premiumUser:l})}},42673:function(e,n,t){"use strict";var r,o;t.d(n,{Cl:function(){return r},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return a},ph:function(){return s}}),(o=r||(r={})).AIML="AI/ML API",o.Bedrock="Amazon Bedrock",o.Anthropic="Anthropic",o.AssemblyAI="AssemblyAI",o.SageMaker="AWS SageMaker",o.Azure="Azure",o.Azure_AI_Studio="Azure AI Foundry (Studio)",o.Cerebras="Cerebras",o.Cohere="Cohere",o.Dashscope="Dashscope",o.Databricks="Databricks (Qwen API)",o.DeepInfra="DeepInfra",o.Deepgram="Deepgram",o.Deepseek="Deepseek",o.ElevenLabs="ElevenLabs",o.FalAI="Fal AI",o.FireworksAI="Fireworks AI",o.Google_AI_Studio="Google AI Studio",o.GradientAI="GradientAI",o.Groq="Groq",o.Hosted_Vllm="vllm",o.Infinity="Infinity",o.JinaAI="Jina AI",o.MistralAI="Mistral AI",o.Ollama="Ollama",o.OpenAI="OpenAI",o.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",o.OpenAI_Text="OpenAI Text Completion",o.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",o.Openrouter="Openrouter",o.Oracle="Oracle Cloud Infrastructure (OCI)",o.Perplexity="Perplexity",o.Sambanova="Sambanova",o.Snowflake="Snowflake",o.TogetherAI="TogetherAI",o.Triton="Triton",o.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",o.VolcEngine="VolcEngine",o.Voyage="Voyage AI",o.xAI="xAI";let a={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="/ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(a).find(n=>a[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let t=r[n];return{logo:l[t],displayName:t}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let t=a[e];console.log("Provider mapped to: ".concat(t));let r=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&(o.litellm_provider===t||o.litellm_provider.includes(t))&&r.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&"cohere_chat"===t.litellm_provider&&r.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&"sagemaker_chat"===t.litellm_provider&&r.push(n)}))),r}},60493:function(e,n,t){"use strict";t.d(n,{w:function(){return c}});var r=t(57437),o=t(2265),a=t(71594),i=t(24525),l=t(19130);function c(e){let{data:n=[],columns:t,getRowCanExpand:c,renderSubComponent:s,isLoading:u=!1,loadingMessage:p="\uD83D\uDE85 Loading logs...",noDataMessage:d="No logs found"}=e,g=(0,a.b7)({data:n,columns:t,getRowCanExpand:c,getRowId:(e,n)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(n)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,r.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,r.jsxs)(l.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,r.jsx)(l.ss,{children:g.getHeaderGroups().map(e=>(0,r.jsx)(l.SC,{children:e.headers.map(e=>(0,r.jsx)(l.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,a.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,r.jsx)(l.RM,{children:u?(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:p})})})}):g.getRowModel().rows.length>0?g.getRowModel().rows.map(e=>(0,r.jsxs)(o.Fragment,{children:[(0,r.jsx)(l.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,r.jsx)(l.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,r.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:s({row:e})})})})]},e.id)):(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:d})})})})})]})})}},10900:function(e,n,t){"use strict";var r=t(2265);let o=r.forwardRef(function(e,n){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:n},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});n.Z=o}},function(e){e.O(0,[6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,9343,2344,7732,4851,1160,3250,4688,131,2202,874,4292,7164,2971,2117,1744],function(){return e(e.s=58109)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4746],{58109:function(e,n,t){Promise.resolve().then(t.bind(t,26661))},5540:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},i=t(55015),l=o.forwardRef(function(e,n){return o.createElement(i.Z,(0,r.Z)({},e,{ref:n,icon:a}))})},16312:function(e,n,t){"use strict";t.d(n,{z:function(){return r.Z}});var r=t(20831)},19130:function(e,n,t){"use strict";t.d(n,{RM:function(){return o.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return a.Z},ss:function(){return i.Z},xs:function(){return l.Z}});var r=t(21626),o=t(97214),a=t(28241),i=t(58834),l=t(69552),c=t(71876)},11318:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(2265),o=t(80443),a=t(19250);let i=async(e,n,t,r)=>"Admin"!=t&&"Admin Viewer"!=t?await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null,n):await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null);var l=()=>{let[e,n]=(0,r.useState)([]),{accessToken:t,userId:a,userRole:l}=(0,o.Z)();return(0,r.useEffect)(()=>{(async()=>{n(await i(t,a,l,null))})()},[t,a,l]),{teams:e,setTeams:n}}},26661:function(e,n,t){"use strict";t.r(n);var r=t(57437),o=t(67164),a=t(80443),i=t(11318);n.default=()=>{let{accessToken:e,userRole:n,userId:t,premiumUser:l}=(0,a.Z)(),{teams:c}=(0,i.Z)();return(0,r.jsx)(o.Z,{accessToken:e,userRole:n,userID:t,teams:null!=c?c:[],premiumUser:l})}},42673:function(e,n,t){"use strict";var r,o;t.d(n,{Cl:function(){return r},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return a},ph:function(){return s}}),(o=r||(r={})).AIML="AI/ML API",o.Bedrock="Amazon Bedrock",o.Anthropic="Anthropic",o.AssemblyAI="AssemblyAI",o.SageMaker="AWS SageMaker",o.Azure="Azure",o.Azure_AI_Studio="Azure AI Foundry (Studio)",o.Cerebras="Cerebras",o.Cohere="Cohere",o.Dashscope="Dashscope",o.Databricks="Databricks (Qwen API)",o.DeepInfra="DeepInfra",o.Deepgram="Deepgram",o.Deepseek="Deepseek",o.ElevenLabs="ElevenLabs",o.FalAI="Fal AI",o.FireworksAI="Fireworks AI",o.Google_AI_Studio="Google AI Studio",o.GradientAI="GradientAI",o.Groq="Groq",o.Hosted_Vllm="vllm",o.Infinity="Infinity",o.JinaAI="Jina AI",o.MistralAI="Mistral AI",o.Ollama="Ollama",o.OpenAI="OpenAI",o.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",o.OpenAI_Text="OpenAI Text Completion",o.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",o.Openrouter="Openrouter",o.Oracle="Oracle Cloud Infrastructure (OCI)",o.Perplexity="Perplexity",o.Sambanova="Sambanova",o.Snowflake="Snowflake",o.TogetherAI="TogetherAI",o.Triton="Triton",o.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",o.VolcEngine="VolcEngine",o.Voyage="Voyage AI",o.xAI="xAI";let a={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="../ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(a).find(n=>a[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let t=r[n];return{logo:l[t],displayName:t}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let t=a[e];console.log("Provider mapped to: ".concat(t));let r=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&(o.litellm_provider===t||o.litellm_provider.includes(t))&&r.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&"cohere_chat"===t.litellm_provider&&r.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&"sagemaker_chat"===t.litellm_provider&&r.push(n)}))),r}},60493:function(e,n,t){"use strict";t.d(n,{w:function(){return c}});var r=t(57437),o=t(2265),a=t(71594),i=t(24525),l=t(19130);function c(e){let{data:n=[],columns:t,getRowCanExpand:c,renderSubComponent:s,isLoading:u=!1,loadingMessage:p="\uD83D\uDE85 Loading logs...",noDataMessage:d="No logs found"}=e,g=(0,a.b7)({data:n,columns:t,getRowCanExpand:c,getRowId:(e,n)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(n)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,r.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,r.jsxs)(l.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,r.jsx)(l.ss,{children:g.getHeaderGroups().map(e=>(0,r.jsx)(l.SC,{children:e.headers.map(e=>(0,r.jsx)(l.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,a.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,r.jsx)(l.RM,{children:u?(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:p})})})}):g.getRowModel().rows.length>0?g.getRowModel().rows.map(e=>(0,r.jsxs)(o.Fragment,{children:[(0,r.jsx)(l.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,r.jsx)(l.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,r.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:s({row:e})})})})]},e.id)):(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:d})})})})})]})})}},10900:function(e,n,t){"use strict";var r=t(2265);let o=r.forwardRef(function(e,n){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:n},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});n.Z=o}},function(e){e.O(0,[6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,9343,2344,7732,4851,1160,3250,4688,131,2202,874,4292,7164,2971,2117,1744],function(){return e(e.s=58109)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/page-3ac57035eb8ce002.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/page-3ac57035eb8ce002.js index e29d90ed58..22da64a7aa 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/page-3ac57035eb8ce002.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/page-3ac57035eb8ce002.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{97731:function(e,s,t){Promise.resolve().then(t.bind(t,17940))},23192:function(e,s,t){"use strict";t.d(s,{Z:function(){return h}});var r=t(57437);t(2265);var l=t(67101),a=t(12485),n=t(18135),i=t(35242),o=t(29706),c=t(77991),d=t(84264),m=t(25653),u=t(96362),x=e=>{let{href:s,className:t}=e;return(0,r.jsxs)("a",{href:s,target:"_blank",rel:"noopener noreferrer",title:"Open documentation in a new tab",className:function(){for(var e=arguments.length,s=Array(e),t=0;t{let{proxySettings:s}=e,t="";return(null==s?void 0:s.PROXY_BASE_URL)!==void 0&&(null==s?void 0:s.PROXY_BASE_URL)&&(t=s.PROXY_BASE_URL),(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(l.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:"OpenAI Compatible Proxy: API Reference"}),(0,r.jsx)(x,{className:"ml-3 shrink-0",href:"https://docs.litellm.ai/docs/proxy/user_keys"})]}),(0,r.jsxs)(d.Z,{className:"mt-2 mb-2",children:["LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below"," "]}),(0,r.jsxs)(n.Z,{children:[(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(a.Z,{children:"OpenAI Python SDK"}),(0,r.jsx)(a.Z,{children:"LlamaIndex"}),(0,r.jsx)(a.Z,{children:"Langchain Py"})]}),(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'import openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="'.concat(t,'" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="gpt-3.5-turbo", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)')})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'import os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="azure-gpt-3.5", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="'.concat(t,'", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="').concat(t,'",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)')})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'from langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="'.concat(t,'",\n model = "gpt-3.5-turbo",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)')})})]})]})]})})})}},25653:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(30401),n=t(5136),i=t(17906),o=t(1479);s.Z=e=>{let{code:s,language:t}=e,[c,d]=(0,l.useState)(!1);return(0,r.jsxs)("div",{className:"relative rounded-lg border border-gray-200 overflow-hidden",children:[(0,r.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3)},className:"absolute top-3 right-3 p-2 rounded-md bg-gray-100 hover:bg-gray-200 text-gray-600 z-10","aria-label":"Copy code",children:c?(0,r.jsx)(a.Z,{size:16}):(0,r.jsx)(n.Z,{size:16})}),(0,r.jsx)(i.Z,{language:t,style:o.Z,customStyle:{margin:0,padding:"1.5rem",borderRadius:"0.5rem",fontSize:"0.9rem",backgroundColor:"#fafafa"},showLineNumbers:!0,children:s})]})}},17940:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return s1}});var r=t(57437),l=t(2265),a=t(99376),n=t(14474),i=t(21623),o=t(29827),c=t(65373),d=t(69734),m=t(21739),u=t(81598),x=t(77155),h=t(22004),p=t(90773),g=t(6925),f=t(64289),j=t(7166),y=t(49104),b=t(33801),v=t(18160),_=t(67164),Z=t(23192),w=t(47029),N=t(18143),k=t(66600),S=t(19250),C=t(43765),T=t(30603),z=t(6674),P=t(30874),A=t(39210),D=t(94138),I=t(42273),L=t(6204),E=t(5183),F=t(20831),R=t(12485),M=t(18135),O=t(35242),B=t(29706),q=t(77991),U=t(84264),V=t(96761),K=t(13634),H=t(82680),W=t(9114),Y=t(42673);let J=e=>{let s=Object.keys(Y.fK).find(s=>Y.fK[s]===e);if(s){let e=Y.Cl[s],t=Y.cd[e];return{displayName:e,logo:t,enumKey:s}}return{displayName:e,logo:"",enumKey:null}},G=e=>Y.fK[e]||null,X=(e,s)=>{let t=e.target,r=t.parentElement;if(r){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=s.charAt(0),r.replaceChild(e,t)}};var $=t(47323),Q=t(49566),ee=t(82422),es=t(3837),et=t(53410),er=t(74998),el=t(21626),ea=t(97214),en=t(28241),ei=t(58834),eo=t(69552),ec=t(71876);function ed(e){let{data:s,columns:t,isLoading:l=!1,loadingMessage:a="Loading...",emptyMessage:n="No data",getRowKey:i}=e;return(0,r.jsxs)(el.Z,{children:[(0,r.jsx)(ei.Z,{children:(0,r.jsx)(ec.Z,{children:t.map((e,s)=>(0,r.jsx)(eo.Z,{style:{width:e.width},children:e.header},s))})}),(0,r.jsx)(ea.Z,{children:l?(0,r.jsx)(ec.Z,{children:(0,r.jsx)(en.Z,{colSpan:t.length,className:"text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:a})})}):s.length>0?s.map((e,s)=>(0,r.jsx)(ec.Z,{children:t.map((s,t)=>{var l;return(0,r.jsx)(en.Z,{children:s.cell?s.cell(e):String(null!==(l=e[s.accessor])&&void 0!==l?l:"")},t)})},i?i(e,s):s)):(0,r.jsx)(ec.Z,{children:(0,r.jsx)(en.Z,{colSpan:t.length,className:"text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:n})})})})]})}var em=e=>{let{discountConfig:s,onDiscountChange:t,onRemoveProvider:a}=e,[n,i]=(0,l.useState)(null),[o,c]=(0,l.useState)(""),d=(e,s)=>{i(e),c((100*s).toString())},m=e=>{let s=parseFloat(o);!isNaN(s)&&s>=0&&s<=100&&t(e,(s/100).toString()),i(null),c("")},u=()=>{i(null),c("")},x=(e,s)=>{"Enter"===e.key?m(s):"Escape"===e.key&&u()},h=Object.entries(s).map(e=>{let[s,t]=e;return{provider:s,discount:t}}).sort((e,s)=>{let t=J(e.provider).displayName,r=J(s.provider).displayName;return t.localeCompare(r)});return(0,r.jsx)(ed,{data:h,columns:[{header:"Provider",cell:e=>{let{displayName:s,logo:t}=J(e.provider);return(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,r.jsx)("img",{src:t,alt:"".concat(s," logo"),className:"w-5 h-5",onError:e=>X(e,s)}),(0,r.jsx)("span",{className:"font-medium",children:s})]})}},{header:"Discount Percentage",cell:e=>(0,r.jsx)("div",{className:"flex items-center gap-2",children:n===e.provider?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Q.Z,{value:o,onValueChange:c,onKeyDown:s=>x(s,e.provider),placeholder:"5",className:"w-20",autoFocus:!0}),(0,r.jsx)("span",{className:"text-gray-600",children:"%"}),(0,r.jsx)($.Z,{icon:ee.Z,size:"sm",onClick:()=>m(e.provider),className:"cursor-pointer text-green-600 hover:text-green-700"}),(0,r.jsx)($.Z,{icon:es.Z,size:"sm",onClick:u,className:"cursor-pointer text-gray-600 hover:text-gray-700"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(U.Z,{className:"font-medium",children:[(100*e.discount).toFixed(1),"%"]}),(0,r.jsx)($.Z,{icon:et.Z,size:"sm",onClick:()=>d(e.provider,e.discount),className:"cursor-pointer text-blue-600 hover:text-blue-700"})]})}),width:"250px"},{header:"Actions",cell:e=>{let{displayName:s}=J(e.provider);return(0,r.jsx)($.Z,{icon:er.Z,size:"sm",onClick:()=>a(e.provider,s),className:"cursor-pointer hover:text-red-600"})},width:"80px"}],getRowKey:e=>e.provider,emptyMessage:"No provider discounts configured"})},eu=t(64504),ex=t(89970),eh=t(52787),ep=t(15424),eg=t(33145),ef=e=>{let{discountConfig:s,selectedProvider:t,newDiscount:l,onProviderChange:a,onDiscountChange:n,onAddProvider:i}=e;return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Provider",(0,r.jsx)(ex.Z,{title:"Select the LLM provider you want to configure a discount for",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please select a provider"}],children:(0,r.jsx)(eh.default,{showSearch:!0,placeholder:"Select provider",value:t,onChange:a,style:{width:"100%"},size:"large",optionFilterProp:"children",filterOption:(e,s)=>{var t;return String(null!==(t=null==s?void 0:s.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},children:Object.entries(Y.Cl).map(e=>{let[t,l]=e,a=Y.fK[t];return a&&s[a]?null:(0,r.jsx)(eh.default.Option,{value:t,label:l,children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(eg.default,{src:Y.cd[l],alt:"".concat(t," logo"),width:20,height:20,className:"w-5 h-5",onError:e=>X(e,l)}),(0,r.jsx)("span",{children:l})]})},t)})})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Discount Percentage",(0,r.jsx)(ex.Z,{title:"Enter a percentage value (e.g., 5 for 5% discount)",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please enter a discount percentage"}],children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(eu.o,{placeholder:"5",value:l,onValueChange:n,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 flex-1"}),(0,r.jsx)("span",{className:"text-gray-600",children:"%"})]})}),(0,r.jsx)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:(0,r.jsx)(eu.z,{variant:"primary",onClick:i,disabled:!t||!l,children:"Add Provider Discount"})})]})},ej=t(29271),ey=t(40875),eb=t(96362);let ev=e=>{let{items:s,children:t="Docs",className:a=""}=e,[n,i]=(0,l.useState)(!1),o=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i(!1)};return n&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n]),(0,r.jsxs)("div",{className:"relative inline-block ".concat(a),ref:o,children:[(0,r.jsxs)("button",{type:"button",onClick:()=>i(!n),className:"inline-flex items-center gap-1 text-gray-500 hover:text-gray-700 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded px-2 py-1","aria-expanded":n,"aria-haspopup":"true",children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)(ey.Z,{className:"h-3 w-3 transition-transform ".concat(n?"rotate-180":""),"aria-hidden":"true"})]}),n&&(0,r.jsx)("div",{className:"absolute right-0 mt-1 w-56 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50",children:s.map((e,s)=>(0,r.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",onClick:()=>i(!1),children:[(0,r.jsx)("span",{children:e.label}),(0,r.jsx)(eb.Z,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0 ml-2","aria-hidden":"true"})]},s))})]})};var e_=t(56522),eZ=t(25653),ew=()=>{let[e,s]=(0,l.useState)(""),[t,a]=(0,l.useState)(""),n=(0,l.useMemo)(()=>{let s=parseFloat(e),r=parseFloat(t);if(isNaN(s)||isNaN(r)||0===s||0===r)return null;let l=s+r;return{originalCost:l.toFixed(10),finalCost:s.toFixed(10),discountAmount:r.toFixed(10),discountPercentage:(r/l*100).toFixed(2)}},[e,t]);return(0,r.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Cost Calculation"}),(0,r.jsxs)(e_.x,{className:"text-xs text-gray-600",children:["Discounts are applied to provider costs: ",(0,r.jsx)("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded text-xs",children:"final_cost = base_cost \xd7 (1 - discount%/100)"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Example"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"A 5% discount on a $10.00 request results in: $10.00 \xd7 (1 - 0.05) = $9.50"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Valid Range"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Discount percentages must be between 0% and 100%"})]}),(0,r.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-2",children:"Validating Discounts"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mb-3",children:"Make a test request and check the response headers to verify discounts are applied:"}),(0,r.jsx)(eZ.Z,{language:"bash",code:'curl -X POST -i http://your-proxy:4000/chat/completions \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer sk-1234" \\\n -d \'{\n "model": "gemini/gemini-2.5-pro",\n "messages": [{"role": "user", "content": "Hello"}]\n }\''}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mt-3 mb-2",children:"Look for these headers in the response:"}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Final cost after discount"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-original"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Original cost before discount"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-discount-amount"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Amount discounted"})]})]})]}),(0,r.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-3",children:"Discount Calculator"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mb-3",children:"Enter values from your response headers to verify the discount:"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Response Cost (x-litellm-response-cost)"}),(0,r.jsx)(e_.o,{placeholder:"0.0171938125",value:e,onValueChange:s,className:"text-sm"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Discount Amount (x-litellm-response-cost-discount-amount)"}),(0,r.jsx)(e_.o,{placeholder:"0.0009049375",value:t,onValueChange:a,className:"text-sm"})]})]}),n&&(0,r.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,r.jsx)(e_.x,{className:"text-sm font-medium text-blue-900 mb-2",children:"Calculated Results"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Original Cost:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.originalCost]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Final Cost:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.finalCost]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Discount Amount:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.discountAmount]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-blue-300",children:[(0,r.jsx)(e_.x,{className:"text-xs font-semibold text-blue-900",children:"Discount Applied:"}),(0,r.jsxs)(e_.x,{className:"text-sm font-bold text-blue-900",children:[n.discountPercentage,"%"]})]})]})]})]})]})};let eN=[{label:"Custom pricing for models",href:"https://docs.litellm.ai/docs/proxy/custom_pricing"},{label:"Spend tracking",href:"https://docs.litellm.ai/docs/proxy/cost_tracking"}];var ek=e=>{let{userID:s,userRole:t,accessToken:a}=e,[n,i]=(0,l.useState)({}),[o,c]=(0,l.useState)(void 0),[d,m]=(0,l.useState)(""),[u,x]=(0,l.useState)(!0),[h,p]=(0,l.useState)(!1),[g]=K.Z.useForm(),[f,j]=H.Z.useModal(),y=(0,l.useCallback)(async()=>{x(!0);try{let e=(0,S.getProxyBaseUrl)(),s=await fetch(e?"".concat(e,"/config/cost_discount_config"):"/config/cost_discount_config",{method:"GET",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"}});if(s.ok){let e=await s.json();i(e.values||{})}else console.error("Failed to fetch discount config")}catch(e){console.error("Error fetching discount config:",e),W.Z.fromBackend("Failed to fetch discount configuration")}finally{x(!1)}},[a]);(0,l.useEffect)(()=>{a&&y()},[a,y]);let b=async e=>{try{let t=(0,S.getProxyBaseUrl)(),r=await fetch(t?"".concat(t,"/config/cost_discount_config"):"/config/cost_discount_config",{method:"PATCH",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)W.Z.success("Discount configuration updated successfully"),await y();else{var s;let e=await r.json(),t=(null===(s=e.detail)||void 0===s?void 0:s.error)||e.detail||"Failed to update settings";W.Z.fromBackend(t)}}catch(e){console.error("Error updating discount config:",e),W.Z.fromBackend("Failed to update discount configuration")}},v=async()=>{if(!o||!d){W.Z.fromBackend("Please select a provider and enter discount percentage");return}let e=parseFloat(d);if(isNaN(e)||e<0||e>100){W.Z.fromBackend("Discount must be between 0% and 100%");return}let s=G(o);if(!s){W.Z.fromBackend("Invalid provider selected");return}if(n[s]){W.Z.fromBackend("Discount for ".concat(Y.Cl[o]," already exists. Edit it in the table above."));return}let t={...n,[s]:e/100};i(t),await b(t),c(void 0),m(""),p(!1)},_=async(e,s)=>{f.confirm({title:"Remove Provider Discount",icon:(0,r.jsx)(ej.Z,{}),content:"Are you sure you want to remove the discount for ".concat(s,"?"),okText:"Remove",okType:"danger",cancelText:"Cancel",onOk:async()=>{let s={...n};delete s[e],i(s),await b(s)}})},Z=async(e,s)=>{let t=parseFloat(s);if(!isNaN(t)&&t>=0&&t<=1){let s={...n,[e]:t};i(s),await b(s)}};return a?(0,r.jsxs)("div",{className:"w-full p-8",children:[j,(0,r.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between mb-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(V.Z,{children:"Cost Tracking Settings"}),(0,r.jsx)(ev,{items:eN})]}),(0,r.jsx)(U.Z,{className:"text-gray-500 mt-1",children:"Configure cost discounts for different LLM providers. Changes are saved automatically."})]}),(0,r.jsx)(F.Z,{onClick:()=>p(!0),className:"mt-4 md:mt-0",children:"+ Add Provider Discount"})]}),(0,r.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full",children:(0,r.jsxs)(M.Z,{children:[(0,r.jsxs)(O.Z,{className:"px-6 pt-4",children:[(0,r.jsx)(R.Z,{children:"Provider Discounts"}),(0,r.jsx)(R.Z,{children:"Test It"})]}),(0,r.jsxs)(q.Z,{children:[(0,r.jsx)(B.Z,{children:u?(0,r.jsx)("div",{className:"py-12 text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:"Loading configuration..."})}):Object.keys(n).length>0?(0,r.jsx)("div",{className:"p-6",children:(0,r.jsx)(em,{discountConfig:n,onDiscountChange:Z,onRemoveProvider:_})}):(0,r.jsxs)("div",{className:"py-16 px-6 text-center",children:[(0,r.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,r.jsx)(U.Z,{className:"text-gray-700 font-medium mb-2",children:"No provider discounts configured"}),(0,r.jsx)(U.Z,{className:"text-gray-500 text-sm",children:'Click "Add Provider Discount" to get started'})]})}),(0,r.jsx)(B.Z,{children:(0,r.jsx)("div",{className:"px-6 pb-4",children:(0,r.jsx)(ew,{})})})]})]})}),(0,r.jsx)(H.Z,{title:(0,r.jsx)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Provider Discount"})}),open:h,width:1e3,onCancel:()=>{p(!1),g.resetFields(),c(void 0),m("")},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,r.jsxs)("div",{className:"mt-6",children:[(0,r.jsx)(U.Z,{className:"text-sm text-gray-600 mb-6",children:"Select a provider and set its discount percentage. Enter a value between 0% and 100% (e.g., 5 for a 5% discount)."}),(0,r.jsx)(K.Z,{form:g,onFinish:e=>{v()},layout:"vertical",className:"space-y-6",children:(0,r.jsx)(ef,{discountConfig:n,selectedProvider:o,newDiscount:d,onProviderChange:c,onDiscountChange:m,onAddProvider:v})})]})})]}):null},eS=t(91323),eC=t(10012),eT=t(31857),ez=t(19226),eP=t(45937),eA=t(92403),eD=t(28595),eI=t(68208),eL=t(9775),eE=t(41361),eF=t(37527),eR=t(15883),eM=t(12660),eO=t(88009),eB=t(48231),eq=t(57400),eU=t(58630),eV=t(29436),eK=t(44625),eH=t(41169),eW=t(38434),eY=t(71891),eJ=t(55322),eG=t(11429),eX=t(20347),e$=t(79262),eQ=t(13959);let{Sider:e0}=ez.default;var e1=e=>{let{accessToken:s,setPage:t,userRole:l,defaultSelectedKey:a,collapsed:n=!1}=e,i=[{key:"1",page:"api-keys",label:"Virtual Keys",icon:(0,r.jsx)(eA.Z,{style:{fontSize:"18px"}})},{key:"3",page:"llm-playground",label:"Test Key",icon:(0,r.jsx)(eD.Z,{style:{fontSize:"18px"}}),roles:eX.LQ},{key:"2",page:"models",label:"Models + Endpoints",icon:(0,r.jsx)(eI.Z,{style:{fontSize:"18px"}}),roles:eX.LQ},{key:"12",page:"new_usage",label:"Usage",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}}),roles:[...eX.ZL,...eX.lo]},{key:"6",page:"teams",label:"Teams",icon:(0,r.jsx)(eE.Z,{style:{fontSize:"18px"}})},{key:"17",page:"organizations",label:"Organizations",icon:(0,r.jsx)(eF.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"5",page:"users",label:"Internal Users",icon:(0,r.jsx)(eR.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"14",page:"api_ref",label:"API Reference",icon:(0,r.jsx)(eM.Z,{style:{fontSize:"18px"}})},{key:"16",page:"model-hub-table",label:"Model Hub",icon:(0,r.jsx)(eO.Z,{style:{fontSize:"18px"}})},{key:"15",page:"logs",label:"Logs",icon:(0,r.jsx)(eB.Z,{style:{fontSize:"18px"}})},{key:"11",page:"guardrails",label:"Guardrails",icon:(0,r.jsx)(eq.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"26",page:"tools",label:"Tools",icon:(0,r.jsx)(eU.Z,{style:{fontSize:"18px"}}),children:[{key:"18",page:"mcp-servers",label:"MCP Servers",icon:(0,r.jsx)(eU.Z,{style:{fontSize:"18px"}})},{key:"28",page:"search-tools",label:"Search Tools",icon:(0,r.jsx)(eV.Z,{style:{fontSize:"18px"}})},{key:"21",page:"vector-stores",label:"Vector Stores",icon:(0,r.jsx)(eK.Z,{style:{fontSize:"18px"}}),roles:eX.ZL}]},{key:"experimental",page:"experimental",label:"Experimental",icon:(0,r.jsx)(eH.Z,{style:{fontSize:"18px"}}),children:[{key:"9",page:"caching",label:"Caching",icon:(0,r.jsx)(eK.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"25",page:"prompts",label:"Prompts",icon:(0,r.jsx)(eW.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"10",page:"budgets",label:"Budgets",icon:(0,r.jsx)(eF.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"20",page:"transform-request",label:"API Playground",icon:(0,r.jsx)(eM.Z,{style:{fontSize:"18px"}}),roles:[...eX.ZL,...eX.lo]},{key:"19",page:"tag-management",label:"Tag Management",icon:(0,r.jsx)(eY.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"4",page:"usage",label:"Old Usage",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}})}]},{key:"settings",page:"settings",label:"Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL,children:[{key:"11",page:"general-settings",label:"Router Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"8",page:"settings",label:"Logging & Alerts",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"13",page:"admin-panel",label:"Admin Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"27",page:"cost-tracking-settings",label:"Cost Tracking",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"14",page:"ui-theme",label:"UI Theme",icon:(0,r.jsx)(eG.Z,{style:{fontSize:"18px"}}),roles:eX.ZL}]}],o=(e=>{let s=i.find(s=>s.page===e);if(s)return s.key;for(let s of i)if(s.children){let t=s.children.find(s=>s.page===e);if(t)return t.key}return"1"})(a),c=i.filter(e=>{let s=!e.roles||e.roles.includes(l);return console.log("Menu item ".concat(e.label,": roles=").concat(e.roles,", userRole=").concat(l,", hasAccess=").concat(s)),!!s&&(e.children&&(e.children=e.children.filter(e=>!e.roles||e.roles.includes(l))),!0)});return(0,r.jsx)(ez.default,{style:{minHeight:"100vh"},children:(0,r.jsxs)(e0,{theme:"light",width:220,collapsed:n,collapsedWidth:80,collapsible:!0,trigger:null,style:{transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",position:"relative"},children:[(0,r.jsx)(eQ.ZP,{theme:{components:{Menu:{iconSize:18,fontSize:14}}},children:(0,r.jsx)(eP.Z,{mode:"inline",selectedKeys:[o],defaultOpenKeys:n?[]:["llm-tools"],inlineCollapsed:n,className:"custom-sidebar-menu",style:{borderRight:0,backgroundColor:"transparent",fontSize:"14px"},items:c.map(e=>{var s;return{key:e.key,icon:e.icon,label:e.label,children:null===(s=e.children)||void 0===s?void 0:s.map(e=>({key:e.key,icon:e.icon,label:e.label,onClick:()=>{let s=new URLSearchParams(window.location.search);s.set("page",e.page),window.history.pushState(null,"","?".concat(s.toString())),t(e.page)}})),onClick:e.children?void 0:()=>{let s=new URLSearchParams(window.location.search);s.set("page",e.page),window.history.pushState(null,"","?".concat(s.toString())),t(e.page)}}})})}),(0,eX.tY)(l)&&!n&&(0,r.jsx)(e$.Z,{accessToken:s,width:220})]})})},e2=t(92019),e4=t(80443),e6=e=>{let{setPage:s,defaultSelectedKey:t,sidebarCollapsed:l}=e,{refactoredUIFlag:a}=(0,eT.Z)(),{accessToken:n,userRole:i}=(0,e4.Z)();return a?(0,r.jsx)(e2.Z,{accessToken:n,defaultSelectedKey:t,userRole:i}):(0,r.jsx)(e1,{accessToken:n,setPage:s,userRole:i,defaultSelectedKey:t,collapsed:l})},e5=t(93192),e3=t(23628),e8=t(86462),e7=t(47686),e9=t(64482),se=t(73002),ss=t(24199),st=t(46468),sr=t(25512),sl=t(33293),sa=t(88904),sn=t(87452),si=t(88829),so=t(72208),sc=t(41649),sd=t(12514),sm=t(49804),su=t(67101),sx=t(918),sh=t(97415),sp=t(2597),sg=t(59872),sf=t(32489),sj=t(76865),sy=t(95920),sb=t(68473),sv=t(51750);let s_=(e,s)=>{let t=[];return e&&e.models.length>0?(console.log("organization.models: ".concat(e.models)),t=e.models):t=s,(0,st.Ob)(t,s)},sZ=(e,s,t)=>"Admin"===e||!!t&&!!s&&t.some(e=>{var t;return null===(t=e.members)||void 0===t?void 0:t.some(e=>e.user_id===s&&"org_admin"===e.user_role)}),sw=(e,s,t)=>"Admin"===e?t||[]:t&&s?t.filter(e=>{var t;return null===(t=e.members)||void 0===t?void 0:t.some(e=>e.user_id===s&&"org_admin"===e.user_role)}):[];var sN=e=>{let{teams:s,searchParams:t,accessToken:a,setTeams:n,userID:i,userRole:o,organizations:c,premiumUser:d=!1}=e;console.log("organizations: ".concat(JSON.stringify(c)));let[m,u]=(0,l.useState)(""),[x,h]=(0,l.useState)(null),[p,g]=(0,l.useState)(null),[f,j]=(0,l.useState)(!1),[y,b]=(0,l.useState)({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"});(0,l.useEffect)(()=>{console.log("inside useeffect - ".concat(m)),a&&(0,A.Z)(a,i,o,x,n),eB()},[m]);let[v]=K.Z.useForm(),[_]=K.Z.useForm(),{Title:Z,Paragraph:w}=e5.default,[N,k]=(0,l.useState)(""),[C,T]=(0,l.useState)(!1),[z,P]=(0,l.useState)(null),[D,I]=(0,l.useState)(null),[L,E]=(0,l.useState)(!1),[V,Y]=(0,l.useState)(!1),[J,G]=(0,l.useState)(!1),[X,ee]=(0,l.useState)(!1),[es,ed]=(0,l.useState)([]),[em,eu]=(0,l.useState)(!1),[eg,ef]=(0,l.useState)(null),[ej,ey]=(0,l.useState)([]),[eb,ev]=(0,l.useState)({}),[e_,eZ]=(0,l.useState)([]),[ew,eN]=(0,l.useState)({}),[ek,eS]=(0,l.useState)([]),[eC,eT]=(0,l.useState)([]),[ez,eP]=(0,l.useState)(!1),[eA,eD]=(0,l.useState)(""),[eI,eL]=(0,l.useState)({});(0,l.useEffect)(()=>{console.log("currentOrgForCreateTeam: ".concat(p));let e=s_(p,es);console.log("models: ".concat(e)),ey(e),v.setFieldValue("models",[])},[p,es]),(0,l.useEffect)(()=>{if(V){let e=sw(o,i,c);if(1===e.length){let s=e[0];v.setFieldValue("organization_id",s.organization_id),g(s)}else v.setFieldValue("organization_id",(null==x?void 0:x.organization_id)||null),g(x)}},[V,o,i,c,x]),(0,l.useEffect)(()=>{(async()=>{try{if(null==a)return;let e=(await (0,S.getGuardrailsList)(a)).guardrails.map(e=>e.guardrail_name);eZ(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[a]);let eE=async()=>{try{if(null==a)return;let e=await (0,S.fetchMCPAccessGroups)(a);eT(e)}catch(e){console.error("Failed to fetch MCP access groups:",e)}};(0,l.useEffect)(()=>{eE()},[a]),(0,l.useEffect)(()=>{s&&ev(s.reduce((e,s)=>(e[s.team_id]={keys:s.keys||[],team_info:{members_with_roles:s.members_with_roles||[]}},e),{}))},[s]);let eF=async e=>{ef(e),eu(!0)},eR=async()=>{if(null!=eg&&null!=s&&null!=a){try{await (0,S.teamDeleteCall)(a,eg),await (0,A.Z)(a,i,o,x,n)}catch(e){console.error("Error deleting the team:",e)}eu(!1),ef(null),eD("")}},eM=()=>{eu(!1),ef(null),eD("")};(0,l.useEffect)(()=>{(async()=>{try{if(null===i||null===o||null===a)return;let e=await (0,st.K2)(i,o,a);e&&ed(e)}catch(e){console.error("Error fetching user models:",e)}})()},[a,i,o,s]);let eO=async e=>{try{if(console.log("formValues: ".concat(JSON.stringify(e))),null!=a){var t,r,l;let i=null==e?void 0:e.team_alias,o=null!==(l=null==s?void 0:s.map(e=>e.team_alias))&&void 0!==l?l:[],c=(null==e?void 0:e.organization_id)||(null==x?void 0:x.organization_id);if(""===c||"string"!=typeof c?e.organization_id=null:e.organization_id=c.trim(),o.includes(i))throw Error("Team alias ".concat(i," already exists, please pick another alias"));if(W.Z.info("Creating Team"),ek.length>0){let s={};if(e.metadata)try{s=JSON.parse(e.metadata)}catch(e){console.warn("Invalid JSON in metadata field, starting with empty object")}s={...s,logging:ek.filter(e=>e.callback_name)},e.metadata=JSON.stringify(s)}if(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(t=e.allowed_mcp_servers_and_groups.servers)||void 0===t?void 0:t.length)>0||(null===(r=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===r?void 0:r.length)>0||e.allowed_mcp_servers_and_groups.toolPermissions)){if(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups){let{servers:s,accessGroups:t}=e.allowed_mcp_servers_and_groups;s&&s.length>0&&(e.object_permission.mcp_servers=s),t&&t.length>0&&(e.object_permission.mcp_access_groups=t),delete e.allowed_mcp_servers_and_groups}e.mcp_tool_permissions&&Object.keys(e.mcp_tool_permissions).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=e.mcp_tool_permissions,delete e.mcp_tool_permissions)}e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),Object.keys(eI).length>0&&(e.model_aliases=eI);let d=await (0,S.teamCreateCall)(a,e);null!==s?n([...s,d]):n([d]),console.log("response for team create call: ".concat(d)),W.Z.success("Team created"),v.resetFields(),eS([]),eL({}),Y(!1)}}catch(e){console.error("Error creating the team:",e),W.Z.fromBackend("Error creating the team: "+e)}},eB=()=>{u(new Date().toLocaleString())},eq=(e,s)=>{let t={...y,[e]:s};b(t),a&&(0,S.v2TeamListCall)(a,t.organization_id||null,null,t.team_id||null,t.team_alias||null).then(e=>{e&&e.teams&&n(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})};return(0,r.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,r.jsx)(su.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,r.jsxs)(sm.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[sZ(o,i,c)&&(0,r.jsx)(F.Z,{className:"w-fit",onClick:()=>Y(!0),children:"+ Create New Team"}),D?(0,r.jsx)(sl.Z,{teamId:D,onUpdate:e=>{n(s=>{if(null==s)return s;let t=s.map(s=>e.team_id===s.team_id?(0,sg.nl)(s,e):s);return a&&(0,A.Z)(a,i,o,x,n),t})},onClose:()=>{I(null),E(!1)},accessToken:a,is_team_admin:(e=>{if(null==e||null==e.members_with_roles)return!1;for(let s=0;se.team_id===D)),is_proxy_admin:"Admin"==o,userModels:es,editTeam:L}):(0,r.jsxs)(M.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,r.jsxs)(O.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)(R.Z,{children:"Your Teams"}),(0,r.jsx)(R.Z,{children:"Available Teams"}),(0,eX.tY)(o||"")&&(0,r.jsx)(R.Z,{children:"Default Team Settings"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,r.jsxs)(U.Z,{children:["Last Refreshed: ",m]}),(0,r.jsx)($.Z,{icon:e3.Z,variant:"shadow",size:"xs",className:"self-center",onClick:eB})]})]}),(0,r.jsxs)(q.Z,{children:[(0,r.jsxs)(B.Z,{children:[(0,r.jsxs)(U.Z,{children:["Click on “Team ID” to view team details ",(0,r.jsx)("b",{children:"and"})," manage team members."]}),(0,r.jsx)(su.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,r.jsx)(sm.Z,{numColSpan:1,children:(0,r.jsxs)(sd.Z,{className:"w-full mx-auto flex-auto overflow-hidden overflow-y-auto max-h-[50vh]",children:[(0,r.jsx)("div",{className:"border-b px-6 py-4",children:(0,r.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,r.jsxs)("div",{className:"relative w-64",children:[(0,r.jsx)("input",{type:"text",placeholder:"Search by Team Name...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:y.team_alias,onChange:e=>eq("team_alias",e.target.value)}),(0,r.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,r.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(f?"bg-gray-100":""),onClick:()=>j(!f),children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",(y.team_id||y.team_alias||y.organization_id)&&(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500"})]}),(0,r.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{b({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"}),a&&(0,S.v2TeamListCall)(a,null,i||null,null,null).then(e=>{e&&e.teams&&n(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})},children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),f&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,r.jsxs)("div",{className:"relative w-64",children:[(0,r.jsx)("input",{type:"text",placeholder:"Enter Team ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:y.team_id,onChange:e=>eq("team_id",e.target.value)}),(0,r.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})]}),(0,r.jsx)("div",{className:"w-64",children:(0,r.jsx)(sr.P,{value:y.organization_id||"",onValueChange:e=>eq("organization_id",e),placeholder:"Select Organization",children:null==c?void 0:c.map(e=>(0,r.jsx)(sr.Q,{value:e.organization_id||"",children:e.organization_alias||e.organization_id},e.organization_id))})})]})]})}),(0,r.jsxs)(el.Z,{children:[(0,r.jsx)(ei.Z,{children:(0,r.jsxs)(ec.Z,{children:[(0,r.jsx)(eo.Z,{children:"Team Name"}),(0,r.jsx)(eo.Z,{children:"Team ID"}),(0,r.jsx)(eo.Z,{children:"Created"}),(0,r.jsx)(eo.Z,{children:"Spend (USD)"}),(0,r.jsx)(eo.Z,{children:"Budget (USD)"}),(0,r.jsx)(eo.Z,{children:"Models"}),(0,r.jsx)(eo.Z,{children:"Organization"}),(0,r.jsx)(eo.Z,{children:"Info"})]})}),(0,r.jsx)(ea.Z,{children:s&&s.length>0?s.filter(e=>!x||e.organization_id===x.organization_id).sort((e,s)=>new Date(s.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>(0,r.jsxs)(ec.Z,{children:[(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,r.jsx)(en.Z,{children:(0,r.jsx)("div",{className:"overflow-hidden",children:(0,r.jsx)(ex.Z,{title:e.team_id,children:(0,r.jsxs)(F.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>{I(e.team_id)},children:[e.team_id.slice(0,7),"..."]})})})}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,sg.pw)(e.spend,4)}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!==e.max_budget&&void 0!==e.max_budget?e.max_budget:"No limit"}),(0,r.jsx)(en.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,r.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,r.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,r.jsx)(sc.Z,{size:"xs",className:"mb-1",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,r.jsx)("div",{children:(0,r.jsx)($.Z,{icon:ew[e.team_id]?e8.Z:e7.Z,className:"cursor-pointer",size:"xs",onClick:()=>{eN(s=>({...s,[e.team_id]:!s[e.team_id]}))}})}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,s)=>"all-proxy-models"===e?(0,r.jsx)(sc.Z,{size:"xs",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})},s):(0,r.jsx)(sc.Z,{size:"xs",color:"blue",children:(0,r.jsx)(U.Z,{children:e.length>30?"".concat((0,st.W0)(e).slice(0,30),"..."):(0,st.W0)(e)})},s)),e.models.length>3&&!ew[e.team_id]&&(0,r.jsx)(sc.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,r.jsxs)(U.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),ew[e.team_id]&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,s)=>"all-proxy-models"===e?(0,r.jsx)(sc.Z,{size:"xs",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})},s+3):(0,r.jsx)(sc.Z,{size:"xs",color:"blue",children:(0,r.jsx)(U.Z,{children:e.length>30?"".concat((0,st.W0)(e).slice(0,30),"..."):(0,st.W0)(e)})},s+3))})]})]})})}):null})}),(0,r.jsx)(en.Z,{children:e.organization_id}),(0,r.jsxs)(en.Z,{children:[(0,r.jsxs)(U.Z,{children:[eb&&e.team_id&&eb[e.team_id]&&eb[e.team_id].keys&&eb[e.team_id].keys.length," ","Keys"]}),(0,r.jsxs)(U.Z,{children:[eb&&e.team_id&&eb[e.team_id]&&eb[e.team_id].team_info&&eb[e.team_id].team_info.members_with_roles&&eb[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,r.jsx)(en.Z,{children:"Admin"==o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.Z,{icon:et.Z,size:"sm",onClick:()=>{I(e.team_id),E(!0)}}),(0,r.jsx)($.Z,{onClick:()=>eF(e.team_id),icon:er.Z,size:"sm","data-testid":"delete-team-button"})]}):null})]},e.team_id)):null})]}),em&&(()=>{var e;let t=null==s?void 0:s.find(e=>e.team_id===eg),l=(null==t?void 0:t.team_alias)||"",a=(null==t?void 0:null===(e=t.keys)||void 0===e?void 0:e.length)||0,n=eA===l;return(0,r.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,r.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Team"}),(0,r.jsx)("button",{onClick:()=>{eM(),eD("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,r.jsx)(sf.Z,{size:20})})]}),(0,r.jsxs)("div",{className:"px-6 py-4",children:[a>0&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,r.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,r.jsx)(sj.Z,{size:20})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-base font-medium text-red-600",children:["Warning: This team has ",a," associated key",a>1?"s":"","."]}),(0,r.jsx)("p",{className:"text-base text-red-600 mt-2",children:"Deleting the team will also delete all associated keys. This action is irreversible."})]})]}),(0,r.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to force delete this team and all its keys?"}),(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,r.jsx)("span",{className:"underline",children:l})," to confirm deletion:"]}),(0,r.jsx)("input",{type:"text",value:eA,onChange:e=>eD(e.target.value),placeholder:"Enter team name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,r.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,r.jsx)("button",{onClick:()=>{eM(),eD("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,r.jsx)("button",{onClick:eR,disabled:!n,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(n?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Force Delete"})]})]})})})()]})})})]}),(0,r.jsx)(B.Z,{children:(0,r.jsx)(sx.Z,{accessToken:a,userID:i})}),(0,eX.tY)(o||"")&&(0,r.jsx)(B.Z,{children:(0,r.jsx)(sa.Z,{accessToken:a,userID:i||"",userRole:o||""})})]})]}),sZ(o,i,c)&&(0,r.jsx)(H.Z,{title:"Create Team",visible:V,width:1e3,footer:null,onOk:()=>{Y(!1),v.resetFields(),eS([]),eL({})},onCancel:()=>{Y(!1),v.resetFields(),eS([]),eL({})},children:(0,r.jsxs)(K.Z,{form:v,onFinish:eO,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,r.jsx)(Q.Z,{placeholder:""})}),(()=>{let e=sw(o,i,c),s="Admin"!==o,t=1===e.length,l=0===e.length;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Organization"," ",(0,r.jsx)(ex.Z,{title:(0,r.jsxs)("span",{children:["Organizations can have multiple teams. Learn more about"," ",(0,r.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/user_management_heirarchy",target:"_blank",rel:"noopener noreferrer",style:{color:"#1890ff",textDecoration:"underline"},onClick:e=>e.stopPropagation(),children:"user management hierarchy"})]}),children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"organization_id",initialValue:x?x.organization_id:null,className:"mt-8",rules:s?[{required:!0,message:"Please select an organization"}]:[],help:t?"You can only create teams within this organization":s?"required":"",children:(0,r.jsx)(eh.default,{showSearch:!0,allowClear:!s,disabled:t,placeholder:l?"No organizations available":"Search or select an Organization",onChange:s=>{v.setFieldValue("organization_id",s),g((null==e?void 0:e.find(e=>e.organization_id===s))||null)},filterOption:(e,s)=>{var t;return!!s&&((null===(t=s.children)||void 0===t?void 0:t.toString())||"").toLowerCase().includes(e.toLowerCase())},optionFilterProp:"children",children:null==e?void 0:e.map(e=>(0,r.jsxs)(eh.default.Option,{value:e.organization_id,children:[(0,r.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,r.jsxs)("span",{className:"text-gray-500",children:["(",e.organization_id,")"]})]},e.organization_id))})}),s&&!t&&e.length>1&&(0,r.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,r.jsx)(U.Z,{className:"text-blue-800 text-sm",children:"Please select an organization to create a team for. You can only create teams within organizations where you are an admin."})})]})})(),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Models"," ",(0,r.jsx)(ex.Z,{title:"These are the models that your selected team has access to",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,r.jsxs)(eh.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,r.jsx)(eh.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),ej.map(e=>(0,r.jsx)(eh.default.Option,{value:e,children:(0,st.W0)(e)},e))]})}),(0,r.jsx)(K.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(ss.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(K.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(eh.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(eh.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(eh.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(eh.default.Option,{value:"30d",children:"monthly"})]})}),(0,r.jsx)(K.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsxs)(sn.Z,{className:"mt-20 mb-8",onClick:()=>{ez||(eE(),eP(!0))},children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Additional Settings"})}),(0,r.jsxs)(si.Z,{children:[(0,r.jsx)(K.Z.Item,{label:"Team ID",name:"team_id",help:"ID of the team you want to create. If not provided, it will be generated automatically.",children:(0,r.jsx)(Q.Z,{onChange:e=>{e.target.value=e.target.value.trim()}})}),(0,r.jsx)(K.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",normalize:e=>e?Number(e):void 0,tooltip:"This is the individual budget for a user in the team.",children:(0,r.jsx)(ss.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(K.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,r.jsx)(Q.Z,{placeholder:"e.g., 30d"})}),(0,r.jsx)(K.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"The RPM (Requests Per Minute) limit for individual team members",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"The TPM (Tokens Per Minute) limit for individual team members",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Metadata",name:"metadata",help:"Additional team metadata. Enter metadata as JSON object.",children:(0,r.jsx)(e9.default.TextArea,{rows:4})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Guardrails"," ",(0,r.jsx)(ex.Z,{title:"Setup your first guardrail",children:(0,r.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-8",help:"Select existing guardrails or enter new ones",children:(0,r.jsx)(eh.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:e_.map(e=>({value:e,label:e}))})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,r.jsx)(ex.Z,{title:"Select which vector stores this team can access by default. Leave empty for access to all vector stores",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-8",help:"Select vector stores this team can access. Leave empty for access to all vector stores",children:(0,r.jsx)(sh.Z,{onChange:e=>v.setFieldValue("allowed_vector_store_ids",e),value:v.getFieldValue("allowed_vector_store_ids"),accessToken:a||"",placeholder:"Select vector stores (optional)"})})]})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"MCP Settings"})}),(0,r.jsxs)(si.Z,{children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,r.jsx)(ex.Z,{title:"Select which MCP servers or access groups this team can access",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers or access groups this team can access",children:(0,r.jsx)(sy.Z,{onChange:e=>v.setFieldValue("allowed_mcp_servers_and_groups",e),value:v.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:a||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,r.jsx)(K.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,r.jsx)(e9.default,{type:"hidden"})}),(0,r.jsx)(K.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_mcp_servers_and_groups!==s.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(sb.Z,{accessToken:a||"",selectedServers:(null===(e=v.getFieldValue("allowed_mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:v.getFieldValue("mcp_tool_permissions")||{},onChange:e=>v.setFieldsValue({mcp_tool_permissions:e})})})}})]})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Logging Settings"})}),(0,r.jsx)(si.Z,{children:(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(sp.Z,{value:ek,onChange:eS,premiumUser:d})})})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Model Aliases"})}),(0,r.jsx)(si.Z,{children:(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)(U.Z,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used by team members in API calls. This allows you to create shortcuts for specific models."}),(0,r.jsx)(sv.Z,{accessToken:a||"",initialModelAliases:eI,onAliasUpdate:eL,showExampleConfig:!1})]})})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(se.ZP,{htmlType:"submit",children:"Create Team"})})]})})]})})})},sk=t(16593),sS=t(60493),sC=t(58927);let sT=(e,s,t,l)=>[{accessorKey:"search_tool_id",header:"Search Tool ID",cell:s=>{var t;let{row:l}=s;return(0,r.jsxs)("button",{onClick:()=>e(l.original.search_tool_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[null===(t=l.original.search_tool_id)||void 0===t?void 0:t.slice(0,7),"..."]})}},{accessorKey:"search_tool_name",header:"Name",cell:e=>{let{getValue:s}=e;return(0,r.jsx)("span",{className:"font-medium",children:s()})}},{id:"provider",header:"Provider",cell:e=>{let{row:s}=e,t=s.original.litellm_params.search_provider,a=l.find(e=>e.provider_name===t),n=(null==a?void 0:a.ui_friendly_name)||t;return(0,r.jsx)("span",{className:"text-sm",children:n})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,t=s.original;return(0,r.jsx)("span",{className:"text-xs",children:t.created_at?new Date(t.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,t=s.original;return(0,r.jsx)("span",{className:"text-xs",children:t.updated_at?new Date(t.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:l}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(sC.J,{icon:et.Z,size:"sm",onClick:()=>s(l.original.search_tool_id),className:"cursor-pointer"}),(0,r.jsx)(sC.J,{icon:er.Z,size:"sm",onClick:()=>t(l.original.search_tool_id),className:"cursor-pointer"})]})}}];var sz=t(10900),sP=t(30401),sA=t(78867),sD=t(42264),sI=t(87908),sL=t(61935);let{Text:sE}=e5.default,sF=e=>{var s,t,a,n;let{searchToolName:i,accessToken:o,className:c=""}=e,[d,m]=(0,l.useState)(""),[u,x]=(0,l.useState)(!1),[h,p]=(0,l.useState)([]),[g,f]=(0,l.useState)({}),[j,y]=(0,l.useState)(!1),b=async()=>{if(!d.trim()){sD.ZP.warning("Please enter a search query");return}x(!0);let e=performance.now();try{let s=await (0,S.searchToolQueryCall)(o,i,d),t=performance.now(),r={query:d,response:s,timestamp:Date.now(),latency:Math.round(t-e)};p(e=>[r,...e])}catch(e){console.error("Error querying search tool:",e),W.Z.fromBackend("Failed to query search tool")}finally{x(!1)}},v=e=>new Date(e).toLocaleString(),_=(e,s)=>{let t="".concat(e,"-").concat(s);f(e=>({...e,[t]:!e[t]}))},Z=(0,r.jsx)(sL.Z,{style:{fontSize:24},spin:!0}),w=h.length>0?h[0]:null;return(0,r.jsxs)(sd.Z,{className:"mt-6",children:[(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(V.Z,{children:"Test Search Tool"})}),(0,r.jsxs)("div",{className:"flex flex-col",style:{minHeight:"600px"},children:[(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsxs)("div",{className:"flex items-stretch gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center flex-1 bg-white rounded-lg px-4 transition-all duration-200",style:{border:j?"2px solid #3b82f6":"2px solid #e5e7eb",boxShadow:j?"0 0 0 3px rgba(59, 130, 246, 0.1)":"0 1px 2px 0 rgba(0, 0, 0, 0.05)",height:"48px"},children:[(0,r.jsx)(eV.Z,{className:"text-gray-400 mr-3",style:{fontSize:"18px"}}),(0,r.jsx)(e9.default,{value:d,onChange:e=>m(e.target.value),onFocus:()=>y(!0),onBlur:()=>y(!1),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),b())},placeholder:"Enter your search query...",disabled:u,bordered:!1,style:{fontSize:"15px",padding:0,height:"100%",boxShadow:"none"}})]}),(0,r.jsx)(se.ZP,{type:"primary",onClick:b,disabled:u||!d.trim(),icon:(0,r.jsx)(eV.Z,{}),loading:u,style:{height:"48px",paddingLeft:"24px",paddingRight:"24px",borderRadius:"8px",fontWeight:500,fontSize:"15px",backgroundColor:u||!d.trim()?void 0:"#1890ff",borderColor:u||!d.trim()?void 0:"#1890ff",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:"Search"})]})}),(0,r.jsx)("div",{className:"flex-1",children:w||u?(0,r.jsxs)("div",{children:[u&&(0,r.jsxs)("div",{className:"flex flex-col justify-center items-center py-16",children:[(0,r.jsx)(sI.Z,{indicator:Z}),(0,r.jsx)(sE,{className:"mt-4 text-gray-600 font-medium",children:"Searching..."})]}),w&&!u&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)(sE,{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Search Query"}),(0,r.jsx)("div",{className:"text-base font-semibold text-gray-900 mt-1.5",children:w.query})]}),(0,r.jsxs)("div",{className:"text-right ml-4",children:[(0,r.jsx)(sE,{className:"text-xs text-gray-500",children:v(w.timestamp)}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,r.jsxs)("div",{className:"text-sm font-semibold text-blue-600",children:[(null===(t=w.response)||void 0===t?void 0:null===(s=t.results)||void 0===s?void 0:s.length)||0," ",(null===(n=w.response)||void 0===n?void 0:null===(a=n.results)||void 0===a?void 0:a.length)===1?"result":"results"]}),void 0!==w.latency&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-gray-400",children:"•"}),(0,r.jsxs)("div",{className:"text-sm font-semibold text-green-600",children:[w.latency,"ms"]})]})]})]})]})}),w.response&&w.response.results&&w.response.results.length>0?(0,r.jsx)("div",{className:"space-y-3",children:w.response.results.map((e,s)=>{let t=g["0-".concat(s)]||!1;return(0,r.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden transition-all duration-200",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseEnter:e=>{e.currentTarget.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",e.currentTarget.style.borderColor="#e0e7ff"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="0 1px 2px 0 rgba(0, 0, 0, 0.05)",e.currentTarget.style.borderColor="#e5e7eb"},children:(0,r.jsxs)("div",{className:"p-5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-2",children:[(0,r.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-600 hover:text-blue-700 flex-1 leading-snug",style:{textDecoration:"none"},onMouseEnter:e=>e.currentTarget.style.textDecoration="underline",onMouseLeave:e=>e.currentTarget.style.textDecoration="none",children:e.title}),(0,r.jsx)(se.ZP,{type:"text",size:"small",className:"flex-shrink-0",icon:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),onClick:()=>window.open(e.url,"_blank"),style:{color:"#6b7280"}})]}),(0,r.jsx)("div",{className:"text-sm text-green-700 mb-3 truncate font-medium",children:e.url}),(0,r.jsx)("div",{className:"text-sm text-gray-700 leading-relaxed",children:t?e.snippet:"".concat(e.snippet.substring(0,200)).concat(e.snippet.length>200?"...":"")}),e.snippet.length>200&&(0,r.jsx)(se.ZP,{type:"link",size:"small",className:"mt-3 p-0 h-auto",onClick:()=>_(0,s),style:{fontSize:"13px",fontWeight:500,color:"#3b82f6"},children:t?"Show less":"Show more"})]})},s)})}):(0,r.jsxs)("div",{className:"text-center py-12 bg-gray-50 border border-gray-200 rounded-lg",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mx-auto mb-4",children:(0,r.jsx)(eV.Z,{style:{fontSize:"24px",color:"#9ca3af"}})}),(0,r.jsx)(sE,{className:"text-gray-600 font-medium",children:"No results found"}),(0,r.jsx)(sE,{className:"text-sm text-gray-500 mt-1",children:"Try a different search query"})]})]}),h.length>1&&(0,r.jsxs)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(sE,{className:"text-sm font-semibold text-gray-700",children:"Previous Searches"}),(0,r.jsx)(se.ZP,{onClick:()=>{p([]),f({}),W.Z.success("Search history cleared")},size:"small",type:"link",style:{fontSize:"13px",fontWeight:500},children:"Clear All"})]}),(0,r.jsx)("div",{className:"space-y-2",children:h.slice(1,6).map((e,s)=>{var t,l,a,n;return(0,r.jsxs)("div",{className:"p-3 bg-gray-50 border border-gray-200 rounded-lg cursor-pointer transition-all duration-200 hover:bg-gray-100 hover:border-gray-300",onClick:()=>{m(e.query)},children:[(0,r.jsx)("div",{className:"text-sm font-medium text-gray-800 truncate",children:e.query}),(0,r.jsxs)("div",{className:"text-xs text-gray-500 mt-1.5 flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"font-medium text-blue-600",children:[(null===(l=e.response)||void 0===l?void 0:null===(t=l.results)||void 0===t?void 0:t.length)||0," ",(null===(n=e.response)||void 0===n?void 0:null===(a=n.results)||void 0===a?void 0:a.length)===1?"result":"results"]}),void 0!==e.latency&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"•"}),(0,r.jsxs)("span",{className:"font-medium text-green-600",children:[e.latency,"ms"]})]}),(0,r.jsx)("span",{children:"•"}),(0,r.jsx)("span",{children:v(e.timestamp)})]})]},s+1)})})]})]}):(0,r.jsxs)("div",{className:"h-full flex flex-col items-center justify-center p-8",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-24 h-24 rounded-full bg-gray-100 mb-6",children:(0,r.jsx)(eV.Z,{style:{fontSize:"48px",color:"#9ca3af"}})}),(0,r.jsx)(sE,{className:"text-lg text-gray-600 font-medium",children:"Test your search tool"}),(0,r.jsx)(sE,{className:"text-sm text-gray-500 mt-2",children:"Enter a query above to see search results"})]})})]})]})},sR=e=>{var s;let{searchTool:t,onBack:a,isEditing:n,accessToken:i,availableProviders:o}=e,[c,d]=(0,l.useState)({}),m=async(e,s)=>{await (0,sg.vQ)(e)&&(d(e=>({...e,[s]:!0})),setTimeout(()=>{d(e=>({...e,[s]:!1}))},2e3))};return(0,r.jsxs)("div",{className:"p-4 max-w-full",children:[(0,r.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(F.Z,{icon:sz.Z,variant:"light",className:"mb-4",onClick:a,children:"Back to All Search Tools"}),(0,r.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)(V.Z,{children:t.search_tool_name}),(0,r.jsx)(se.ZP,{type:"text",size:"small",icon:c["search-tool-name"]?(0,r.jsx)(sP.Z,{size:12}):(0,r.jsx)(sA.Z,{size:12}),onClick:()=>m(t.search_tool_name,"search-tool-name"),className:"left-2 z-10 transition-all duration-200 ".concat(c["search-tool-name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,r.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)(U.Z,{className:"text-gray-500 font-mono",children:t.search_tool_id}),(0,r.jsx)(se.ZP,{type:"text",size:"small",icon:c["search-tool-id"]?(0,r.jsx)(sP.Z,{size:12}):(0,r.jsx)(sA.Z,{size:12}),onClick:()=>m(t.search_tool_id,"search-tool-id"),className:"left-2 z-10 transition-all duration-200 ".concat(c["search-tool-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,r.jsxs)(su.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"Provider"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(V.Z,{children:(e=>{let s=o.find(s=>s.provider_name===e);return(null==s?void 0:s.ui_friendly_name)||e})(t.litellm_params.search_provider)})})]}),(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"API Key"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.litellm_params.api_key?"****":"Not set"})})]}),(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"Created At"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.created_at?new Date(t.created_at).toLocaleString():"Unknown"})})]})]}),(null===(s=t.search_tool_info)||void 0===s?void 0:s.description)&&(0,r.jsxs)(sd.Z,{className:"mt-6",children:[(0,r.jsx)(U.Z,{children:"Description"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.search_tool_info.description})})]}),(0,r.jsx)("div",{className:"mt-6",children:i&&(0,r.jsx)(sF,{searchToolName:t.search_tool_name,accessToken:i})})]})};var sM=t(29),sO=t.n(sM),sB=t(23496),sq=t(35291);let{Text:sU}=e5.default;var sV=e=>{let{litellmParams:s,accessToken:t,onTestComplete:a}=e,[n,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(null),[d,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{i(!0);try{let e=await (0,S.testSearchToolConnection)(t,s);c(e),"success"===e.status&&W.Z.success("Connection test successful!")}catch(e){c({status:"error",message:e instanceof Error?e.message:"Unknown error occurred",error_type:"NetworkError"})}finally{i(!1),a&&a()}})()},[t,s,a]);let u=(null==o?void 0:o.message)?(e=>{if(!e)return"Unknown error";let s=e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error:\s*/,"").replace(/^AuthenticationError:\s*/,"");if(s.includes("")||s.includes("(.*?)<\/title>/);return e?e[1]:s.includes("401")||s.includes("Authorization Required")?"Authentication failed: Invalid API key or credentials":"Authentication error - please check your API key"}return s.length>200?s.substring(0,200)+"...":s})(o.message):"Unknown error";return n?(0,r.jsx)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:(0,r.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,r.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,r.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,r.jsxs)(sU,{style:{fontSize:"16px"},children:["Testing connection to ",s.search_provider||"search provider","..."]}),(0,r.jsx)(sO(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]})}):o?(0,r.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:["success"===o.status?(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,r.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,r.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,r.jsxs)("div",{style:{marginLeft:"12px"},children:[(0,r.jsxs)(sU,{type:"success",style:{fontSize:"18px",fontWeight:500,display:"block"},children:["Connection to ",s.search_provider," successful!"]}),o.test_query&&(0,r.jsxs)(sU,{style:{fontSize:"14px",color:"#666",marginTop:"8px",display:"block"},children:["Test query: ",(0,r.jsx)("code",{style:{backgroundColor:"#f0f0f0",padding:"2px 6px",borderRadius:"4px"},children:o.test_query})]}),void 0!==o.results_count&&(0,r.jsxs)(sU,{style:{fontSize:"14px",color:"#666",display:"block"},children:["Results retrieved: ",o.results_count]})]})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,r.jsx)(sq.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,r.jsxs)(sU,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",s.search_provider||"search provider"," failed"]})]}),(0,r.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,r.jsxs)(sU,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,r.jsx)(sU,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:u}),o.error_type&&(0,r.jsx)("div",{style:{marginTop:"8px"},children:(0,r.jsxs)(sU,{style:{fontSize:"13px",color:"#666"},children:["Error type:"," ",(0,r.jsx)("code",{style:{backgroundColor:"#ffebee",padding:"2px 6px",borderRadius:"4px",color:"#d32f2f"},children:o.error_type})]})}),o.message&&(0,r.jsx)("div",{style:{marginTop:"12px"},children:(0,r.jsx)(se.ZP,{type:"link",onClick:()=>m(!d),style:{paddingLeft:0,height:"auto"},children:d?"Hide Details":"Show Details"})})]}),d&&(0,r.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,r.jsx)(sU,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Full Error Details"}),(0,r.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o.message})]}),(0,r.jsxs)("div",{style:{backgroundColor:"#fffbf0",border:"1px solid #ffe58f",borderLeft:"4px solid #faad14",borderRadius:"8px",padding:"16px"},children:[(0,r.jsx)(sU,{strong:!0,style:{display:"block",marginBottom:"8px",color:"#d48806"},children:"Troubleshooting tips:"}),(0,r.jsxs)("ul",{style:{margin:"8px 0",paddingLeft:"20px",color:"#ad6800"},children:[(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Verify your API key is correct and active"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Check if the search provider service is operational"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Ensure you have sufficient credits/quota with the provider"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Review the provider's documentation for any additional requirements"})]})]})]})}),(0,r.jsx)(sB.Z,{style:{margin:"24px 0 16px"}}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,r.jsx)(se.ZP,{type:"link",href:"https://docs.litellm.ai/docs/search",target:"_blank",icon:(0,r.jsx)(ep.Z,{}),children:"View Search Documentation"})})]}):null};let{TextArea:sK}=e9.default,sH=e=>"".concat("/ui/assets/logos/").concat(e,".png"),sW=e=>{let{providerName:s,displayName:t}=e;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(eg.default,{src:sH(s),alt:"",width:20,height:20,style:{marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,r.jsx)("span",{children:t})]})};var sY=e=>{let{userRole:s,accessToken:t,onCreateSuccess:a,isModalVisible:n,setModalVisible:i}=e,[o]=K.Z.useForm(),[c,d]=(0,l.useState)(!1),[m,u]=(0,l.useState)({}),[x,h]=(0,l.useState)(!1),[p,g]=(0,l.useState)(!1),[f,j]=(0,l.useState)(""),{data:y,isLoading:b}=(0,sk.a)({queryKey:["searchProviders"],queryFn:()=>{if(!t)throw Error("Access Token required");return(0,S.fetchAvailableSearchProviders)(t)},enabled:!!t&&n}),v=(null==y?void 0:y.providers)||[],_=async e=>{d(!0);try{let s={search_tool_name:e.search_tool_name,litellm_params:{search_provider:e.search_provider,api_key:e.api_key,api_base:e.api_base,timeout:e.timeout?parseFloat(e.timeout):void 0,max_retries:e.max_retries?parseInt(e.max_retries):void 0},search_tool_info:e.description?{description:e.description}:void 0};if(console.log("Creating search tool with payload:",s),null!=t){let e=await (0,S.createSearchTool)(t,s);W.Z.success("Search tool created successfully"),o.resetFields(),u({}),i(!1),a(e)}}catch(e){W.Z.error("Error creating search tool: "+e)}finally{d(!1)}},Z=async()=>{try{await o.validateFields(["search_provider","api_key"]),g(!0),j("test-".concat(Date.now())),h(!0)}catch(e){W.Z.error("Please fill in Search Provider and API Key before testing")}};return(l.useEffect(()=>{n||u({})},[n]),(0,eX.tY)(s))?(0,r.jsxs)(H.Z,{title:(0,r.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,r.jsx)("span",{className:"text-2xl",children:"\uD83D\uDD0D"}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New Search Tool"})]}),open:n,width:800,onCancel:()=>{o.resetFields(),u({}),i(!1)},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:[(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsxs)(K.Z,{form:o,onFinish:_,onValuesChange:(e,s)=>u(s),layout:"vertical",className:"space-y-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Tool Name",(0,r.jsx)(ex.Z,{title:"A unique name to identify this search tool configuration (e.g., 'perplexity-search', 'tavily-news-search').",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_tool_name",rules:[{required:!0,message:"Please enter a search tool name"},{pattern:/^[a-zA-Z0-9_-]+$/,message:"Name can only contain letters, numbers, hyphens, and underscores"}],children:(0,r.jsx)(eu.o,{placeholder:"e.g., perplexity-search, my-tavily-tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Provider",(0,r.jsx)(ex.Z,{title:"Select the search provider you want to use. Each provider has different capabilities and pricing.",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,r.jsx)(eh.default,{placeholder:"Select a search provider",className:"rounded-lg",size:"large",loading:b,showSearch:!0,optionFilterProp:"children",optionLabelProp:"label",children:v.map(e=>(0,r.jsx)(eh.default.Option,{value:e.provider_name,label:(0,r.jsx)(sW,{providerName:e.provider_name,displayName:e.ui_friendly_name}),children:(0,r.jsx)(sW,{providerName:e.provider_name,displayName:e.ui_friendly_name})},e.provider_name))})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["API Key",(0,r.jsx)(ex.Z,{title:"The API key for authenticating with the search provider. This will be securely stored.",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"api_key",rules:[{required:!1,message:"Please enter an API key"}],children:(0,r.jsx)(eu.o,{type:"password",placeholder:"Enter your API key",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description (Optional)"}),name:"description",children:(0,r.jsx)(sK,{rows:3,placeholder:"Brief description of this search tool's purpose",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})]}),(0,r.jsxs)("div",{className:"flex justify-between items-center pt-6 border-t border-gray-100",children:[(0,r.jsx)(ex.Z,{title:"Get help on our github",children:(0,r.jsx)(e5.default.Link,{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",children:"Need Help?"})}),(0,r.jsxs)("div",{className:"space-x-2",children:[(0,r.jsx)(eu.z,{onClick:Z,loading:p,children:"Test Connection"}),(0,r.jsx)(eu.z,{loading:c,type:"submit",children:"Add Search Tool"})]})]})]})}),(0,r.jsx)(H.Z,{title:"Connection Test Results",open:x,onCancel:()=>{h(!1),g(!1)},footer:[(0,r.jsx)(eu.z,{onClick:()=>{h(!1),g(!1)},children:"Close"},"close")],width:700,children:x&&t&&(0,r.jsx)(sV,{litellmParams:{search_provider:m.search_provider,api_key:m.api_key,api_base:m.api_base},accessToken:t,onTestComplete:()=>g(!1)},f)})]}):null};let sJ=e=>{let{isModalOpen:s,title:t,confirmDelete:l,cancelDelete:a}=e;return s?(0,r.jsx)(H.Z,{open:s,onOk:l,okType:"danger",onCancel:a,children:(0,r.jsxs)(su.Z,{numItems:1,className:"gap-2 w-full",children:[(0,r.jsx)(V.Z,{children:t}),(0,r.jsx)(sm.Z,{numColSpan:1,children:(0,r.jsx)("p",{children:"Are you sure you want to delete this search tool?"})})]})}):null};var sG=e=>{let{accessToken:s,userRole:t,userID:a}=e,{data:n,isLoading:i,refetch:o}=(0,sk.a)({queryKey:["searchTools"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,S.fetchSearchTools)(s).then(e=>e.search_tools||[])},enabled:!!s}),{data:c,isLoading:d}=(0,sk.a)({queryKey:["searchProviders"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,S.fetchAvailableSearchProviders)(s)},enabled:!!s}),m=(null==c?void 0:c.providers)||[],[u,x]=(0,l.useState)(null),[h,p]=(0,l.useState)(!1),[g,f]=(0,l.useState)(null),[j,y]=(0,l.useState)(!1),[b,v]=(0,l.useState)(!1),[_,Z]=(0,l.useState)(!1),[w]=K.Z.useForm(),N=l.useMemo(()=>sT(e=>{f(e),y(!1)},e=>{let s=null==n?void 0:n.find(s=>s.search_tool_id===e);if(s){var t;w.setFieldsValue({search_tool_name:s.search_tool_name,search_provider:s.litellm_params.search_provider,api_key:s.litellm_params.api_key,api_base:s.litellm_params.api_base,timeout:s.litellm_params.timeout,max_retries:s.litellm_params.max_retries,description:null===(t=s.search_tool_info)||void 0===t?void 0:t.description}),f(e),Z(!0)}},k,m),[m,n,w]);function k(e){x(e),p(!0)}let C=async()=>{if(null!=u&&null!=s){try{await (0,S.deleteSearchTool)(s,u),W.Z.success("Deleted search tool successfully"),o()}catch(e){console.error("Error deleting the search tool:",e),W.Z.error("Failed to delete search tool")}p(!1),x(null)}},T=async()=>{if(s&&g)try{let e=await w.validateFields(),t={search_tool_name:e.search_tool_name,litellm_params:{search_provider:e.search_provider,api_key:e.api_key,api_base:e.api_base,timeout:e.timeout?parseFloat(e.timeout):void 0,max_retries:e.max_retries?parseInt(e.max_retries):void 0},search_tool_info:e.description?{description:e.description}:void 0};await (0,S.updateSearchTool)(s,g,t),W.Z.success("Search tool updated successfully"),Z(!1),w.resetFields(),f(null),o()}catch(e){console.error("Failed to update search tool:",e),W.Z.error("Failed to update search tool")}};return s&&t&&a?(0,r.jsxs)("div",{className:"w-full h-full p-6",children:[(0,r.jsx)(sJ,{isModalOpen:h,title:"Delete Search Tool",confirmDelete:C,cancelDelete:()=>{p(!1),x(null)}}),(0,r.jsx)(sY,{userRole:t,accessToken:s,onCreateSuccess:e=>{v(!1),o()},isModalVisible:b,setModalVisible:v}),(0,r.jsx)(H.Z,{title:"Edit Search Tool",open:_,onOk:T,onCancel:()=>{Z(!1),w.resetFields(),f(null)},width:600,children:(0,r.jsxs)(K.Z,{form:w,layout:"vertical",children:[(0,r.jsx)(K.Z.Item,{name:"search_tool_name",label:"Search Tool Name",rules:[{required:!0,message:"Please enter a search tool name"}],children:(0,r.jsx)(e9.default,{placeholder:"e.g., my-perplexity-search"})}),(0,r.jsx)(K.Z.Item,{name:"search_provider",label:"Search Provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,r.jsx)(eh.default,{placeholder:"Select a search provider",loading:d,children:m.map(e=>(0,r.jsx)(eh.default.Option,{value:e.provider_name,children:e.ui_friendly_name},e.provider_name))})}),(0,r.jsx)(K.Z.Item,{name:"api_key",label:"API Key",extra:"API key for the search provider",children:(0,r.jsx)(e9.default.Password,{placeholder:"Enter API key"})}),(0,r.jsx)(K.Z.Item,{name:"description",label:"Description",children:(0,r.jsx)(e9.default.TextArea,{rows:3,placeholder:"Description of this search tool"})})]})}),(0,r.jsx)(V.Z,{children:"Search Tools"}),(0,r.jsx)(U.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your search providers"}),(0,eX.tY)(t)&&(0,r.jsx)(F.Z,{className:"mt-4 mb-4",onClick:()=>v(!0),children:"+ Add New Search Tool"}),(0,r.jsx)(()=>g?(0,r.jsx)(sR,{searchTool:(null==n?void 0:n.find(e=>e.search_tool_id===g))||{search_tool_id:"",search_tool_name:"",litellm_params:{search_provider:""}},onBack:()=>{y(!1),f(null),o()},isEditing:j,accessToken:s,availableProviders:m}):(0,r.jsx)("div",{className:"w-full h-full",children:(0,r.jsx)("div",{className:"w-full px-6 mt-6",children:(0,r.jsx)(sS.w,{data:n||[],columns:N,renderSubComponent:()=>(0,r.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:i,noDataMessage:"No search tools configured"})})}),{})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:t,userID:a}),(0,r.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))};function sX(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";document.cookie="".concat(e,"=; Max-Age=0; Path=").concat(s)}function s$(e){try{let s=(0,n.o)(e);if(s&&"number"==typeof s.exp)return 1e3*s.exp<=Date.now();return!1}catch(e){return!0}}let sQ=new i.S;function s0(){return(0,r.jsxs)("div",{className:(0,eC.cx)("h-screen","flex items-center justify-center gap-4"),children:[(0,r.jsx)("div",{className:"text-lg font-medium py-2 pr-4 border-r border-r-gray-200",children:"\uD83D\uDE85 LiteLLM"}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(eS.S,{className:"size-4"}),(0,r.jsx)("span",{className:"text-gray-600 text-sm",children:"Loading..."})]})]})}function s1(){let[e,s]=(0,l.useState)(""),[t,i]=(0,l.useState)(!1),[F,R]=(0,l.useState)(!1),[M,O]=(0,l.useState)(null),[B,q]=(0,l.useState)(null),[U,V]=(0,l.useState)([]),[K,H]=(0,l.useState)([]),[W,Y]=(0,l.useState)([]),[J,G]=(0,l.useState)({PROXY_BASE_URL:"",PROXY_LOGOUT_URL:""}),[X,$]=(0,l.useState)(!0),Q=(0,a.useSearchParams)(),[ee,es]=(0,l.useState)({data:[]}),[et,er]=(0,l.useState)(null),[el,ea]=(0,l.useState)(!1),[en,ei]=(0,l.useState)(!0),[eo,ec]=(0,l.useState)(null),{refactoredUIFlag:ed}=(0,eT.Z)(),em=Q.get("invitation_id"),[eu,ex]=(0,l.useState)(()=>Q.get("page")||"api-keys"),[eh,ep]=(0,l.useState)(null),[eg,ef]=(0,l.useState)(!1),ej=e=>{V(s=>s?[...s,e]:[e]),ea(()=>!el)},ey=!1===en&&null===et&&null===em;return((0,l.useEffect)(()=>{let e=!1;return(async()=>{try{await (0,S.getUiConfig)()}catch(e){}if(e)return;let s=function(e){let s=document.cookie.split("; ").find(s=>s.startsWith(e+"="));if(!s)return null;let t=s.slice(e.length+1);try{return decodeURIComponent(t)}catch(e){return t}}("token"),t=s&&!s$(s)?s:null;s&&!t&&sX("token","/"),e||(er(t),ei(!1))})(),()=>{e=!0}},[]),(0,l.useEffect)(()=>{if(ey){let e=(S.proxyBaseUrl||"")+"/sso/key/generate";window.location.replace(e)}},[ey]),(0,l.useEffect)(()=>{if(!et)return;if(s$(et)){sX("token","/"),er(null);return}let e=null;try{e=(0,n.o)(et)}catch(e){sX("token","/"),er(null);return}if(e){if(ep(e.key),R(e.disabled_non_admin_personal_key_creation),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);s(t),"Admin Viewer"==t&&ex("usage")}e.user_email&&O(e.user_email),e.login_method&&$("username_password"==e.login_method),e.premium_user&&i(e.premium_user),e.auth_header_name&&(0,S.setGlobalLitellmHeaderName)(e.auth_header_name),e.user_id&&ec(e.user_id)}},[et]),(0,l.useEffect)(()=>{eh&&eo&&e&&(0,P.Nr)(eo,e,eh,Y),eh&&eo&&e&&(0,A.Z)(eh,eo,e,null,q),eh&&(0,h.g)(eh,H)},[eh,eo,e]),en||ey)?(0,r.jsx)(s0,{}):(0,r.jsx)(l.Suspense,{fallback:(0,r.jsx)(s0,{}),children:(0,r.jsx)(o.aH,{client:sQ,children:(0,r.jsx)(d.f,{accessToken:eh,children:em?(0,r.jsx)(m.Z,{userID:eo,userRole:e,premiumUser:t,teams:B,keys:U,setUserRole:s,userEmail:M,setUserEmail:O,setTeams:q,setKeys:V,organizations:K,addKey:ej,createClicked:el}):(0,r.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,r.jsx)(c.Z,{userID:eo,userRole:e,premiumUser:t,userEmail:M,setProxySettings:G,proxySettings:J,accessToken:eh,isPublicPage:!1,sidebarCollapsed:eg,onToggleSidebar:()=>{ef(!eg)}}),(0,r.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(e6,{setPage:e=>{let s=new URLSearchParams(Q);s.set("page",e),window.history.pushState(null,"","?".concat(s.toString())),ex(e)},defaultSelectedKey:eu,sidebarCollapsed:eg})}),"api-keys"==eu?(0,r.jsx)(m.Z,{userID:eo,userRole:e,premiumUser:t,teams:B,keys:U,setUserRole:s,userEmail:M,setUserEmail:O,setTeams:q,setKeys:V,organizations:K,addKey:ej,createClicked:el}):"models"==eu?(0,r.jsx)(u.Z,{userID:eo,userRole:e,token:et,keys:U,accessToken:eh,modelData:ee,setModelData:es,premiumUser:t,teams:B}):"llm-playground"==eu?(0,r.jsx)(w.Z,{userID:eo,userRole:e,token:et,accessToken:eh,disabledPersonalKeyCreation:F}):"users"==eu?(0,r.jsx)(x.Z,{userID:eo,userRole:e,token:et,keys:U,teams:B,accessToken:eh,setKeys:V}):"teams"==eu?(0,r.jsx)(sN,{teams:B,setTeams:q,accessToken:eh,userID:eo,userRole:e,organizations:K,premiumUser:t,searchParams:Q}):"organizations"==eu?(0,r.jsx)(h.Z,{organizations:K,setOrganizations:H,userModels:W,accessToken:eh,userRole:e,premiumUser:t}):"admin-panel"==eu?(0,r.jsx)(p.Z,{setTeams:q,searchParams:Q,accessToken:eh,userID:eo,showSSOBanner:X,premiumUser:t,proxySettings:J}):"api_ref"==eu?(0,r.jsx)(Z.Z,{proxySettings:J}):"settings"==eu?(0,r.jsx)(g.Z,{userID:eo,userRole:e,accessToken:eh,premiumUser:t}):"budgets"==eu?(0,r.jsx)(y.Z,{accessToken:eh}):"guardrails"==eu?(0,r.jsx)(C.Z,{accessToken:eh,userRole:e}):"prompts"==eu?(0,r.jsx)(T.Z,{accessToken:eh,userRole:e}):"transform-request"==eu?(0,r.jsx)(z.Z,{accessToken:eh}):"general-settings"==eu?(0,r.jsx)(f.Z,{userID:eo,userRole:e,accessToken:eh,modelData:ee}):"ui-theme"==eu?(0,r.jsx)(E.Z,{userID:eo,userRole:e,accessToken:eh}):"cost-tracking-settings"==eu?(0,r.jsx)(ek,{userID:eo,userRole:e,accessToken:eh}):"model-hub-table"==eu?(0,r.jsx)(v.Z,{accessToken:eh,publicPage:!1,premiumUser:t,userRole:e}):"caching"==eu?(0,r.jsx)(k.Z,{userID:eo,userRole:e,token:et,accessToken:eh,premiumUser:t}):"pass-through-settings"==eu?(0,r.jsx)(j.Z,{userID:eo,userRole:e,accessToken:eh,modelData:ee,premiumUser:t}):"logs"==eu?(0,r.jsx)(b.Z,{userID:eo,userRole:e,token:et,accessToken:eh,allTeams:null!=B?B:[],premiumUser:t}):"mcp-servers"==eu?(0,r.jsx)(D.d,{accessToken:eh,userRole:e,userID:eo}):"search-tools"==eu?(0,r.jsx)(sG,{accessToken:eh,userRole:e,userID:eo}):"tag-management"==eu?(0,r.jsx)(I.Z,{accessToken:eh,userRole:e,userID:eo}):"vector-stores"==eu?(0,r.jsx)(L.Z,{accessToken:eh,userRole:e,userID:eo}):"new_usage"==eu?(0,r.jsx)(_.Z,{userID:eo,userRole:e,accessToken:eh,teams:null!=B?B:[],premiumUser:t}):(0,r.jsx)(N.Z,{userID:eo,userRole:e,token:et,accessToken:eh,keys:U,premiumUser:t})]})]})})})})}},88904:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(88913),n=t(93192),i=t(52787),o=t(63709),c=t(87908),d=t(19250),m=t(65925),u=t(46468),x=t(9114);s.Z=e=>{var s;let{accessToken:t,userID:h,userRole:p}=e,[g,f]=(0,l.useState)(!0),[j,y]=(0,l.useState)(null),[b,v]=(0,l.useState)(!1),[_,Z]=(0,l.useState)({}),[w,N]=(0,l.useState)(!1),[k,S]=(0,l.useState)([]),{Paragraph:C}=n.default,{Option:T}=i.default;(0,l.useEffect)(()=>{(async()=>{if(!t){f(!1);return}try{let e=await (0,d.getDefaultTeamSettings)(t);if(y(e),Z(e.values||{}),t)try{let e=await (0,d.modelAvailableCall)(t,h,p);if(e&&e.data){let s=e.data.map(e=>e.id);S(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching team SSO settings:",e),x.Z.fromBackend("Failed to fetch team settings")}finally{f(!1)}})()},[t]);let z=async()=>{if(t){N(!0);try{let e=await (0,d.updateDefaultTeamSettings)(t,_);y({...j,values:e.settings}),v(!1),x.Z.success("Default team settings updated successfully")}catch(e){console.error("Error updating team settings:",e),x.Z.fromBackend("Failed to update team settings")}finally{N(!1)}}},P=(e,s)=>{Z(t=>({...t,[e]:s}))},A=(e,s,t)=>{var l;let n=s.type;return"budget_duration"===e?(0,r.jsx)(m.Z,{value:_[e]||null,onChange:s=>P(e,s),className:"mt-2"}):"boolean"===n?(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(o.Z,{checked:!!_[e],onChange:s=>P(e,s)})}):"array"===n&&(null===(l=s.items)||void 0===l?void 0:l.enum)?(0,r.jsx)(i.default,{mode:"multiple",style:{width:"100%"},value:_[e]||[],onChange:s=>P(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,r.jsx)(T,{value:e,children:e},e))}):"models"===e?(0,r.jsx)(i.default,{mode:"multiple",style:{width:"100%"},value:_[e]||[],onChange:s=>P(e,s),className:"mt-2",children:k.map(e=>(0,r.jsx)(T,{value:e,children:(0,u.W0)(e)},e))}):"string"===n&&s.enum?(0,r.jsx)(i.default,{style:{width:"100%"},value:_[e]||"",onChange:s=>P(e,s),className:"mt-2",children:s.enum.map(e=>(0,r.jsx)(T,{value:e,children:e},e))}):(0,r.jsx)(a.oi,{value:void 0!==_[e]?String(_[e]):"",onChange:s=>P(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},D=(e,s)=>null==s?(0,r.jsx)("span",{className:"text-gray-400",children:"Not set"}):"budget_duration"===e?(0,r.jsx)("span",{children:(0,m.m)(s)}):"boolean"==typeof s?(0,r.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,r.jsx)("span",{className:"text-gray-400",children:"None"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,r.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,u.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,r.jsx)("span",{className:"text-gray-400",children:"None"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,r.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,r.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,r.jsx)("span",{children:String(s)});return g?(0,r.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,r.jsx)(c.Z,{size:"large"})}):j?(0,r.jsxs)(a.Zb,{children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,r.jsx)(a.Dx,{className:"text-xl",children:"Default Team Settings"}),!g&&j&&(b?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(a.zx,{variant:"secondary",onClick:()=>{v(!1),Z(j.values||{})},disabled:w,children:"Cancel"}),(0,r.jsx)(a.zx,{onClick:z,loading:w,children:"Save Changes"})]}):(0,r.jsx)(a.zx,{onClick:()=>v(!0),children:"Edit Settings"}))]}),(0,r.jsx)(a.xv,{children:"These settings will be applied by default when creating new teams."}),(null==j?void 0:null===(s=j.field_schema)||void 0===s?void 0:s.description)&&(0,r.jsx)(C,{className:"mb-4 mt-2",children:j.field_schema.description}),(0,r.jsx)(a.iz,{}),(0,r.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=j;return s&&s.properties?Object.entries(s.properties).map(s=>{let[t,l]=s,n=e[t],i=t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,r.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,r.jsx)(a.xv,{className:"font-medium text-lg",children:i}),(0,r.jsx)(C,{className:"text-sm text-gray-500 mt-1",children:l.description||"No description available"}),b?(0,r.jsx)("div",{className:"mt-2",children:A(t,l,n)}):(0,r.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:D(t,n)})]},t)}):(0,r.jsx)(a.xv,{children:"No schema information available"})})()})]}):(0,r.jsx)(a.Zb,{children:(0,r.jsx)(a.xv,{children:"No team settings available or you do not have permission to view them."})})}},49104:function(e,s,t){"use strict";t.d(s,{Z:function(){return E}});var r=t(57437),l=t(2265),a=t(87452),n=t(88829),i=t(72208),o=t(49566),c=t(13634),d=t(82680),m=t(20577),u=t(52787),x=t(73002),h=t(19250),p=t(9114),g=e=>{let{isModalVisible:s,accessToken:t,setIsModalVisible:l,setBudgetList:g}=e,[f]=c.Z.useForm(),j=async e=>{if(null!=t&&void 0!=t)try{p.Z.info("Making API Call");let s=await (0,h.budgetCreateCall)(t,e);console.log("key create Response:",s),g(e=>e?[...e,s]:[s]),p.Z.success("Budget Created"),f.resetFields()}catch(e){console.error("Error creating the key:",e),p.Z.fromBackend("Error creating the key: ".concat(e))}};return(0,r.jsx)(d.Z,{title:"Create Budget",visible:s,width:800,footer:null,onOk:()=>{l(!1),f.resetFields()},onCancel:()=>{l(!1),f.resetFields()},children:(0,r.jsxs)(c.Z,{form:f,onFinish:j,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(o.Z,{placeholder:""})}),(0,r.jsx)(c.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsxs)(a.Z,{className:"mt-20 mb-8",children:[(0,r.jsx)(i.Z,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(n.Z,{children:[(0,r.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(m.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(u.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(u.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(u.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(u.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(x.ZP,{htmlType:"submit",children:"Create Budget"})})]})})},f=e=>{let{isModalVisible:s,accessToken:t,setIsModalVisible:g,setBudgetList:f,existingBudget:j,handleUpdateCall:y}=e;console.log("existingBudget",j);let[b]=c.Z.useForm();(0,l.useEffect)(()=>{b.setFieldsValue(j)},[j,b]);let v=async e=>{if(null!=t&&void 0!=t)try{p.Z.info("Making API Call"),g(!0);let s=await (0,h.budgetUpdateCall)(t,e);f(e=>e?[...e,s]:[s]),p.Z.success("Budget Updated"),b.resetFields(),y()}catch(e){console.error("Error creating the key:",e),p.Z.fromBackend("Error creating the key: ".concat(e))}};return(0,r.jsx)(d.Z,{title:"Edit Budget",visible:s,width:800,footer:null,onOk:()=>{g(!1),b.resetFields()},onCancel:()=>{g(!1),b.resetFields()},children:(0,r.jsxs)(c.Z,{form:b,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:j,children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(o.Z,{placeholder:""})}),(0,r.jsx)(c.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsxs)(a.Z,{className:"mt-20 mb-8",children:[(0,r.jsx)(i.Z,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(n.Z,{children:[(0,r.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(m.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(u.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(u.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(u.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(u.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(x.ZP,{htmlType:"submit",children:"Save"})})]})})},j=t(20831),y=t(12514),b=t(47323),v=t(12485),_=t(18135),Z=t(35242),w=t(29706),N=t(77991),k=t(21626),S=t(97214),C=t(28241),T=t(58834),z=t(69552),P=t(71876),A=t(84264),D=t(53410),I=t(74998),L=t(17906),E=e=>{let{accessToken:s}=e,[t,a]=(0,l.useState)(!1),[n,i]=(0,l.useState)(!1),[o,c]=(0,l.useState)(null),[d,m]=(0,l.useState)([]);(0,l.useEffect)(()=>{s&&(0,h.getBudgetList)(s).then(e=>{m(e)})},[s]);let u=async(e,t)=>{console.log("budget_id",e),null!=s&&(c(d.find(s=>s.budget_id===e)||null),i(!0))},x=async(e,t)=>{if(null==s)return;p.Z.info("Request made"),await (0,h.budgetDeleteCall)(s,e);let r=[...d];r.splice(t,1),m(r),p.Z.success("Budget Deleted.")},E=async()=>{null!=s&&(0,h.getBudgetList)(s).then(e=>{m(e)})};return(0,r.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,r.jsx)(j.Z,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>a(!0),children:"+ Create Budget"}),(0,r.jsx)(g,{accessToken:s,isModalVisible:t,setIsModalVisible:a,setBudgetList:m}),o&&(0,r.jsx)(f,{accessToken:s,isModalVisible:n,setIsModalVisible:i,setBudgetList:m,existingBudget:o,handleUpdateCall:E}),(0,r.jsxs)(y.Z,{children:[(0,r.jsx)(A.Z,{children:"Create a budget to assign to customers."}),(0,r.jsxs)(k.Z,{children:[(0,r.jsx)(T.Z,{children:(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(z.Z,{children:"Budget ID"}),(0,r.jsx)(z.Z,{children:"Max Budget"}),(0,r.jsx)(z.Z,{children:"TPM"}),(0,r.jsx)(z.Z,{children:"RPM"})]})}),(0,r.jsx)(S.Z,{children:d.slice().sort((e,s)=>new Date(s.updated_at).getTime()-new Date(e.updated_at).getTime()).map((e,s)=>(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(C.Z,{children:e.budget_id}),(0,r.jsx)(C.Z,{children:e.max_budget?e.max_budget:"n/a"}),(0,r.jsx)(C.Z,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,r.jsx)(C.Z,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,r.jsx)(b.Z,{icon:D.Z,size:"sm",onClick:()=>u(e.budget_id,s)}),(0,r.jsx)(b.Z,{icon:I.Z,size:"sm",onClick:()=>x(e.budget_id,s)})]},s))})]})]}),(0,r.jsxs)("div",{className:"mt-5",children:[(0,r.jsx)(A.Z,{className:"text-base",children:"How to use budget id"}),(0,r.jsxs)(_.Z,{children:[(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(v.Z,{children:"Assign Budget to Customer"}),(0,r.jsx)(v.Z,{children:"Test it (Curl)"}),(0,r.jsx)(v.Z,{children:"Test it (OpenAI SDK)"})]}),(0,r.jsxs)(N.Z,{children:[(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"bash",children:"\ncurl -X POST --location '/end_user/new' \n-H 'Authorization: Bearer ' \n-H 'Content-Type: application/json' \n-d '{\"user_id\": \"my-customer-id', \"budget_id\": \"\"}' # \uD83D\uDC48 KEY CHANGE\n\n "})}),(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"bash",children:'\ncurl -X POST --location \'/chat/completions\' \n-H \'Authorization: Bearer \' \n-H \'Content-Type: application/json\' \n-d \'{\n "model": "gpt-3.5-turbo\', \n "messages":[{"role": "user", "content": "Hey, how\'s it going?"}],\n "user": "my-customer-id"\n}\' # \uD83D\uDC48 KEY CHANGE\n\n '})}),(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"python",children:'from openai import OpenAI\nclient = OpenAI(\n base_url="",\n api_key=""\n)\n\ncompletion = client.chat.completions.create(\n model="gpt-3.5-turbo",\n messages=[\n {"role": "system", "content": "You are a helpful assistant."},\n {"role": "user", "content": "Hello!"}\n ],\n user="my-customer-id"\n)\n\nprint(completion.choices[0].message)'})})]})]})]})]})}},918:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(62490),n=t(19250),i=t(9114);s.Z=e=>{let{accessToken:s,userID:t}=e,[o,c]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(s&&t)try{let e=await (0,n.availableTeamListCall)(s);c(e)}catch(e){console.error("Error fetching available teams:",e)}})()},[s,t]);let d=async e=>{if(s&&t)try{await (0,n.teamMemberAddCall)(s,e,{user_id:t,role:"user"}),i.Z.success("Successfully joined team"),c(s=>s.filter(s=>s.team_id!==e))}catch(e){console.error("Error joining team:",e),i.Z.fromBackend("Failed to join team")}};return(0,r.jsx)(a.Zb,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,r.jsxs)(a.iA,{children:[(0,r.jsx)(a.ss,{children:(0,r.jsxs)(a.SC,{children:[(0,r.jsx)(a.xs,{children:"Team Name"}),(0,r.jsx)(a.xs,{children:"Description"}),(0,r.jsx)(a.xs,{children:"Members"}),(0,r.jsx)(a.xs,{children:"Models"}),(0,r.jsx)(a.xs,{children:"Actions"})]})}),(0,r.jsxs)(a.RM,{children:[o.map(e=>(0,r.jsxs)(a.SC,{children:[(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.xv,{children:e.team_alias})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.xv,{children:e.description||"No description available"})}),(0,r.jsx)(a.pj,{children:(0,r.jsxs)(a.xv,{children:[e.members_with_roles.length," members"]})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)("div",{className:"flex flex-col",children:e.models&&0!==e.models.length?e.models.map((e,s)=>(0,r.jsx)(a.Ct,{size:"xs",className:"mb-1",color:"blue",children:(0,r.jsx)(a.xv,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},s)):(0,r.jsx)(a.Ct,{size:"xs",color:"red",children:(0,r.jsx)(a.xv,{children:"All Proxy Models"})})})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.zx,{size:"xs",variant:"secondary",onClick:()=>d(e.team_id),children:"Join Team"})})]},e.team_id)),0===o.length&&(0,r.jsx)(a.SC,{children:(0,r.jsx)(a.pj,{colSpan:5,className:"text-center",children:(0,r.jsx)(a.xv,{children:"No available teams to join"})})})]})]})})}},6674:function(e,s,t){"use strict";t.d(s,{Z:function(){return d}});var r=t(57437),l=t(2265),a=t(73002),n=t(23639),i=t(96761),o=t(19250),c=t(9114),d=e=>{let{accessToken:s}=e,[t,d]=(0,l.useState)('{\n "model": "openai/gpt-4o",\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n },\n {\n "role": "user",\n "content": "Explain quantum computing in simple terms"\n }\n ],\n "temperature": 0.7,\n "max_tokens": 500,\n "stream": true\n}'),[m,u]=(0,l.useState)(""),[x,h]=(0,l.useState)(!1),p=(e,s,t)=>{let r=JSON.stringify(s,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),l=Object.entries(t).map(e=>{let[s,t]=e;return"-H '".concat(s,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(l?"".concat(l," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(r,"\n }'")},g=async()=>{h(!0);try{let e;try{e=JSON.parse(t)}catch(e){c.Z.fromBackend("Invalid JSON in request body"),h(!1);return}let r={call_type:"completion",request_body:e};if(!s){c.Z.fromBackend("No access token found"),h(!1);return}let l=await (0,o.transformRequestCall)(s,r);if(l.raw_request_api_base&&l.raw_request_body){let e=p(l.raw_request_api_base,l.raw_request_body,l.raw_request_headers||{});u(e),c.Z.success("Request transformed successfully")}else{let e="string"==typeof l?l:JSON.stringify(l);u(e),c.Z.info("Transformed request received in unexpected format")}}catch(e){console.error("Error transforming request:",e),c.Z.fromBackend("Failed to transform request")}finally{h(!1)}};return(0,r.jsxs)("div",{className:"w-full m-2",style:{overflow:"hidden"},children:[(0,r.jsx)(i.Z,{children:"Playground"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"See how LiteLLM transforms your request for the specified provider."}),(0,r.jsxs)("div",{style:{display:"flex",gap:"16px",width:"100%",minWidth:0,overflow:"hidden"},className:"mt-4",children:[(0,r.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"600px",minWidth:0},children:[(0,r.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,r.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Original Request"}),(0,r.jsx)("p",{style:{color:"#666",margin:0},children:"The request you would send to LiteLLM /chat/completions endpoint."})]}),(0,r.jsx)("textarea",{style:{flex:"1 1 auto",width:"100%",minHeight:"240px",padding:"16px",border:"1px solid #e8e8e8",borderRadius:"6px",fontFamily:"monospace",fontSize:"14px",resize:"none",marginBottom:"24px",overflow:"auto"},value:t,onChange:e=>d(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),g())},placeholder:"Press Cmd/Ctrl + Enter to transform"}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"auto"},children:(0,r.jsxs)(a.ZP,{type:"primary",style:{backgroundColor:"#000",display:"flex",alignItems:"center",gap:"8px"},onClick:g,loading:x,children:[(0,r.jsx)("span",{children:"Transform"}),(0,r.jsx)("span",{children:"→"})]})})]}),(0,r.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"800px",minWidth:0},children:[(0,r.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,r.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Transformed Request"}),(0,r.jsx)("p",{style:{color:"#666",margin:0},children:"How LiteLLM transforms your request for the specified provider."}),(0,r.jsx)("br",{}),(0,r.jsx)("p",{style:{color:"#666",margin:0},className:"text-xs",children:"Note: Sensitive headers are not shown."})]}),(0,r.jsxs)("div",{style:{position:"relative",backgroundColor:"#f5f5f5",borderRadius:"6px",flex:"1 1 auto",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,r.jsx)("pre",{style:{padding:"16px",fontFamily:"monospace",fontSize:"14px",margin:0,overflow:"auto",flex:"1 1 auto"},children:m||'curl -X POST \\\n https://api.openai.com/v1/chat/completions \\\n -H \'Authorization: Bearer sk-xxx\' \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "model": "gpt-4",\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n }\n ],\n "temperature": 0.7\n }\''}),(0,r.jsx)(a.ZP,{type:"text",icon:(0,r.jsx)(n.Z,{}),style:{position:"absolute",right:"8px",top:"8px"},size:"small",onClick:()=>{navigator.clipboard.writeText(m||""),c.Z.success("Copied to clipboard")}})]})]})]}),(0,r.jsx)("div",{className:"mt-4 text-right w-full",children:(0,r.jsxs)("p",{className:"text-sm text-gray-500",children:["Found an error? File an issue"," ",(0,r.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})]})}},5183:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(19046),n=t(69734),i=t(19250),o=t(9114);s.Z=e=>{let{userID:s,userRole:t,accessToken:c}=e,{logoUrl:d,setLogoUrl:m}=(0,n.F)(),[u,x]=(0,l.useState)(""),[h,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{c&&g()},[c]);let g=async()=>{try{let s=(0,i.getProxyBaseUrl)(),t=await fetch(s?"".concat(s,"/get/ui_theme_settings"):"/get/ui_theme_settings",{method:"GET",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"}});if(t.ok){var e;let s=await t.json(),r=(null===(e=s.values)||void 0===e?void 0:e.logo_url)||"";x(r),m(r||null)}}catch(e){console.error("Error fetching theme settings:",e)}},f=async()=>{p(!0);try{let e=(0,i.getProxyBaseUrl)();if((await fetch(e?"".concat(e,"/update/ui_theme_settings"):"/update/ui_theme_settings",{method:"PATCH",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"},body:JSON.stringify({logo_url:u||null})})).ok)o.Z.success("Logo settings updated successfully!"),m(u||null);else throw Error("Failed to update settings")}catch(e){console.error("Error updating logo settings:",e),o.Z.fromBackend("Failed to update logo settings")}finally{p(!1)}},j=async()=>{x(""),m(null),p(!0);try{let e=(0,i.getProxyBaseUrl)();if((await fetch(e?"".concat(e,"/update/ui_theme_settings"):"/update/ui_theme_settings",{method:"PATCH",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"},body:JSON.stringify({logo_url:null})})).ok)o.Z.success("Logo reset to default!");else throw Error("Failed to reset logo")}catch(e){console.error("Error resetting logo:",e),o.Z.fromBackend("Failed to reset logo")}finally{p(!1)}};return c?(0,r.jsxs)("div",{className:"w-full mx-auto max-w-4xl px-6 py-8",children:[(0,r.jsxs)("div",{className:"mb-8",children:[(0,r.jsx)(a.Dx,{className:"text-2xl font-bold mb-2",children:"Logo Customization"}),(0,r.jsx)(a.xv,{className:"text-gray-600",children:"Customize your LiteLLM admin dashboard with a custom logo."})]}),(0,r.jsx)(a.Zb,{className:"shadow-sm p-6",children:(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(a.xv,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Custom Logo URL"}),(0,r.jsx)(a.oi,{placeholder:"https://example.com/logo.png",value:u,onValueChange:e=>{x(e),m(e||null)},className:"w-full"}),(0,r.jsx)(a.xv,{className:"text-xs text-gray-500 mt-1",children:"Enter a URL for your custom logo or leave empty to use the default LiteLLM logo"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(a.xv,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Current Logo"}),(0,r.jsx)("div",{className:"bg-gray-50 rounded-lg p-6 flex items-center justify-center min-h-[120px]",children:u?(0,r.jsx)("img",{src:u,alt:"Custom logo",className:"max-w-full max-h-24 object-contain",onError:e=>{var s;let t=e.target;t.style.display="none";let r=document.createElement("div");r.className="text-gray-500 text-sm",r.textContent="Failed to load image",null===(s=t.parentElement)||void 0===s||s.appendChild(r)}}):(0,r.jsx)(a.xv,{className:"text-gray-500 text-sm",children:"Default LiteLLM logo will be used"})})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,r.jsx)(a.zx,{onClick:f,loading:h,disabled:h,color:"indigo",children:"Save Changes"}),(0,r.jsx)(a.zx,{onClick:j,loading:h,disabled:h,variant:"secondary",color:"gray",children:"Reset to Default"})]})]})})]}):null}}},function(e){e.O(0,[3665,6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,7281,9343,7906,8077,2344,9165,1264,1487,7732,169,6433,1160,722,4388,3250,4886,4338,4688,131,2202,874,4292,7526,2004,2012,8160,1598,7164,3801,4138,3765,7029,7155,6204,1739,6600,773,6925,8143,4289,2273,603,2019,2971,2117,1744],function(){return e(e.s=97731)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{97731:function(e,s,t){Promise.resolve().then(t.bind(t,17940))},23192:function(e,s,t){"use strict";t.d(s,{Z:function(){return h}});var r=t(57437);t(2265);var l=t(67101),a=t(12485),n=t(18135),i=t(35242),o=t(29706),c=t(77991),d=t(84264),m=t(25653),u=t(96362),x=e=>{let{href:s,className:t}=e;return(0,r.jsxs)("a",{href:s,target:"_blank",rel:"noopener noreferrer",title:"Open documentation in a new tab",className:function(){for(var e=arguments.length,s=Array(e),t=0;t{let{proxySettings:s}=e,t="";return(null==s?void 0:s.PROXY_BASE_URL)!==void 0&&(null==s?void 0:s.PROXY_BASE_URL)&&(t=s.PROXY_BASE_URL),(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(l.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:"OpenAI Compatible Proxy: API Reference"}),(0,r.jsx)(x,{className:"ml-3 shrink-0",href:"https://docs.litellm.ai/docs/proxy/user_keys"})]}),(0,r.jsxs)(d.Z,{className:"mt-2 mb-2",children:["LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below"," "]}),(0,r.jsxs)(n.Z,{children:[(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(a.Z,{children:"OpenAI Python SDK"}),(0,r.jsx)(a.Z,{children:"LlamaIndex"}),(0,r.jsx)(a.Z,{children:"Langchain Py"})]}),(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'import openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="'.concat(t,'" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="gpt-3.5-turbo", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)')})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'import os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="azure-gpt-3.5", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="'.concat(t,'", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="').concat(t,'",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)')})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'from langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="'.concat(t,'",\n model = "gpt-3.5-turbo",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)')})})]})]})]})})})}},25653:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(30401),n=t(5136),i=t(17906),o=t(1479);s.Z=e=>{let{code:s,language:t}=e,[c,d]=(0,l.useState)(!1);return(0,r.jsxs)("div",{className:"relative rounded-lg border border-gray-200 overflow-hidden",children:[(0,r.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3)},className:"absolute top-3 right-3 p-2 rounded-md bg-gray-100 hover:bg-gray-200 text-gray-600 z-10","aria-label":"Copy code",children:c?(0,r.jsx)(a.Z,{size:16}):(0,r.jsx)(n.Z,{size:16})}),(0,r.jsx)(i.Z,{language:t,style:o.Z,customStyle:{margin:0,padding:"1.5rem",borderRadius:"0.5rem",fontSize:"0.9rem",backgroundColor:"#fafafa"},showLineNumbers:!0,children:s})]})}},17940:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return s1}});var r=t(57437),l=t(2265),a=t(99376),n=t(14474),i=t(21623),o=t(29827),c=t(65373),d=t(69734),m=t(21739),u=t(81598),x=t(77155),h=t(22004),p=t(90773),g=t(6925),f=t(64289),j=t(7166),y=t(49104),b=t(33801),v=t(18160),_=t(67164),Z=t(23192),w=t(47029),N=t(18143),k=t(66600),S=t(19250),C=t(43765),T=t(30603),z=t(6674),P=t(30874),A=t(39210),D=t(94138),I=t(42273),L=t(6204),E=t(5183),F=t(20831),R=t(12485),M=t(18135),O=t(35242),B=t(29706),q=t(77991),U=t(84264),V=t(96761),K=t(13634),H=t(82680),W=t(9114),Y=t(42673);let J=e=>{let s=Object.keys(Y.fK).find(s=>Y.fK[s]===e);if(s){let e=Y.Cl[s],t=Y.cd[e];return{displayName:e,logo:t,enumKey:s}}return{displayName:e,logo:"",enumKey:null}},G=e=>Y.fK[e]||null,X=(e,s)=>{let t=e.target,r=t.parentElement;if(r){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=s.charAt(0),r.replaceChild(e,t)}};var $=t(47323),Q=t(49566),ee=t(82422),es=t(3837),et=t(53410),er=t(74998),el=t(21626),ea=t(97214),en=t(28241),ei=t(58834),eo=t(69552),ec=t(71876);function ed(e){let{data:s,columns:t,isLoading:l=!1,loadingMessage:a="Loading...",emptyMessage:n="No data",getRowKey:i}=e;return(0,r.jsxs)(el.Z,{children:[(0,r.jsx)(ei.Z,{children:(0,r.jsx)(ec.Z,{children:t.map((e,s)=>(0,r.jsx)(eo.Z,{style:{width:e.width},children:e.header},s))})}),(0,r.jsx)(ea.Z,{children:l?(0,r.jsx)(ec.Z,{children:(0,r.jsx)(en.Z,{colSpan:t.length,className:"text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:a})})}):s.length>0?s.map((e,s)=>(0,r.jsx)(ec.Z,{children:t.map((s,t)=>{var l;return(0,r.jsx)(en.Z,{children:s.cell?s.cell(e):String(null!==(l=e[s.accessor])&&void 0!==l?l:"")},t)})},i?i(e,s):s)):(0,r.jsx)(ec.Z,{children:(0,r.jsx)(en.Z,{colSpan:t.length,className:"text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:n})})})})]})}var em=e=>{let{discountConfig:s,onDiscountChange:t,onRemoveProvider:a}=e,[n,i]=(0,l.useState)(null),[o,c]=(0,l.useState)(""),d=(e,s)=>{i(e),c((100*s).toString())},m=e=>{let s=parseFloat(o);!isNaN(s)&&s>=0&&s<=100&&t(e,(s/100).toString()),i(null),c("")},u=()=>{i(null),c("")},x=(e,s)=>{"Enter"===e.key?m(s):"Escape"===e.key&&u()},h=Object.entries(s).map(e=>{let[s,t]=e;return{provider:s,discount:t}}).sort((e,s)=>{let t=J(e.provider).displayName,r=J(s.provider).displayName;return t.localeCompare(r)});return(0,r.jsx)(ed,{data:h,columns:[{header:"Provider",cell:e=>{let{displayName:s,logo:t}=J(e.provider);return(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,r.jsx)("img",{src:t,alt:"".concat(s," logo"),className:"w-5 h-5",onError:e=>X(e,s)}),(0,r.jsx)("span",{className:"font-medium",children:s})]})}},{header:"Discount Percentage",cell:e=>(0,r.jsx)("div",{className:"flex items-center gap-2",children:n===e.provider?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Q.Z,{value:o,onValueChange:c,onKeyDown:s=>x(s,e.provider),placeholder:"5",className:"w-20",autoFocus:!0}),(0,r.jsx)("span",{className:"text-gray-600",children:"%"}),(0,r.jsx)($.Z,{icon:ee.Z,size:"sm",onClick:()=>m(e.provider),className:"cursor-pointer text-green-600 hover:text-green-700"}),(0,r.jsx)($.Z,{icon:es.Z,size:"sm",onClick:u,className:"cursor-pointer text-gray-600 hover:text-gray-700"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(U.Z,{className:"font-medium",children:[(100*e.discount).toFixed(1),"%"]}),(0,r.jsx)($.Z,{icon:et.Z,size:"sm",onClick:()=>d(e.provider,e.discount),className:"cursor-pointer text-blue-600 hover:text-blue-700"})]})}),width:"250px"},{header:"Actions",cell:e=>{let{displayName:s}=J(e.provider);return(0,r.jsx)($.Z,{icon:er.Z,size:"sm",onClick:()=>a(e.provider,s),className:"cursor-pointer hover:text-red-600"})},width:"80px"}],getRowKey:e=>e.provider,emptyMessage:"No provider discounts configured"})},eu=t(64504),ex=t(89970),eh=t(52787),ep=t(15424),eg=t(33145),ef=e=>{let{discountConfig:s,selectedProvider:t,newDiscount:l,onProviderChange:a,onDiscountChange:n,onAddProvider:i}=e;return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Provider",(0,r.jsx)(ex.Z,{title:"Select the LLM provider you want to configure a discount for",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please select a provider"}],children:(0,r.jsx)(eh.default,{showSearch:!0,placeholder:"Select provider",value:t,onChange:a,style:{width:"100%"},size:"large",optionFilterProp:"children",filterOption:(e,s)=>{var t;return String(null!==(t=null==s?void 0:s.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},children:Object.entries(Y.Cl).map(e=>{let[t,l]=e,a=Y.fK[t];return a&&s[a]?null:(0,r.jsx)(eh.default.Option,{value:t,label:l,children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(eg.default,{src:Y.cd[l],alt:"".concat(t," logo"),width:20,height:20,className:"w-5 h-5",onError:e=>X(e,l)}),(0,r.jsx)("span",{children:l})]})},t)})})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Discount Percentage",(0,r.jsx)(ex.Z,{title:"Enter a percentage value (e.g., 5 for 5% discount)",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please enter a discount percentage"}],children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(eu.o,{placeholder:"5",value:l,onValueChange:n,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 flex-1"}),(0,r.jsx)("span",{className:"text-gray-600",children:"%"})]})}),(0,r.jsx)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:(0,r.jsx)(eu.z,{variant:"primary",onClick:i,disabled:!t||!l,children:"Add Provider Discount"})})]})},ej=t(29271),ey=t(40875),eb=t(96362);let ev=e=>{let{items:s,children:t="Docs",className:a=""}=e,[n,i]=(0,l.useState)(!1),o=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i(!1)};return n&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n]),(0,r.jsxs)("div",{className:"relative inline-block ".concat(a),ref:o,children:[(0,r.jsxs)("button",{type:"button",onClick:()=>i(!n),className:"inline-flex items-center gap-1 text-gray-500 hover:text-gray-700 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded px-2 py-1","aria-expanded":n,"aria-haspopup":"true",children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)(ey.Z,{className:"h-3 w-3 transition-transform ".concat(n?"rotate-180":""),"aria-hidden":"true"})]}),n&&(0,r.jsx)("div",{className:"absolute right-0 mt-1 w-56 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50",children:s.map((e,s)=>(0,r.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",onClick:()=>i(!1),children:[(0,r.jsx)("span",{children:e.label}),(0,r.jsx)(eb.Z,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0 ml-2","aria-hidden":"true"})]},s))})]})};var e_=t(56522),eZ=t(25653),ew=()=>{let[e,s]=(0,l.useState)(""),[t,a]=(0,l.useState)(""),n=(0,l.useMemo)(()=>{let s=parseFloat(e),r=parseFloat(t);if(isNaN(s)||isNaN(r)||0===s||0===r)return null;let l=s+r;return{originalCost:l.toFixed(10),finalCost:s.toFixed(10),discountAmount:r.toFixed(10),discountPercentage:(r/l*100).toFixed(2)}},[e,t]);return(0,r.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Cost Calculation"}),(0,r.jsxs)(e_.x,{className:"text-xs text-gray-600",children:["Discounts are applied to provider costs: ",(0,r.jsx)("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded text-xs",children:"final_cost = base_cost \xd7 (1 - discount%/100)"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Example"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"A 5% discount on a $10.00 request results in: $10.00 \xd7 (1 - 0.05) = $9.50"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Valid Range"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Discount percentages must be between 0% and 100%"})]}),(0,r.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-2",children:"Validating Discounts"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mb-3",children:"Make a test request and check the response headers to verify discounts are applied:"}),(0,r.jsx)(eZ.Z,{language:"bash",code:'curl -X POST -i http://your-proxy:4000/chat/completions \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer sk-1234" \\\n -d \'{\n "model": "gemini/gemini-2.5-pro",\n "messages": [{"role": "user", "content": "Hello"}]\n }\''}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mt-3 mb-2",children:"Look for these headers in the response:"}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Final cost after discount"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-original"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Original cost before discount"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-discount-amount"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Amount discounted"})]})]})]}),(0,r.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-3",children:"Discount Calculator"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mb-3",children:"Enter values from your response headers to verify the discount:"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Response Cost (x-litellm-response-cost)"}),(0,r.jsx)(e_.o,{placeholder:"0.0171938125",value:e,onValueChange:s,className:"text-sm"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Discount Amount (x-litellm-response-cost-discount-amount)"}),(0,r.jsx)(e_.o,{placeholder:"0.0009049375",value:t,onValueChange:a,className:"text-sm"})]})]}),n&&(0,r.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,r.jsx)(e_.x,{className:"text-sm font-medium text-blue-900 mb-2",children:"Calculated Results"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Original Cost:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.originalCost]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Final Cost:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.finalCost]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Discount Amount:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.discountAmount]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-blue-300",children:[(0,r.jsx)(e_.x,{className:"text-xs font-semibold text-blue-900",children:"Discount Applied:"}),(0,r.jsxs)(e_.x,{className:"text-sm font-bold text-blue-900",children:[n.discountPercentage,"%"]})]})]})]})]})]})};let eN=[{label:"Custom pricing for models",href:"https://docs.litellm.ai/docs/proxy/custom_pricing"},{label:"Spend tracking",href:"https://docs.litellm.ai/docs/proxy/cost_tracking"}];var ek=e=>{let{userID:s,userRole:t,accessToken:a}=e,[n,i]=(0,l.useState)({}),[o,c]=(0,l.useState)(void 0),[d,m]=(0,l.useState)(""),[u,x]=(0,l.useState)(!0),[h,p]=(0,l.useState)(!1),[g]=K.Z.useForm(),[f,j]=H.Z.useModal(),y=(0,l.useCallback)(async()=>{x(!0);try{let e=(0,S.getProxyBaseUrl)(),s=await fetch(e?"".concat(e,"/config/cost_discount_config"):"/config/cost_discount_config",{method:"GET",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"}});if(s.ok){let e=await s.json();i(e.values||{})}else console.error("Failed to fetch discount config")}catch(e){console.error("Error fetching discount config:",e),W.Z.fromBackend("Failed to fetch discount configuration")}finally{x(!1)}},[a]);(0,l.useEffect)(()=>{a&&y()},[a,y]);let b=async e=>{try{let t=(0,S.getProxyBaseUrl)(),r=await fetch(t?"".concat(t,"/config/cost_discount_config"):"/config/cost_discount_config",{method:"PATCH",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)W.Z.success("Discount configuration updated successfully"),await y();else{var s;let e=await r.json(),t=(null===(s=e.detail)||void 0===s?void 0:s.error)||e.detail||"Failed to update settings";W.Z.fromBackend(t)}}catch(e){console.error("Error updating discount config:",e),W.Z.fromBackend("Failed to update discount configuration")}},v=async()=>{if(!o||!d){W.Z.fromBackend("Please select a provider and enter discount percentage");return}let e=parseFloat(d);if(isNaN(e)||e<0||e>100){W.Z.fromBackend("Discount must be between 0% and 100%");return}let s=G(o);if(!s){W.Z.fromBackend("Invalid provider selected");return}if(n[s]){W.Z.fromBackend("Discount for ".concat(Y.Cl[o]," already exists. Edit it in the table above."));return}let t={...n,[s]:e/100};i(t),await b(t),c(void 0),m(""),p(!1)},_=async(e,s)=>{f.confirm({title:"Remove Provider Discount",icon:(0,r.jsx)(ej.Z,{}),content:"Are you sure you want to remove the discount for ".concat(s,"?"),okText:"Remove",okType:"danger",cancelText:"Cancel",onOk:async()=>{let s={...n};delete s[e],i(s),await b(s)}})},Z=async(e,s)=>{let t=parseFloat(s);if(!isNaN(t)&&t>=0&&t<=1){let s={...n,[e]:t};i(s),await b(s)}};return a?(0,r.jsxs)("div",{className:"w-full p-8",children:[j,(0,r.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between mb-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(V.Z,{children:"Cost Tracking Settings"}),(0,r.jsx)(ev,{items:eN})]}),(0,r.jsx)(U.Z,{className:"text-gray-500 mt-1",children:"Configure cost discounts for different LLM providers. Changes are saved automatically."})]}),(0,r.jsx)(F.Z,{onClick:()=>p(!0),className:"mt-4 md:mt-0",children:"+ Add Provider Discount"})]}),(0,r.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full",children:(0,r.jsxs)(M.Z,{children:[(0,r.jsxs)(O.Z,{className:"px-6 pt-4",children:[(0,r.jsx)(R.Z,{children:"Provider Discounts"}),(0,r.jsx)(R.Z,{children:"Test It"})]}),(0,r.jsxs)(q.Z,{children:[(0,r.jsx)(B.Z,{children:u?(0,r.jsx)("div",{className:"py-12 text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:"Loading configuration..."})}):Object.keys(n).length>0?(0,r.jsx)("div",{className:"p-6",children:(0,r.jsx)(em,{discountConfig:n,onDiscountChange:Z,onRemoveProvider:_})}):(0,r.jsxs)("div",{className:"py-16 px-6 text-center",children:[(0,r.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,r.jsx)(U.Z,{className:"text-gray-700 font-medium mb-2",children:"No provider discounts configured"}),(0,r.jsx)(U.Z,{className:"text-gray-500 text-sm",children:'Click "Add Provider Discount" to get started'})]})}),(0,r.jsx)(B.Z,{children:(0,r.jsx)("div",{className:"px-6 pb-4",children:(0,r.jsx)(ew,{})})})]})]})}),(0,r.jsx)(H.Z,{title:(0,r.jsx)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Provider Discount"})}),open:h,width:1e3,onCancel:()=>{p(!1),g.resetFields(),c(void 0),m("")},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,r.jsxs)("div",{className:"mt-6",children:[(0,r.jsx)(U.Z,{className:"text-sm text-gray-600 mb-6",children:"Select a provider and set its discount percentage. Enter a value between 0% and 100% (e.g., 5 for a 5% discount)."}),(0,r.jsx)(K.Z,{form:g,onFinish:e=>{v()},layout:"vertical",className:"space-y-6",children:(0,r.jsx)(ef,{discountConfig:n,selectedProvider:o,newDiscount:d,onProviderChange:c,onDiscountChange:m,onAddProvider:v})})]})})]}):null},eS=t(91323),eC=t(10012),eT=t(31857),ez=t(19226),eP=t(45937),eA=t(92403),eD=t(28595),eI=t(68208),eL=t(9775),eE=t(41361),eF=t(37527),eR=t(15883),eM=t(12660),eO=t(88009),eB=t(48231),eq=t(57400),eU=t(58630),eV=t(29436),eK=t(44625),eH=t(41169),eW=t(38434),eY=t(71891),eJ=t(55322),eG=t(11429),eX=t(20347),e$=t(79262),eQ=t(13959);let{Sider:e0}=ez.default;var e1=e=>{let{accessToken:s,setPage:t,userRole:l,defaultSelectedKey:a,collapsed:n=!1}=e,i=[{key:"1",page:"api-keys",label:"Virtual Keys",icon:(0,r.jsx)(eA.Z,{style:{fontSize:"18px"}})},{key:"3",page:"llm-playground",label:"Test Key",icon:(0,r.jsx)(eD.Z,{style:{fontSize:"18px"}}),roles:eX.LQ},{key:"2",page:"models",label:"Models + Endpoints",icon:(0,r.jsx)(eI.Z,{style:{fontSize:"18px"}}),roles:eX.LQ},{key:"12",page:"new_usage",label:"Usage",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}}),roles:[...eX.ZL,...eX.lo]},{key:"6",page:"teams",label:"Teams",icon:(0,r.jsx)(eE.Z,{style:{fontSize:"18px"}})},{key:"17",page:"organizations",label:"Organizations",icon:(0,r.jsx)(eF.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"5",page:"users",label:"Internal Users",icon:(0,r.jsx)(eR.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"14",page:"api_ref",label:"API Reference",icon:(0,r.jsx)(eM.Z,{style:{fontSize:"18px"}})},{key:"16",page:"model-hub-table",label:"Model Hub",icon:(0,r.jsx)(eO.Z,{style:{fontSize:"18px"}})},{key:"15",page:"logs",label:"Logs",icon:(0,r.jsx)(eB.Z,{style:{fontSize:"18px"}})},{key:"11",page:"guardrails",label:"Guardrails",icon:(0,r.jsx)(eq.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"26",page:"tools",label:"Tools",icon:(0,r.jsx)(eU.Z,{style:{fontSize:"18px"}}),children:[{key:"18",page:"mcp-servers",label:"MCP Servers",icon:(0,r.jsx)(eU.Z,{style:{fontSize:"18px"}})},{key:"28",page:"search-tools",label:"Search Tools",icon:(0,r.jsx)(eV.Z,{style:{fontSize:"18px"}})},{key:"21",page:"vector-stores",label:"Vector Stores",icon:(0,r.jsx)(eK.Z,{style:{fontSize:"18px"}}),roles:eX.ZL}]},{key:"experimental",page:"experimental",label:"Experimental",icon:(0,r.jsx)(eH.Z,{style:{fontSize:"18px"}}),children:[{key:"9",page:"caching",label:"Caching",icon:(0,r.jsx)(eK.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"25",page:"prompts",label:"Prompts",icon:(0,r.jsx)(eW.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"10",page:"budgets",label:"Budgets",icon:(0,r.jsx)(eF.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"20",page:"transform-request",label:"API Playground",icon:(0,r.jsx)(eM.Z,{style:{fontSize:"18px"}}),roles:[...eX.ZL,...eX.lo]},{key:"19",page:"tag-management",label:"Tag Management",icon:(0,r.jsx)(eY.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"4",page:"usage",label:"Old Usage",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}})}]},{key:"settings",page:"settings",label:"Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL,children:[{key:"11",page:"general-settings",label:"Router Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"8",page:"settings",label:"Logging & Alerts",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"13",page:"admin-panel",label:"Admin Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"27",page:"cost-tracking-settings",label:"Cost Tracking",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"14",page:"ui-theme",label:"UI Theme",icon:(0,r.jsx)(eG.Z,{style:{fontSize:"18px"}}),roles:eX.ZL}]}],o=(e=>{let s=i.find(s=>s.page===e);if(s)return s.key;for(let s of i)if(s.children){let t=s.children.find(s=>s.page===e);if(t)return t.key}return"1"})(a),c=i.filter(e=>{let s=!e.roles||e.roles.includes(l);return console.log("Menu item ".concat(e.label,": roles=").concat(e.roles,", userRole=").concat(l,", hasAccess=").concat(s)),!!s&&(e.children&&(e.children=e.children.filter(e=>!e.roles||e.roles.includes(l))),!0)});return(0,r.jsx)(ez.default,{style:{minHeight:"100vh"},children:(0,r.jsxs)(e0,{theme:"light",width:220,collapsed:n,collapsedWidth:80,collapsible:!0,trigger:null,style:{transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",position:"relative"},children:[(0,r.jsx)(eQ.ZP,{theme:{components:{Menu:{iconSize:18,fontSize:14}}},children:(0,r.jsx)(eP.Z,{mode:"inline",selectedKeys:[o],defaultOpenKeys:n?[]:["llm-tools"],inlineCollapsed:n,className:"custom-sidebar-menu",style:{borderRight:0,backgroundColor:"transparent",fontSize:"14px"},items:c.map(e=>{var s;return{key:e.key,icon:e.icon,label:e.label,children:null===(s=e.children)||void 0===s?void 0:s.map(e=>({key:e.key,icon:e.icon,label:e.label,onClick:()=>{let s=new URLSearchParams(window.location.search);s.set("page",e.page),window.history.pushState(null,"","?".concat(s.toString())),t(e.page)}})),onClick:e.children?void 0:()=>{let s=new URLSearchParams(window.location.search);s.set("page",e.page),window.history.pushState(null,"","?".concat(s.toString())),t(e.page)}}})})}),(0,eX.tY)(l)&&!n&&(0,r.jsx)(e$.Z,{accessToken:s,width:220})]})})},e2=t(92019),e4=t(80443),e6=e=>{let{setPage:s,defaultSelectedKey:t,sidebarCollapsed:l}=e,{refactoredUIFlag:a}=(0,eT.Z)(),{accessToken:n,userRole:i}=(0,e4.Z)();return a?(0,r.jsx)(e2.Z,{accessToken:n,defaultSelectedKey:t,userRole:i}):(0,r.jsx)(e1,{accessToken:n,setPage:s,userRole:i,defaultSelectedKey:t,collapsed:l})},e5=t(93192),e3=t(23628),e8=t(86462),e7=t(47686),e9=t(64482),se=t(73002),ss=t(24199),st=t(46468),sr=t(25512),sl=t(33293),sa=t(88904),sn=t(87452),si=t(88829),so=t(72208),sc=t(41649),sd=t(12514),sm=t(49804),su=t(67101),sx=t(918),sh=t(97415),sp=t(2597),sg=t(59872),sf=t(32489),sj=t(76865),sy=t(95920),sb=t(68473),sv=t(51750);let s_=(e,s)=>{let t=[];return e&&e.models.length>0?(console.log("organization.models: ".concat(e.models)),t=e.models):t=s,(0,st.Ob)(t,s)},sZ=(e,s,t)=>"Admin"===e||!!t&&!!s&&t.some(e=>{var t;return null===(t=e.members)||void 0===t?void 0:t.some(e=>e.user_id===s&&"org_admin"===e.user_role)}),sw=(e,s,t)=>"Admin"===e?t||[]:t&&s?t.filter(e=>{var t;return null===(t=e.members)||void 0===t?void 0:t.some(e=>e.user_id===s&&"org_admin"===e.user_role)}):[];var sN=e=>{let{teams:s,searchParams:t,accessToken:a,setTeams:n,userID:i,userRole:o,organizations:c,premiumUser:d=!1}=e;console.log("organizations: ".concat(JSON.stringify(c)));let[m,u]=(0,l.useState)(""),[x,h]=(0,l.useState)(null),[p,g]=(0,l.useState)(null),[f,j]=(0,l.useState)(!1),[y,b]=(0,l.useState)({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"});(0,l.useEffect)(()=>{console.log("inside useeffect - ".concat(m)),a&&(0,A.Z)(a,i,o,x,n),eB()},[m]);let[v]=K.Z.useForm(),[_]=K.Z.useForm(),{Title:Z,Paragraph:w}=e5.default,[N,k]=(0,l.useState)(""),[C,T]=(0,l.useState)(!1),[z,P]=(0,l.useState)(null),[D,I]=(0,l.useState)(null),[L,E]=(0,l.useState)(!1),[V,Y]=(0,l.useState)(!1),[J,G]=(0,l.useState)(!1),[X,ee]=(0,l.useState)(!1),[es,ed]=(0,l.useState)([]),[em,eu]=(0,l.useState)(!1),[eg,ef]=(0,l.useState)(null),[ej,ey]=(0,l.useState)([]),[eb,ev]=(0,l.useState)({}),[e_,eZ]=(0,l.useState)([]),[ew,eN]=(0,l.useState)({}),[ek,eS]=(0,l.useState)([]),[eC,eT]=(0,l.useState)([]),[ez,eP]=(0,l.useState)(!1),[eA,eD]=(0,l.useState)(""),[eI,eL]=(0,l.useState)({});(0,l.useEffect)(()=>{console.log("currentOrgForCreateTeam: ".concat(p));let e=s_(p,es);console.log("models: ".concat(e)),ey(e),v.setFieldValue("models",[])},[p,es]),(0,l.useEffect)(()=>{if(V){let e=sw(o,i,c);if(1===e.length){let s=e[0];v.setFieldValue("organization_id",s.organization_id),g(s)}else v.setFieldValue("organization_id",(null==x?void 0:x.organization_id)||null),g(x)}},[V,o,i,c,x]),(0,l.useEffect)(()=>{(async()=>{try{if(null==a)return;let e=(await (0,S.getGuardrailsList)(a)).guardrails.map(e=>e.guardrail_name);eZ(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[a]);let eE=async()=>{try{if(null==a)return;let e=await (0,S.fetchMCPAccessGroups)(a);eT(e)}catch(e){console.error("Failed to fetch MCP access groups:",e)}};(0,l.useEffect)(()=>{eE()},[a]),(0,l.useEffect)(()=>{s&&ev(s.reduce((e,s)=>(e[s.team_id]={keys:s.keys||[],team_info:{members_with_roles:s.members_with_roles||[]}},e),{}))},[s]);let eF=async e=>{ef(e),eu(!0)},eR=async()=>{if(null!=eg&&null!=s&&null!=a){try{await (0,S.teamDeleteCall)(a,eg),await (0,A.Z)(a,i,o,x,n)}catch(e){console.error("Error deleting the team:",e)}eu(!1),ef(null),eD("")}},eM=()=>{eu(!1),ef(null),eD("")};(0,l.useEffect)(()=>{(async()=>{try{if(null===i||null===o||null===a)return;let e=await (0,st.K2)(i,o,a);e&&ed(e)}catch(e){console.error("Error fetching user models:",e)}})()},[a,i,o,s]);let eO=async e=>{try{if(console.log("formValues: ".concat(JSON.stringify(e))),null!=a){var t,r,l;let i=null==e?void 0:e.team_alias,o=null!==(l=null==s?void 0:s.map(e=>e.team_alias))&&void 0!==l?l:[],c=(null==e?void 0:e.organization_id)||(null==x?void 0:x.organization_id);if(""===c||"string"!=typeof c?e.organization_id=null:e.organization_id=c.trim(),o.includes(i))throw Error("Team alias ".concat(i," already exists, please pick another alias"));if(W.Z.info("Creating Team"),ek.length>0){let s={};if(e.metadata)try{s=JSON.parse(e.metadata)}catch(e){console.warn("Invalid JSON in metadata field, starting with empty object")}s={...s,logging:ek.filter(e=>e.callback_name)},e.metadata=JSON.stringify(s)}if(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(t=e.allowed_mcp_servers_and_groups.servers)||void 0===t?void 0:t.length)>0||(null===(r=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===r?void 0:r.length)>0||e.allowed_mcp_servers_and_groups.toolPermissions)){if(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups){let{servers:s,accessGroups:t}=e.allowed_mcp_servers_and_groups;s&&s.length>0&&(e.object_permission.mcp_servers=s),t&&t.length>0&&(e.object_permission.mcp_access_groups=t),delete e.allowed_mcp_servers_and_groups}e.mcp_tool_permissions&&Object.keys(e.mcp_tool_permissions).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=e.mcp_tool_permissions,delete e.mcp_tool_permissions)}e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),Object.keys(eI).length>0&&(e.model_aliases=eI);let d=await (0,S.teamCreateCall)(a,e);null!==s?n([...s,d]):n([d]),console.log("response for team create call: ".concat(d)),W.Z.success("Team created"),v.resetFields(),eS([]),eL({}),Y(!1)}}catch(e){console.error("Error creating the team:",e),W.Z.fromBackend("Error creating the team: "+e)}},eB=()=>{u(new Date().toLocaleString())},eq=(e,s)=>{let t={...y,[e]:s};b(t),a&&(0,S.v2TeamListCall)(a,t.organization_id||null,null,t.team_id||null,t.team_alias||null).then(e=>{e&&e.teams&&n(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})};return(0,r.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,r.jsx)(su.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,r.jsxs)(sm.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[sZ(o,i,c)&&(0,r.jsx)(F.Z,{className:"w-fit",onClick:()=>Y(!0),children:"+ Create New Team"}),D?(0,r.jsx)(sl.Z,{teamId:D,onUpdate:e=>{n(s=>{if(null==s)return s;let t=s.map(s=>e.team_id===s.team_id?(0,sg.nl)(s,e):s);return a&&(0,A.Z)(a,i,o,x,n),t})},onClose:()=>{I(null),E(!1)},accessToken:a,is_team_admin:(e=>{if(null==e||null==e.members_with_roles)return!1;for(let s=0;se.team_id===D)),is_proxy_admin:"Admin"==o,userModels:es,editTeam:L}):(0,r.jsxs)(M.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,r.jsxs)(O.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)(R.Z,{children:"Your Teams"}),(0,r.jsx)(R.Z,{children:"Available Teams"}),(0,eX.tY)(o||"")&&(0,r.jsx)(R.Z,{children:"Default Team Settings"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,r.jsxs)(U.Z,{children:["Last Refreshed: ",m]}),(0,r.jsx)($.Z,{icon:e3.Z,variant:"shadow",size:"xs",className:"self-center",onClick:eB})]})]}),(0,r.jsxs)(q.Z,{children:[(0,r.jsxs)(B.Z,{children:[(0,r.jsxs)(U.Z,{children:["Click on “Team ID” to view team details ",(0,r.jsx)("b",{children:"and"})," manage team members."]}),(0,r.jsx)(su.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,r.jsx)(sm.Z,{numColSpan:1,children:(0,r.jsxs)(sd.Z,{className:"w-full mx-auto flex-auto overflow-hidden overflow-y-auto max-h-[50vh]",children:[(0,r.jsx)("div",{className:"border-b px-6 py-4",children:(0,r.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,r.jsxs)("div",{className:"relative w-64",children:[(0,r.jsx)("input",{type:"text",placeholder:"Search by Team Name...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:y.team_alias,onChange:e=>eq("team_alias",e.target.value)}),(0,r.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,r.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(f?"bg-gray-100":""),onClick:()=>j(!f),children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",(y.team_id||y.team_alias||y.organization_id)&&(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500"})]}),(0,r.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{b({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"}),a&&(0,S.v2TeamListCall)(a,null,i||null,null,null).then(e=>{e&&e.teams&&n(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})},children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),f&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,r.jsxs)("div",{className:"relative w-64",children:[(0,r.jsx)("input",{type:"text",placeholder:"Enter Team ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:y.team_id,onChange:e=>eq("team_id",e.target.value)}),(0,r.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})]}),(0,r.jsx)("div",{className:"w-64",children:(0,r.jsx)(sr.P,{value:y.organization_id||"",onValueChange:e=>eq("organization_id",e),placeholder:"Select Organization",children:null==c?void 0:c.map(e=>(0,r.jsx)(sr.Q,{value:e.organization_id||"",children:e.organization_alias||e.organization_id},e.organization_id))})})]})]})}),(0,r.jsxs)(el.Z,{children:[(0,r.jsx)(ei.Z,{children:(0,r.jsxs)(ec.Z,{children:[(0,r.jsx)(eo.Z,{children:"Team Name"}),(0,r.jsx)(eo.Z,{children:"Team ID"}),(0,r.jsx)(eo.Z,{children:"Created"}),(0,r.jsx)(eo.Z,{children:"Spend (USD)"}),(0,r.jsx)(eo.Z,{children:"Budget (USD)"}),(0,r.jsx)(eo.Z,{children:"Models"}),(0,r.jsx)(eo.Z,{children:"Organization"}),(0,r.jsx)(eo.Z,{children:"Info"})]})}),(0,r.jsx)(ea.Z,{children:s&&s.length>0?s.filter(e=>!x||e.organization_id===x.organization_id).sort((e,s)=>new Date(s.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>(0,r.jsxs)(ec.Z,{children:[(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,r.jsx)(en.Z,{children:(0,r.jsx)("div",{className:"overflow-hidden",children:(0,r.jsx)(ex.Z,{title:e.team_id,children:(0,r.jsxs)(F.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>{I(e.team_id)},children:[e.team_id.slice(0,7),"..."]})})})}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,sg.pw)(e.spend,4)}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!==e.max_budget&&void 0!==e.max_budget?e.max_budget:"No limit"}),(0,r.jsx)(en.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,r.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,r.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,r.jsx)(sc.Z,{size:"xs",className:"mb-1",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,r.jsx)("div",{children:(0,r.jsx)($.Z,{icon:ew[e.team_id]?e8.Z:e7.Z,className:"cursor-pointer",size:"xs",onClick:()=>{eN(s=>({...s,[e.team_id]:!s[e.team_id]}))}})}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,s)=>"all-proxy-models"===e?(0,r.jsx)(sc.Z,{size:"xs",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})},s):(0,r.jsx)(sc.Z,{size:"xs",color:"blue",children:(0,r.jsx)(U.Z,{children:e.length>30?"".concat((0,st.W0)(e).slice(0,30),"..."):(0,st.W0)(e)})},s)),e.models.length>3&&!ew[e.team_id]&&(0,r.jsx)(sc.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,r.jsxs)(U.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),ew[e.team_id]&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,s)=>"all-proxy-models"===e?(0,r.jsx)(sc.Z,{size:"xs",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})},s+3):(0,r.jsx)(sc.Z,{size:"xs",color:"blue",children:(0,r.jsx)(U.Z,{children:e.length>30?"".concat((0,st.W0)(e).slice(0,30),"..."):(0,st.W0)(e)})},s+3))})]})]})})}):null})}),(0,r.jsx)(en.Z,{children:e.organization_id}),(0,r.jsxs)(en.Z,{children:[(0,r.jsxs)(U.Z,{children:[eb&&e.team_id&&eb[e.team_id]&&eb[e.team_id].keys&&eb[e.team_id].keys.length," ","Keys"]}),(0,r.jsxs)(U.Z,{children:[eb&&e.team_id&&eb[e.team_id]&&eb[e.team_id].team_info&&eb[e.team_id].team_info.members_with_roles&&eb[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,r.jsx)(en.Z,{children:"Admin"==o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.Z,{icon:et.Z,size:"sm",onClick:()=>{I(e.team_id),E(!0)}}),(0,r.jsx)($.Z,{onClick:()=>eF(e.team_id),icon:er.Z,size:"sm","data-testid":"delete-team-button"})]}):null})]},e.team_id)):null})]}),em&&(()=>{var e;let t=null==s?void 0:s.find(e=>e.team_id===eg),l=(null==t?void 0:t.team_alias)||"",a=(null==t?void 0:null===(e=t.keys)||void 0===e?void 0:e.length)||0,n=eA===l;return(0,r.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,r.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Team"}),(0,r.jsx)("button",{onClick:()=>{eM(),eD("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,r.jsx)(sf.Z,{size:20})})]}),(0,r.jsxs)("div",{className:"px-6 py-4",children:[a>0&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,r.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,r.jsx)(sj.Z,{size:20})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-base font-medium text-red-600",children:["Warning: This team has ",a," associated key",a>1?"s":"","."]}),(0,r.jsx)("p",{className:"text-base text-red-600 mt-2",children:"Deleting the team will also delete all associated keys. This action is irreversible."})]})]}),(0,r.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to force delete this team and all its keys?"}),(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,r.jsx)("span",{className:"underline",children:l})," to confirm deletion:"]}),(0,r.jsx)("input",{type:"text",value:eA,onChange:e=>eD(e.target.value),placeholder:"Enter team name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,r.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,r.jsx)("button",{onClick:()=>{eM(),eD("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,r.jsx)("button",{onClick:eR,disabled:!n,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(n?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Force Delete"})]})]})})})()]})})})]}),(0,r.jsx)(B.Z,{children:(0,r.jsx)(sx.Z,{accessToken:a,userID:i})}),(0,eX.tY)(o||"")&&(0,r.jsx)(B.Z,{children:(0,r.jsx)(sa.Z,{accessToken:a,userID:i||"",userRole:o||""})})]})]}),sZ(o,i,c)&&(0,r.jsx)(H.Z,{title:"Create Team",visible:V,width:1e3,footer:null,onOk:()=>{Y(!1),v.resetFields(),eS([]),eL({})},onCancel:()=>{Y(!1),v.resetFields(),eS([]),eL({})},children:(0,r.jsxs)(K.Z,{form:v,onFinish:eO,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,r.jsx)(Q.Z,{placeholder:""})}),(()=>{let e=sw(o,i,c),s="Admin"!==o,t=1===e.length,l=0===e.length;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Organization"," ",(0,r.jsx)(ex.Z,{title:(0,r.jsxs)("span",{children:["Organizations can have multiple teams. Learn more about"," ",(0,r.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/user_management_heirarchy",target:"_blank",rel:"noopener noreferrer",style:{color:"#1890ff",textDecoration:"underline"},onClick:e=>e.stopPropagation(),children:"user management hierarchy"})]}),children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"organization_id",initialValue:x?x.organization_id:null,className:"mt-8",rules:s?[{required:!0,message:"Please select an organization"}]:[],help:t?"You can only create teams within this organization":s?"required":"",children:(0,r.jsx)(eh.default,{showSearch:!0,allowClear:!s,disabled:t,placeholder:l?"No organizations available":"Search or select an Organization",onChange:s=>{v.setFieldValue("organization_id",s),g((null==e?void 0:e.find(e=>e.organization_id===s))||null)},filterOption:(e,s)=>{var t;return!!s&&((null===(t=s.children)||void 0===t?void 0:t.toString())||"").toLowerCase().includes(e.toLowerCase())},optionFilterProp:"children",children:null==e?void 0:e.map(e=>(0,r.jsxs)(eh.default.Option,{value:e.organization_id,children:[(0,r.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,r.jsxs)("span",{className:"text-gray-500",children:["(",e.organization_id,")"]})]},e.organization_id))})}),s&&!t&&e.length>1&&(0,r.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,r.jsx)(U.Z,{className:"text-blue-800 text-sm",children:"Please select an organization to create a team for. You can only create teams within organizations where you are an admin."})})]})})(),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Models"," ",(0,r.jsx)(ex.Z,{title:"These are the models that your selected team has access to",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,r.jsxs)(eh.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,r.jsx)(eh.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),ej.map(e=>(0,r.jsx)(eh.default.Option,{value:e,children:(0,st.W0)(e)},e))]})}),(0,r.jsx)(K.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(ss.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(K.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(eh.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(eh.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(eh.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(eh.default.Option,{value:"30d",children:"monthly"})]})}),(0,r.jsx)(K.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsxs)(sn.Z,{className:"mt-20 mb-8",onClick:()=>{ez||(eE(),eP(!0))},children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Additional Settings"})}),(0,r.jsxs)(si.Z,{children:[(0,r.jsx)(K.Z.Item,{label:"Team ID",name:"team_id",help:"ID of the team you want to create. If not provided, it will be generated automatically.",children:(0,r.jsx)(Q.Z,{onChange:e=>{e.target.value=e.target.value.trim()}})}),(0,r.jsx)(K.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",normalize:e=>e?Number(e):void 0,tooltip:"This is the individual budget for a user in the team.",children:(0,r.jsx)(ss.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(K.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,r.jsx)(Q.Z,{placeholder:"e.g., 30d"})}),(0,r.jsx)(K.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"The RPM (Requests Per Minute) limit for individual team members",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"The TPM (Tokens Per Minute) limit for individual team members",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Metadata",name:"metadata",help:"Additional team metadata. Enter metadata as JSON object.",children:(0,r.jsx)(e9.default.TextArea,{rows:4})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Guardrails"," ",(0,r.jsx)(ex.Z,{title:"Setup your first guardrail",children:(0,r.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-8",help:"Select existing guardrails or enter new ones",children:(0,r.jsx)(eh.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:e_.map(e=>({value:e,label:e}))})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,r.jsx)(ex.Z,{title:"Select which vector stores this team can access by default. Leave empty for access to all vector stores",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-8",help:"Select vector stores this team can access. Leave empty for access to all vector stores",children:(0,r.jsx)(sh.Z,{onChange:e=>v.setFieldValue("allowed_vector_store_ids",e),value:v.getFieldValue("allowed_vector_store_ids"),accessToken:a||"",placeholder:"Select vector stores (optional)"})})]})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"MCP Settings"})}),(0,r.jsxs)(si.Z,{children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,r.jsx)(ex.Z,{title:"Select which MCP servers or access groups this team can access",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers or access groups this team can access",children:(0,r.jsx)(sy.Z,{onChange:e=>v.setFieldValue("allowed_mcp_servers_and_groups",e),value:v.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:a||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,r.jsx)(K.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,r.jsx)(e9.default,{type:"hidden"})}),(0,r.jsx)(K.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_mcp_servers_and_groups!==s.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(sb.Z,{accessToken:a||"",selectedServers:(null===(e=v.getFieldValue("allowed_mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:v.getFieldValue("mcp_tool_permissions")||{},onChange:e=>v.setFieldsValue({mcp_tool_permissions:e})})})}})]})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Logging Settings"})}),(0,r.jsx)(si.Z,{children:(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(sp.Z,{value:ek,onChange:eS,premiumUser:d})})})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Model Aliases"})}),(0,r.jsx)(si.Z,{children:(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)(U.Z,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used by team members in API calls. This allows you to create shortcuts for specific models."}),(0,r.jsx)(sv.Z,{accessToken:a||"",initialModelAliases:eI,onAliasUpdate:eL,showExampleConfig:!1})]})})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(se.ZP,{htmlType:"submit",children:"Create Team"})})]})})]})})})},sk=t(16593),sS=t(60493),sC=t(58927);let sT=(e,s,t,l)=>[{accessorKey:"search_tool_id",header:"Search Tool ID",cell:s=>{var t;let{row:l}=s;return(0,r.jsxs)("button",{onClick:()=>e(l.original.search_tool_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[null===(t=l.original.search_tool_id)||void 0===t?void 0:t.slice(0,7),"..."]})}},{accessorKey:"search_tool_name",header:"Name",cell:e=>{let{getValue:s}=e;return(0,r.jsx)("span",{className:"font-medium",children:s()})}},{id:"provider",header:"Provider",cell:e=>{let{row:s}=e,t=s.original.litellm_params.search_provider,a=l.find(e=>e.provider_name===t),n=(null==a?void 0:a.ui_friendly_name)||t;return(0,r.jsx)("span",{className:"text-sm",children:n})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,t=s.original;return(0,r.jsx)("span",{className:"text-xs",children:t.created_at?new Date(t.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,t=s.original;return(0,r.jsx)("span",{className:"text-xs",children:t.updated_at?new Date(t.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:l}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(sC.J,{icon:et.Z,size:"sm",onClick:()=>s(l.original.search_tool_id),className:"cursor-pointer"}),(0,r.jsx)(sC.J,{icon:er.Z,size:"sm",onClick:()=>t(l.original.search_tool_id),className:"cursor-pointer"})]})}}];var sz=t(10900),sP=t(30401),sA=t(78867),sD=t(42264),sI=t(87908),sL=t(61935);let{Text:sE}=e5.default,sF=e=>{var s,t,a,n;let{searchToolName:i,accessToken:o,className:c=""}=e,[d,m]=(0,l.useState)(""),[u,x]=(0,l.useState)(!1),[h,p]=(0,l.useState)([]),[g,f]=(0,l.useState)({}),[j,y]=(0,l.useState)(!1),b=async()=>{if(!d.trim()){sD.ZP.warning("Please enter a search query");return}x(!0);let e=performance.now();try{let s=await (0,S.searchToolQueryCall)(o,i,d),t=performance.now(),r={query:d,response:s,timestamp:Date.now(),latency:Math.round(t-e)};p(e=>[r,...e])}catch(e){console.error("Error querying search tool:",e),W.Z.fromBackend("Failed to query search tool")}finally{x(!1)}},v=e=>new Date(e).toLocaleString(),_=(e,s)=>{let t="".concat(e,"-").concat(s);f(e=>({...e,[t]:!e[t]}))},Z=(0,r.jsx)(sL.Z,{style:{fontSize:24},spin:!0}),w=h.length>0?h[0]:null;return(0,r.jsxs)(sd.Z,{className:"mt-6",children:[(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(V.Z,{children:"Test Search Tool"})}),(0,r.jsxs)("div",{className:"flex flex-col",style:{minHeight:"600px"},children:[(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsxs)("div",{className:"flex items-stretch gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center flex-1 bg-white rounded-lg px-4 transition-all duration-200",style:{border:j?"2px solid #3b82f6":"2px solid #e5e7eb",boxShadow:j?"0 0 0 3px rgba(59, 130, 246, 0.1)":"0 1px 2px 0 rgba(0, 0, 0, 0.05)",height:"48px"},children:[(0,r.jsx)(eV.Z,{className:"text-gray-400 mr-3",style:{fontSize:"18px"}}),(0,r.jsx)(e9.default,{value:d,onChange:e=>m(e.target.value),onFocus:()=>y(!0),onBlur:()=>y(!1),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),b())},placeholder:"Enter your search query...",disabled:u,bordered:!1,style:{fontSize:"15px",padding:0,height:"100%",boxShadow:"none"}})]}),(0,r.jsx)(se.ZP,{type:"primary",onClick:b,disabled:u||!d.trim(),icon:(0,r.jsx)(eV.Z,{}),loading:u,style:{height:"48px",paddingLeft:"24px",paddingRight:"24px",borderRadius:"8px",fontWeight:500,fontSize:"15px",backgroundColor:u||!d.trim()?void 0:"#1890ff",borderColor:u||!d.trim()?void 0:"#1890ff",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:"Search"})]})}),(0,r.jsx)("div",{className:"flex-1",children:w||u?(0,r.jsxs)("div",{children:[u&&(0,r.jsxs)("div",{className:"flex flex-col justify-center items-center py-16",children:[(0,r.jsx)(sI.Z,{indicator:Z}),(0,r.jsx)(sE,{className:"mt-4 text-gray-600 font-medium",children:"Searching..."})]}),w&&!u&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)(sE,{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Search Query"}),(0,r.jsx)("div",{className:"text-base font-semibold text-gray-900 mt-1.5",children:w.query})]}),(0,r.jsxs)("div",{className:"text-right ml-4",children:[(0,r.jsx)(sE,{className:"text-xs text-gray-500",children:v(w.timestamp)}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,r.jsxs)("div",{className:"text-sm font-semibold text-blue-600",children:[(null===(t=w.response)||void 0===t?void 0:null===(s=t.results)||void 0===s?void 0:s.length)||0," ",(null===(n=w.response)||void 0===n?void 0:null===(a=n.results)||void 0===a?void 0:a.length)===1?"result":"results"]}),void 0!==w.latency&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-gray-400",children:"•"}),(0,r.jsxs)("div",{className:"text-sm font-semibold text-green-600",children:[w.latency,"ms"]})]})]})]})]})}),w.response&&w.response.results&&w.response.results.length>0?(0,r.jsx)("div",{className:"space-y-3",children:w.response.results.map((e,s)=>{let t=g["0-".concat(s)]||!1;return(0,r.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden transition-all duration-200",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseEnter:e=>{e.currentTarget.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",e.currentTarget.style.borderColor="#e0e7ff"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="0 1px 2px 0 rgba(0, 0, 0, 0.05)",e.currentTarget.style.borderColor="#e5e7eb"},children:(0,r.jsxs)("div",{className:"p-5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-2",children:[(0,r.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-600 hover:text-blue-700 flex-1 leading-snug",style:{textDecoration:"none"},onMouseEnter:e=>e.currentTarget.style.textDecoration="underline",onMouseLeave:e=>e.currentTarget.style.textDecoration="none",children:e.title}),(0,r.jsx)(se.ZP,{type:"text",size:"small",className:"flex-shrink-0",icon:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),onClick:()=>window.open(e.url,"_blank"),style:{color:"#6b7280"}})]}),(0,r.jsx)("div",{className:"text-sm text-green-700 mb-3 truncate font-medium",children:e.url}),(0,r.jsx)("div",{className:"text-sm text-gray-700 leading-relaxed",children:t?e.snippet:"".concat(e.snippet.substring(0,200)).concat(e.snippet.length>200?"...":"")}),e.snippet.length>200&&(0,r.jsx)(se.ZP,{type:"link",size:"small",className:"mt-3 p-0 h-auto",onClick:()=>_(0,s),style:{fontSize:"13px",fontWeight:500,color:"#3b82f6"},children:t?"Show less":"Show more"})]})},s)})}):(0,r.jsxs)("div",{className:"text-center py-12 bg-gray-50 border border-gray-200 rounded-lg",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mx-auto mb-4",children:(0,r.jsx)(eV.Z,{style:{fontSize:"24px",color:"#9ca3af"}})}),(0,r.jsx)(sE,{className:"text-gray-600 font-medium",children:"No results found"}),(0,r.jsx)(sE,{className:"text-sm text-gray-500 mt-1",children:"Try a different search query"})]})]}),h.length>1&&(0,r.jsxs)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(sE,{className:"text-sm font-semibold text-gray-700",children:"Previous Searches"}),(0,r.jsx)(se.ZP,{onClick:()=>{p([]),f({}),W.Z.success("Search history cleared")},size:"small",type:"link",style:{fontSize:"13px",fontWeight:500},children:"Clear All"})]}),(0,r.jsx)("div",{className:"space-y-2",children:h.slice(1,6).map((e,s)=>{var t,l,a,n;return(0,r.jsxs)("div",{className:"p-3 bg-gray-50 border border-gray-200 rounded-lg cursor-pointer transition-all duration-200 hover:bg-gray-100 hover:border-gray-300",onClick:()=>{m(e.query)},children:[(0,r.jsx)("div",{className:"text-sm font-medium text-gray-800 truncate",children:e.query}),(0,r.jsxs)("div",{className:"text-xs text-gray-500 mt-1.5 flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"font-medium text-blue-600",children:[(null===(l=e.response)||void 0===l?void 0:null===(t=l.results)||void 0===t?void 0:t.length)||0," ",(null===(n=e.response)||void 0===n?void 0:null===(a=n.results)||void 0===a?void 0:a.length)===1?"result":"results"]}),void 0!==e.latency&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"•"}),(0,r.jsxs)("span",{className:"font-medium text-green-600",children:[e.latency,"ms"]})]}),(0,r.jsx)("span",{children:"•"}),(0,r.jsx)("span",{children:v(e.timestamp)})]})]},s+1)})})]})]}):(0,r.jsxs)("div",{className:"h-full flex flex-col items-center justify-center p-8",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-24 h-24 rounded-full bg-gray-100 mb-6",children:(0,r.jsx)(eV.Z,{style:{fontSize:"48px",color:"#9ca3af"}})}),(0,r.jsx)(sE,{className:"text-lg text-gray-600 font-medium",children:"Test your search tool"}),(0,r.jsx)(sE,{className:"text-sm text-gray-500 mt-2",children:"Enter a query above to see search results"})]})})]})]})},sR=e=>{var s;let{searchTool:t,onBack:a,isEditing:n,accessToken:i,availableProviders:o}=e,[c,d]=(0,l.useState)({}),m=async(e,s)=>{await (0,sg.vQ)(e)&&(d(e=>({...e,[s]:!0})),setTimeout(()=>{d(e=>({...e,[s]:!1}))},2e3))};return(0,r.jsxs)("div",{className:"p-4 max-w-full",children:[(0,r.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(F.Z,{icon:sz.Z,variant:"light",className:"mb-4",onClick:a,children:"Back to All Search Tools"}),(0,r.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)(V.Z,{children:t.search_tool_name}),(0,r.jsx)(se.ZP,{type:"text",size:"small",icon:c["search-tool-name"]?(0,r.jsx)(sP.Z,{size:12}):(0,r.jsx)(sA.Z,{size:12}),onClick:()=>m(t.search_tool_name,"search-tool-name"),className:"left-2 z-10 transition-all duration-200 ".concat(c["search-tool-name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,r.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)(U.Z,{className:"text-gray-500 font-mono",children:t.search_tool_id}),(0,r.jsx)(se.ZP,{type:"text",size:"small",icon:c["search-tool-id"]?(0,r.jsx)(sP.Z,{size:12}):(0,r.jsx)(sA.Z,{size:12}),onClick:()=>m(t.search_tool_id,"search-tool-id"),className:"left-2 z-10 transition-all duration-200 ".concat(c["search-tool-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,r.jsxs)(su.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"Provider"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(V.Z,{children:(e=>{let s=o.find(s=>s.provider_name===e);return(null==s?void 0:s.ui_friendly_name)||e})(t.litellm_params.search_provider)})})]}),(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"API Key"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.litellm_params.api_key?"****":"Not set"})})]}),(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"Created At"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.created_at?new Date(t.created_at).toLocaleString():"Unknown"})})]})]}),(null===(s=t.search_tool_info)||void 0===s?void 0:s.description)&&(0,r.jsxs)(sd.Z,{className:"mt-6",children:[(0,r.jsx)(U.Z,{children:"Description"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.search_tool_info.description})})]}),(0,r.jsx)("div",{className:"mt-6",children:i&&(0,r.jsx)(sF,{searchToolName:t.search_tool_name,accessToken:i})})]})};var sM=t(29),sO=t.n(sM),sB=t(23496),sq=t(35291);let{Text:sU}=e5.default;var sV=e=>{let{litellmParams:s,accessToken:t,onTestComplete:a}=e,[n,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(null),[d,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{i(!0);try{let e=await (0,S.testSearchToolConnection)(t,s);c(e),"success"===e.status&&W.Z.success("Connection test successful!")}catch(e){c({status:"error",message:e instanceof Error?e.message:"Unknown error occurred",error_type:"NetworkError"})}finally{i(!1),a&&a()}})()},[t,s,a]);let u=(null==o?void 0:o.message)?(e=>{if(!e)return"Unknown error";let s=e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error:\s*/,"").replace(/^AuthenticationError:\s*/,"");if(s.includes("")||s.includes("(.*?)<\/title>/);return e?e[1]:s.includes("401")||s.includes("Authorization Required")?"Authentication failed: Invalid API key or credentials":"Authentication error - please check your API key"}return s.length>200?s.substring(0,200)+"...":s})(o.message):"Unknown error";return n?(0,r.jsx)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:(0,r.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,r.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,r.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,r.jsxs)(sU,{style:{fontSize:"16px"},children:["Testing connection to ",s.search_provider||"search provider","..."]}),(0,r.jsx)(sO(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]})}):o?(0,r.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:["success"===o.status?(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,r.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,r.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,r.jsxs)("div",{style:{marginLeft:"12px"},children:[(0,r.jsxs)(sU,{type:"success",style:{fontSize:"18px",fontWeight:500,display:"block"},children:["Connection to ",s.search_provider," successful!"]}),o.test_query&&(0,r.jsxs)(sU,{style:{fontSize:"14px",color:"#666",marginTop:"8px",display:"block"},children:["Test query: ",(0,r.jsx)("code",{style:{backgroundColor:"#f0f0f0",padding:"2px 6px",borderRadius:"4px"},children:o.test_query})]}),void 0!==o.results_count&&(0,r.jsxs)(sU,{style:{fontSize:"14px",color:"#666",display:"block"},children:["Results retrieved: ",o.results_count]})]})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,r.jsx)(sq.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,r.jsxs)(sU,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",s.search_provider||"search provider"," failed"]})]}),(0,r.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,r.jsxs)(sU,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,r.jsx)(sU,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:u}),o.error_type&&(0,r.jsx)("div",{style:{marginTop:"8px"},children:(0,r.jsxs)(sU,{style:{fontSize:"13px",color:"#666"},children:["Error type:"," ",(0,r.jsx)("code",{style:{backgroundColor:"#ffebee",padding:"2px 6px",borderRadius:"4px",color:"#d32f2f"},children:o.error_type})]})}),o.message&&(0,r.jsx)("div",{style:{marginTop:"12px"},children:(0,r.jsx)(se.ZP,{type:"link",onClick:()=>m(!d),style:{paddingLeft:0,height:"auto"},children:d?"Hide Details":"Show Details"})})]}),d&&(0,r.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,r.jsx)(sU,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Full Error Details"}),(0,r.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o.message})]}),(0,r.jsxs)("div",{style:{backgroundColor:"#fffbf0",border:"1px solid #ffe58f",borderLeft:"4px solid #faad14",borderRadius:"8px",padding:"16px"},children:[(0,r.jsx)(sU,{strong:!0,style:{display:"block",marginBottom:"8px",color:"#d48806"},children:"Troubleshooting tips:"}),(0,r.jsxs)("ul",{style:{margin:"8px 0",paddingLeft:"20px",color:"#ad6800"},children:[(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Verify your API key is correct and active"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Check if the search provider service is operational"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Ensure you have sufficient credits/quota with the provider"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Review the provider's documentation for any additional requirements"})]})]})]})}),(0,r.jsx)(sB.Z,{style:{margin:"24px 0 16px"}}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,r.jsx)(se.ZP,{type:"link",href:"https://docs.litellm.ai/docs/search",target:"_blank",icon:(0,r.jsx)(ep.Z,{}),children:"View Search Documentation"})})]}):null};let{TextArea:sK}=e9.default,sH=e=>"".concat("../ui/assets/logos/").concat(e,".png"),sW=e=>{let{providerName:s,displayName:t}=e;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(eg.default,{src:sH(s),alt:"",width:20,height:20,style:{marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,r.jsx)("span",{children:t})]})};var sY=e=>{let{userRole:s,accessToken:t,onCreateSuccess:a,isModalVisible:n,setModalVisible:i}=e,[o]=K.Z.useForm(),[c,d]=(0,l.useState)(!1),[m,u]=(0,l.useState)({}),[x,h]=(0,l.useState)(!1),[p,g]=(0,l.useState)(!1),[f,j]=(0,l.useState)(""),{data:y,isLoading:b}=(0,sk.a)({queryKey:["searchProviders"],queryFn:()=>{if(!t)throw Error("Access Token required");return(0,S.fetchAvailableSearchProviders)(t)},enabled:!!t&&n}),v=(null==y?void 0:y.providers)||[],_=async e=>{d(!0);try{let s={search_tool_name:e.search_tool_name,litellm_params:{search_provider:e.search_provider,api_key:e.api_key,api_base:e.api_base,timeout:e.timeout?parseFloat(e.timeout):void 0,max_retries:e.max_retries?parseInt(e.max_retries):void 0},search_tool_info:e.description?{description:e.description}:void 0};if(console.log("Creating search tool with payload:",s),null!=t){let e=await (0,S.createSearchTool)(t,s);W.Z.success("Search tool created successfully"),o.resetFields(),u({}),i(!1),a(e)}}catch(e){W.Z.error("Error creating search tool: "+e)}finally{d(!1)}},Z=async()=>{try{await o.validateFields(["search_provider","api_key"]),g(!0),j("test-".concat(Date.now())),h(!0)}catch(e){W.Z.error("Please fill in Search Provider and API Key before testing")}};return(l.useEffect(()=>{n||u({})},[n]),(0,eX.tY)(s))?(0,r.jsxs)(H.Z,{title:(0,r.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,r.jsx)("span",{className:"text-2xl",children:"\uD83D\uDD0D"}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New Search Tool"})]}),open:n,width:800,onCancel:()=>{o.resetFields(),u({}),i(!1)},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:[(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsxs)(K.Z,{form:o,onFinish:_,onValuesChange:(e,s)=>u(s),layout:"vertical",className:"space-y-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Tool Name",(0,r.jsx)(ex.Z,{title:"A unique name to identify this search tool configuration (e.g., 'perplexity-search', 'tavily-news-search').",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_tool_name",rules:[{required:!0,message:"Please enter a search tool name"},{pattern:/^[a-zA-Z0-9_-]+$/,message:"Name can only contain letters, numbers, hyphens, and underscores"}],children:(0,r.jsx)(eu.o,{placeholder:"e.g., perplexity-search, my-tavily-tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Provider",(0,r.jsx)(ex.Z,{title:"Select the search provider you want to use. Each provider has different capabilities and pricing.",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,r.jsx)(eh.default,{placeholder:"Select a search provider",className:"rounded-lg",size:"large",loading:b,showSearch:!0,optionFilterProp:"children",optionLabelProp:"label",children:v.map(e=>(0,r.jsx)(eh.default.Option,{value:e.provider_name,label:(0,r.jsx)(sW,{providerName:e.provider_name,displayName:e.ui_friendly_name}),children:(0,r.jsx)(sW,{providerName:e.provider_name,displayName:e.ui_friendly_name})},e.provider_name))})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["API Key",(0,r.jsx)(ex.Z,{title:"The API key for authenticating with the search provider. This will be securely stored.",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"api_key",rules:[{required:!1,message:"Please enter an API key"}],children:(0,r.jsx)(eu.o,{type:"password",placeholder:"Enter your API key",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description (Optional)"}),name:"description",children:(0,r.jsx)(sK,{rows:3,placeholder:"Brief description of this search tool's purpose",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})]}),(0,r.jsxs)("div",{className:"flex justify-between items-center pt-6 border-t border-gray-100",children:[(0,r.jsx)(ex.Z,{title:"Get help on our github",children:(0,r.jsx)(e5.default.Link,{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",children:"Need Help?"})}),(0,r.jsxs)("div",{className:"space-x-2",children:[(0,r.jsx)(eu.z,{onClick:Z,loading:p,children:"Test Connection"}),(0,r.jsx)(eu.z,{loading:c,type:"submit",children:"Add Search Tool"})]})]})]})}),(0,r.jsx)(H.Z,{title:"Connection Test Results",open:x,onCancel:()=>{h(!1),g(!1)},footer:[(0,r.jsx)(eu.z,{onClick:()=>{h(!1),g(!1)},children:"Close"},"close")],width:700,children:x&&t&&(0,r.jsx)(sV,{litellmParams:{search_provider:m.search_provider,api_key:m.api_key,api_base:m.api_base},accessToken:t,onTestComplete:()=>g(!1)},f)})]}):null};let sJ=e=>{let{isModalOpen:s,title:t,confirmDelete:l,cancelDelete:a}=e;return s?(0,r.jsx)(H.Z,{open:s,onOk:l,okType:"danger",onCancel:a,children:(0,r.jsxs)(su.Z,{numItems:1,className:"gap-2 w-full",children:[(0,r.jsx)(V.Z,{children:t}),(0,r.jsx)(sm.Z,{numColSpan:1,children:(0,r.jsx)("p",{children:"Are you sure you want to delete this search tool?"})})]})}):null};var sG=e=>{let{accessToken:s,userRole:t,userID:a}=e,{data:n,isLoading:i,refetch:o}=(0,sk.a)({queryKey:["searchTools"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,S.fetchSearchTools)(s).then(e=>e.search_tools||[])},enabled:!!s}),{data:c,isLoading:d}=(0,sk.a)({queryKey:["searchProviders"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,S.fetchAvailableSearchProviders)(s)},enabled:!!s}),m=(null==c?void 0:c.providers)||[],[u,x]=(0,l.useState)(null),[h,p]=(0,l.useState)(!1),[g,f]=(0,l.useState)(null),[j,y]=(0,l.useState)(!1),[b,v]=(0,l.useState)(!1),[_,Z]=(0,l.useState)(!1),[w]=K.Z.useForm(),N=l.useMemo(()=>sT(e=>{f(e),y(!1)},e=>{let s=null==n?void 0:n.find(s=>s.search_tool_id===e);if(s){var t;w.setFieldsValue({search_tool_name:s.search_tool_name,search_provider:s.litellm_params.search_provider,api_key:s.litellm_params.api_key,api_base:s.litellm_params.api_base,timeout:s.litellm_params.timeout,max_retries:s.litellm_params.max_retries,description:null===(t=s.search_tool_info)||void 0===t?void 0:t.description}),f(e),Z(!0)}},k,m),[m,n,w]);function k(e){x(e),p(!0)}let C=async()=>{if(null!=u&&null!=s){try{await (0,S.deleteSearchTool)(s,u),W.Z.success("Deleted search tool successfully"),o()}catch(e){console.error("Error deleting the search tool:",e),W.Z.error("Failed to delete search tool")}p(!1),x(null)}},T=async()=>{if(s&&g)try{let e=await w.validateFields(),t={search_tool_name:e.search_tool_name,litellm_params:{search_provider:e.search_provider,api_key:e.api_key,api_base:e.api_base,timeout:e.timeout?parseFloat(e.timeout):void 0,max_retries:e.max_retries?parseInt(e.max_retries):void 0},search_tool_info:e.description?{description:e.description}:void 0};await (0,S.updateSearchTool)(s,g,t),W.Z.success("Search tool updated successfully"),Z(!1),w.resetFields(),f(null),o()}catch(e){console.error("Failed to update search tool:",e),W.Z.error("Failed to update search tool")}};return s&&t&&a?(0,r.jsxs)("div",{className:"w-full h-full p-6",children:[(0,r.jsx)(sJ,{isModalOpen:h,title:"Delete Search Tool",confirmDelete:C,cancelDelete:()=>{p(!1),x(null)}}),(0,r.jsx)(sY,{userRole:t,accessToken:s,onCreateSuccess:e=>{v(!1),o()},isModalVisible:b,setModalVisible:v}),(0,r.jsx)(H.Z,{title:"Edit Search Tool",open:_,onOk:T,onCancel:()=>{Z(!1),w.resetFields(),f(null)},width:600,children:(0,r.jsxs)(K.Z,{form:w,layout:"vertical",children:[(0,r.jsx)(K.Z.Item,{name:"search_tool_name",label:"Search Tool Name",rules:[{required:!0,message:"Please enter a search tool name"}],children:(0,r.jsx)(e9.default,{placeholder:"e.g., my-perplexity-search"})}),(0,r.jsx)(K.Z.Item,{name:"search_provider",label:"Search Provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,r.jsx)(eh.default,{placeholder:"Select a search provider",loading:d,children:m.map(e=>(0,r.jsx)(eh.default.Option,{value:e.provider_name,children:e.ui_friendly_name},e.provider_name))})}),(0,r.jsx)(K.Z.Item,{name:"api_key",label:"API Key",extra:"API key for the search provider",children:(0,r.jsx)(e9.default.Password,{placeholder:"Enter API key"})}),(0,r.jsx)(K.Z.Item,{name:"description",label:"Description",children:(0,r.jsx)(e9.default.TextArea,{rows:3,placeholder:"Description of this search tool"})})]})}),(0,r.jsx)(V.Z,{children:"Search Tools"}),(0,r.jsx)(U.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your search providers"}),(0,eX.tY)(t)&&(0,r.jsx)(F.Z,{className:"mt-4 mb-4",onClick:()=>v(!0),children:"+ Add New Search Tool"}),(0,r.jsx)(()=>g?(0,r.jsx)(sR,{searchTool:(null==n?void 0:n.find(e=>e.search_tool_id===g))||{search_tool_id:"",search_tool_name:"",litellm_params:{search_provider:""}},onBack:()=>{y(!1),f(null),o()},isEditing:j,accessToken:s,availableProviders:m}):(0,r.jsx)("div",{className:"w-full h-full",children:(0,r.jsx)("div",{className:"w-full px-6 mt-6",children:(0,r.jsx)(sS.w,{data:n||[],columns:N,renderSubComponent:()=>(0,r.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:i,noDataMessage:"No search tools configured"})})}),{})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:t,userID:a}),(0,r.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))};function sX(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";document.cookie="".concat(e,"=; Max-Age=0; Path=").concat(s)}function s$(e){try{let s=(0,n.o)(e);if(s&&"number"==typeof s.exp)return 1e3*s.exp<=Date.now();return!1}catch(e){return!0}}let sQ=new i.S;function s0(){return(0,r.jsxs)("div",{className:(0,eC.cx)("h-screen","flex items-center justify-center gap-4"),children:[(0,r.jsx)("div",{className:"text-lg font-medium py-2 pr-4 border-r border-r-gray-200",children:"\uD83D\uDE85 LiteLLM"}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(eS.S,{className:"size-4"}),(0,r.jsx)("span",{className:"text-gray-600 text-sm",children:"Loading..."})]})]})}function s1(){let[e,s]=(0,l.useState)(""),[t,i]=(0,l.useState)(!1),[F,R]=(0,l.useState)(!1),[M,O]=(0,l.useState)(null),[B,q]=(0,l.useState)(null),[U,V]=(0,l.useState)([]),[K,H]=(0,l.useState)([]),[W,Y]=(0,l.useState)([]),[J,G]=(0,l.useState)({PROXY_BASE_URL:"",PROXY_LOGOUT_URL:""}),[X,$]=(0,l.useState)(!0),Q=(0,a.useSearchParams)(),[ee,es]=(0,l.useState)({data:[]}),[et,er]=(0,l.useState)(null),[el,ea]=(0,l.useState)(!1),[en,ei]=(0,l.useState)(!0),[eo,ec]=(0,l.useState)(null),{refactoredUIFlag:ed}=(0,eT.Z)(),em=Q.get("invitation_id"),[eu,ex]=(0,l.useState)(()=>Q.get("page")||"api-keys"),[eh,ep]=(0,l.useState)(null),[eg,ef]=(0,l.useState)(!1),ej=e=>{V(s=>s?[...s,e]:[e]),ea(()=>!el)},ey=!1===en&&null===et&&null===em;return((0,l.useEffect)(()=>{let e=!1;return(async()=>{try{await (0,S.getUiConfig)()}catch(e){}if(e)return;let s=function(e){let s=document.cookie.split("; ").find(s=>s.startsWith(e+"="));if(!s)return null;let t=s.slice(e.length+1);try{return decodeURIComponent(t)}catch(e){return t}}("token"),t=s&&!s$(s)?s:null;s&&!t&&sX("token","/"),e||(er(t),ei(!1))})(),()=>{e=!0}},[]),(0,l.useEffect)(()=>{if(ey){let e=(S.proxyBaseUrl||"")+"/sso/key/generate";window.location.replace(e)}},[ey]),(0,l.useEffect)(()=>{if(!et)return;if(s$(et)){sX("token","/"),er(null);return}let e=null;try{e=(0,n.o)(et)}catch(e){sX("token","/"),er(null);return}if(e){if(ep(e.key),R(e.disabled_non_admin_personal_key_creation),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);s(t),"Admin Viewer"==t&&ex("usage")}e.user_email&&O(e.user_email),e.login_method&&$("username_password"==e.login_method),e.premium_user&&i(e.premium_user),e.auth_header_name&&(0,S.setGlobalLitellmHeaderName)(e.auth_header_name),e.user_id&&ec(e.user_id)}},[et]),(0,l.useEffect)(()=>{eh&&eo&&e&&(0,P.Nr)(eo,e,eh,Y),eh&&eo&&e&&(0,A.Z)(eh,eo,e,null,q),eh&&(0,h.g)(eh,H)},[eh,eo,e]),en||ey)?(0,r.jsx)(s0,{}):(0,r.jsx)(l.Suspense,{fallback:(0,r.jsx)(s0,{}),children:(0,r.jsx)(o.aH,{client:sQ,children:(0,r.jsx)(d.f,{accessToken:eh,children:em?(0,r.jsx)(m.Z,{userID:eo,userRole:e,premiumUser:t,teams:B,keys:U,setUserRole:s,userEmail:M,setUserEmail:O,setTeams:q,setKeys:V,organizations:K,addKey:ej,createClicked:el}):(0,r.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,r.jsx)(c.Z,{userID:eo,userRole:e,premiumUser:t,userEmail:M,setProxySettings:G,proxySettings:J,accessToken:eh,isPublicPage:!1,sidebarCollapsed:eg,onToggleSidebar:()=>{ef(!eg)}}),(0,r.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(e6,{setPage:e=>{let s=new URLSearchParams(Q);s.set("page",e),window.history.pushState(null,"","?".concat(s.toString())),ex(e)},defaultSelectedKey:eu,sidebarCollapsed:eg})}),"api-keys"==eu?(0,r.jsx)(m.Z,{userID:eo,userRole:e,premiumUser:t,teams:B,keys:U,setUserRole:s,userEmail:M,setUserEmail:O,setTeams:q,setKeys:V,organizations:K,addKey:ej,createClicked:el}):"models"==eu?(0,r.jsx)(u.Z,{userID:eo,userRole:e,token:et,keys:U,accessToken:eh,modelData:ee,setModelData:es,premiumUser:t,teams:B}):"llm-playground"==eu?(0,r.jsx)(w.Z,{userID:eo,userRole:e,token:et,accessToken:eh,disabledPersonalKeyCreation:F}):"users"==eu?(0,r.jsx)(x.Z,{userID:eo,userRole:e,token:et,keys:U,teams:B,accessToken:eh,setKeys:V}):"teams"==eu?(0,r.jsx)(sN,{teams:B,setTeams:q,accessToken:eh,userID:eo,userRole:e,organizations:K,premiumUser:t,searchParams:Q}):"organizations"==eu?(0,r.jsx)(h.Z,{organizations:K,setOrganizations:H,userModels:W,accessToken:eh,userRole:e,premiumUser:t}):"admin-panel"==eu?(0,r.jsx)(p.Z,{setTeams:q,searchParams:Q,accessToken:eh,userID:eo,showSSOBanner:X,premiumUser:t,proxySettings:J}):"api_ref"==eu?(0,r.jsx)(Z.Z,{proxySettings:J}):"settings"==eu?(0,r.jsx)(g.Z,{userID:eo,userRole:e,accessToken:eh,premiumUser:t}):"budgets"==eu?(0,r.jsx)(y.Z,{accessToken:eh}):"guardrails"==eu?(0,r.jsx)(C.Z,{accessToken:eh,userRole:e}):"prompts"==eu?(0,r.jsx)(T.Z,{accessToken:eh,userRole:e}):"transform-request"==eu?(0,r.jsx)(z.Z,{accessToken:eh}):"general-settings"==eu?(0,r.jsx)(f.Z,{userID:eo,userRole:e,accessToken:eh,modelData:ee}):"ui-theme"==eu?(0,r.jsx)(E.Z,{userID:eo,userRole:e,accessToken:eh}):"cost-tracking-settings"==eu?(0,r.jsx)(ek,{userID:eo,userRole:e,accessToken:eh}):"model-hub-table"==eu?(0,r.jsx)(v.Z,{accessToken:eh,publicPage:!1,premiumUser:t,userRole:e}):"caching"==eu?(0,r.jsx)(k.Z,{userID:eo,userRole:e,token:et,accessToken:eh,premiumUser:t}):"pass-through-settings"==eu?(0,r.jsx)(j.Z,{userID:eo,userRole:e,accessToken:eh,modelData:ee,premiumUser:t}):"logs"==eu?(0,r.jsx)(b.Z,{userID:eo,userRole:e,token:et,accessToken:eh,allTeams:null!=B?B:[],premiumUser:t}):"mcp-servers"==eu?(0,r.jsx)(D.d,{accessToken:eh,userRole:e,userID:eo}):"search-tools"==eu?(0,r.jsx)(sG,{accessToken:eh,userRole:e,userID:eo}):"tag-management"==eu?(0,r.jsx)(I.Z,{accessToken:eh,userRole:e,userID:eo}):"vector-stores"==eu?(0,r.jsx)(L.Z,{accessToken:eh,userRole:e,userID:eo}):"new_usage"==eu?(0,r.jsx)(_.Z,{userID:eo,userRole:e,accessToken:eh,teams:null!=B?B:[],premiumUser:t}):(0,r.jsx)(N.Z,{userID:eo,userRole:e,token:et,accessToken:eh,keys:U,premiumUser:t})]})]})})})})}},88904:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(88913),n=t(93192),i=t(52787),o=t(63709),c=t(87908),d=t(19250),m=t(65925),u=t(46468),x=t(9114);s.Z=e=>{var s;let{accessToken:t,userID:h,userRole:p}=e,[g,f]=(0,l.useState)(!0),[j,y]=(0,l.useState)(null),[b,v]=(0,l.useState)(!1),[_,Z]=(0,l.useState)({}),[w,N]=(0,l.useState)(!1),[k,S]=(0,l.useState)([]),{Paragraph:C}=n.default,{Option:T}=i.default;(0,l.useEffect)(()=>{(async()=>{if(!t){f(!1);return}try{let e=await (0,d.getDefaultTeamSettings)(t);if(y(e),Z(e.values||{}),t)try{let e=await (0,d.modelAvailableCall)(t,h,p);if(e&&e.data){let s=e.data.map(e=>e.id);S(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching team SSO settings:",e),x.Z.fromBackend("Failed to fetch team settings")}finally{f(!1)}})()},[t]);let z=async()=>{if(t){N(!0);try{let e=await (0,d.updateDefaultTeamSettings)(t,_);y({...j,values:e.settings}),v(!1),x.Z.success("Default team settings updated successfully")}catch(e){console.error("Error updating team settings:",e),x.Z.fromBackend("Failed to update team settings")}finally{N(!1)}}},P=(e,s)=>{Z(t=>({...t,[e]:s}))},A=(e,s,t)=>{var l;let n=s.type;return"budget_duration"===e?(0,r.jsx)(m.Z,{value:_[e]||null,onChange:s=>P(e,s),className:"mt-2"}):"boolean"===n?(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(o.Z,{checked:!!_[e],onChange:s=>P(e,s)})}):"array"===n&&(null===(l=s.items)||void 0===l?void 0:l.enum)?(0,r.jsx)(i.default,{mode:"multiple",style:{width:"100%"},value:_[e]||[],onChange:s=>P(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,r.jsx)(T,{value:e,children:e},e))}):"models"===e?(0,r.jsx)(i.default,{mode:"multiple",style:{width:"100%"},value:_[e]||[],onChange:s=>P(e,s),className:"mt-2",children:k.map(e=>(0,r.jsx)(T,{value:e,children:(0,u.W0)(e)},e))}):"string"===n&&s.enum?(0,r.jsx)(i.default,{style:{width:"100%"},value:_[e]||"",onChange:s=>P(e,s),className:"mt-2",children:s.enum.map(e=>(0,r.jsx)(T,{value:e,children:e},e))}):(0,r.jsx)(a.oi,{value:void 0!==_[e]?String(_[e]):"",onChange:s=>P(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},D=(e,s)=>null==s?(0,r.jsx)("span",{className:"text-gray-400",children:"Not set"}):"budget_duration"===e?(0,r.jsx)("span",{children:(0,m.m)(s)}):"boolean"==typeof s?(0,r.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,r.jsx)("span",{className:"text-gray-400",children:"None"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,r.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,u.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,r.jsx)("span",{className:"text-gray-400",children:"None"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,r.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,r.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,r.jsx)("span",{children:String(s)});return g?(0,r.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,r.jsx)(c.Z,{size:"large"})}):j?(0,r.jsxs)(a.Zb,{children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,r.jsx)(a.Dx,{className:"text-xl",children:"Default Team Settings"}),!g&&j&&(b?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(a.zx,{variant:"secondary",onClick:()=>{v(!1),Z(j.values||{})},disabled:w,children:"Cancel"}),(0,r.jsx)(a.zx,{onClick:z,loading:w,children:"Save Changes"})]}):(0,r.jsx)(a.zx,{onClick:()=>v(!0),children:"Edit Settings"}))]}),(0,r.jsx)(a.xv,{children:"These settings will be applied by default when creating new teams."}),(null==j?void 0:null===(s=j.field_schema)||void 0===s?void 0:s.description)&&(0,r.jsx)(C,{className:"mb-4 mt-2",children:j.field_schema.description}),(0,r.jsx)(a.iz,{}),(0,r.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=j;return s&&s.properties?Object.entries(s.properties).map(s=>{let[t,l]=s,n=e[t],i=t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,r.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,r.jsx)(a.xv,{className:"font-medium text-lg",children:i}),(0,r.jsx)(C,{className:"text-sm text-gray-500 mt-1",children:l.description||"No description available"}),b?(0,r.jsx)("div",{className:"mt-2",children:A(t,l,n)}):(0,r.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:D(t,n)})]},t)}):(0,r.jsx)(a.xv,{children:"No schema information available"})})()})]}):(0,r.jsx)(a.Zb,{children:(0,r.jsx)(a.xv,{children:"No team settings available or you do not have permission to view them."})})}},49104:function(e,s,t){"use strict";t.d(s,{Z:function(){return E}});var r=t(57437),l=t(2265),a=t(87452),n=t(88829),i=t(72208),o=t(49566),c=t(13634),d=t(82680),m=t(20577),u=t(52787),x=t(73002),h=t(19250),p=t(9114),g=e=>{let{isModalVisible:s,accessToken:t,setIsModalVisible:l,setBudgetList:g}=e,[f]=c.Z.useForm(),j=async e=>{if(null!=t&&void 0!=t)try{p.Z.info("Making API Call");let s=await (0,h.budgetCreateCall)(t,e);console.log("key create Response:",s),g(e=>e?[...e,s]:[s]),p.Z.success("Budget Created"),f.resetFields()}catch(e){console.error("Error creating the key:",e),p.Z.fromBackend("Error creating the key: ".concat(e))}};return(0,r.jsx)(d.Z,{title:"Create Budget",visible:s,width:800,footer:null,onOk:()=>{l(!1),f.resetFields()},onCancel:()=>{l(!1),f.resetFields()},children:(0,r.jsxs)(c.Z,{form:f,onFinish:j,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(o.Z,{placeholder:""})}),(0,r.jsx)(c.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsxs)(a.Z,{className:"mt-20 mb-8",children:[(0,r.jsx)(i.Z,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(n.Z,{children:[(0,r.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(m.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(u.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(u.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(u.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(u.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(x.ZP,{htmlType:"submit",children:"Create Budget"})})]})})},f=e=>{let{isModalVisible:s,accessToken:t,setIsModalVisible:g,setBudgetList:f,existingBudget:j,handleUpdateCall:y}=e;console.log("existingBudget",j);let[b]=c.Z.useForm();(0,l.useEffect)(()=>{b.setFieldsValue(j)},[j,b]);let v=async e=>{if(null!=t&&void 0!=t)try{p.Z.info("Making API Call"),g(!0);let s=await (0,h.budgetUpdateCall)(t,e);f(e=>e?[...e,s]:[s]),p.Z.success("Budget Updated"),b.resetFields(),y()}catch(e){console.error("Error creating the key:",e),p.Z.fromBackend("Error creating the key: ".concat(e))}};return(0,r.jsx)(d.Z,{title:"Edit Budget",visible:s,width:800,footer:null,onOk:()=>{g(!1),b.resetFields()},onCancel:()=>{g(!1),b.resetFields()},children:(0,r.jsxs)(c.Z,{form:b,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:j,children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(o.Z,{placeholder:""})}),(0,r.jsx)(c.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsxs)(a.Z,{className:"mt-20 mb-8",children:[(0,r.jsx)(i.Z,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(n.Z,{children:[(0,r.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(m.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(u.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(u.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(u.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(u.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(x.ZP,{htmlType:"submit",children:"Save"})})]})})},j=t(20831),y=t(12514),b=t(47323),v=t(12485),_=t(18135),Z=t(35242),w=t(29706),N=t(77991),k=t(21626),S=t(97214),C=t(28241),T=t(58834),z=t(69552),P=t(71876),A=t(84264),D=t(53410),I=t(74998),L=t(17906),E=e=>{let{accessToken:s}=e,[t,a]=(0,l.useState)(!1),[n,i]=(0,l.useState)(!1),[o,c]=(0,l.useState)(null),[d,m]=(0,l.useState)([]);(0,l.useEffect)(()=>{s&&(0,h.getBudgetList)(s).then(e=>{m(e)})},[s]);let u=async(e,t)=>{console.log("budget_id",e),null!=s&&(c(d.find(s=>s.budget_id===e)||null),i(!0))},x=async(e,t)=>{if(null==s)return;p.Z.info("Request made"),await (0,h.budgetDeleteCall)(s,e);let r=[...d];r.splice(t,1),m(r),p.Z.success("Budget Deleted.")},E=async()=>{null!=s&&(0,h.getBudgetList)(s).then(e=>{m(e)})};return(0,r.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,r.jsx)(j.Z,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>a(!0),children:"+ Create Budget"}),(0,r.jsx)(g,{accessToken:s,isModalVisible:t,setIsModalVisible:a,setBudgetList:m}),o&&(0,r.jsx)(f,{accessToken:s,isModalVisible:n,setIsModalVisible:i,setBudgetList:m,existingBudget:o,handleUpdateCall:E}),(0,r.jsxs)(y.Z,{children:[(0,r.jsx)(A.Z,{children:"Create a budget to assign to customers."}),(0,r.jsxs)(k.Z,{children:[(0,r.jsx)(T.Z,{children:(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(z.Z,{children:"Budget ID"}),(0,r.jsx)(z.Z,{children:"Max Budget"}),(0,r.jsx)(z.Z,{children:"TPM"}),(0,r.jsx)(z.Z,{children:"RPM"})]})}),(0,r.jsx)(S.Z,{children:d.slice().sort((e,s)=>new Date(s.updated_at).getTime()-new Date(e.updated_at).getTime()).map((e,s)=>(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(C.Z,{children:e.budget_id}),(0,r.jsx)(C.Z,{children:e.max_budget?e.max_budget:"n/a"}),(0,r.jsx)(C.Z,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,r.jsx)(C.Z,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,r.jsx)(b.Z,{icon:D.Z,size:"sm",onClick:()=>u(e.budget_id,s)}),(0,r.jsx)(b.Z,{icon:I.Z,size:"sm",onClick:()=>x(e.budget_id,s)})]},s))})]})]}),(0,r.jsxs)("div",{className:"mt-5",children:[(0,r.jsx)(A.Z,{className:"text-base",children:"How to use budget id"}),(0,r.jsxs)(_.Z,{children:[(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(v.Z,{children:"Assign Budget to Customer"}),(0,r.jsx)(v.Z,{children:"Test it (Curl)"}),(0,r.jsx)(v.Z,{children:"Test it (OpenAI SDK)"})]}),(0,r.jsxs)(N.Z,{children:[(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"bash",children:"\ncurl -X POST --location '/end_user/new' \n-H 'Authorization: Bearer ' \n-H 'Content-Type: application/json' \n-d '{\"user_id\": \"my-customer-id', \"budget_id\": \"\"}' # \uD83D\uDC48 KEY CHANGE\n\n "})}),(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"bash",children:'\ncurl -X POST --location \'/chat/completions\' \n-H \'Authorization: Bearer \' \n-H \'Content-Type: application/json\' \n-d \'{\n "model": "gpt-3.5-turbo\', \n "messages":[{"role": "user", "content": "Hey, how\'s it going?"}],\n "user": "my-customer-id"\n}\' # \uD83D\uDC48 KEY CHANGE\n\n '})}),(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"python",children:'from openai import OpenAI\nclient = OpenAI(\n base_url="",\n api_key=""\n)\n\ncompletion = client.chat.completions.create(\n model="gpt-3.5-turbo",\n messages=[\n {"role": "system", "content": "You are a helpful assistant."},\n {"role": "user", "content": "Hello!"}\n ],\n user="my-customer-id"\n)\n\nprint(completion.choices[0].message)'})})]})]})]})]})}},918:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(62490),n=t(19250),i=t(9114);s.Z=e=>{let{accessToken:s,userID:t}=e,[o,c]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(s&&t)try{let e=await (0,n.availableTeamListCall)(s);c(e)}catch(e){console.error("Error fetching available teams:",e)}})()},[s,t]);let d=async e=>{if(s&&t)try{await (0,n.teamMemberAddCall)(s,e,{user_id:t,role:"user"}),i.Z.success("Successfully joined team"),c(s=>s.filter(s=>s.team_id!==e))}catch(e){console.error("Error joining team:",e),i.Z.fromBackend("Failed to join team")}};return(0,r.jsx)(a.Zb,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,r.jsxs)(a.iA,{children:[(0,r.jsx)(a.ss,{children:(0,r.jsxs)(a.SC,{children:[(0,r.jsx)(a.xs,{children:"Team Name"}),(0,r.jsx)(a.xs,{children:"Description"}),(0,r.jsx)(a.xs,{children:"Members"}),(0,r.jsx)(a.xs,{children:"Models"}),(0,r.jsx)(a.xs,{children:"Actions"})]})}),(0,r.jsxs)(a.RM,{children:[o.map(e=>(0,r.jsxs)(a.SC,{children:[(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.xv,{children:e.team_alias})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.xv,{children:e.description||"No description available"})}),(0,r.jsx)(a.pj,{children:(0,r.jsxs)(a.xv,{children:[e.members_with_roles.length," members"]})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)("div",{className:"flex flex-col",children:e.models&&0!==e.models.length?e.models.map((e,s)=>(0,r.jsx)(a.Ct,{size:"xs",className:"mb-1",color:"blue",children:(0,r.jsx)(a.xv,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},s)):(0,r.jsx)(a.Ct,{size:"xs",color:"red",children:(0,r.jsx)(a.xv,{children:"All Proxy Models"})})})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.zx,{size:"xs",variant:"secondary",onClick:()=>d(e.team_id),children:"Join Team"})})]},e.team_id)),0===o.length&&(0,r.jsx)(a.SC,{children:(0,r.jsx)(a.pj,{colSpan:5,className:"text-center",children:(0,r.jsx)(a.xv,{children:"No available teams to join"})})})]})]})})}},6674:function(e,s,t){"use strict";t.d(s,{Z:function(){return d}});var r=t(57437),l=t(2265),a=t(73002),n=t(23639),i=t(96761),o=t(19250),c=t(9114),d=e=>{let{accessToken:s}=e,[t,d]=(0,l.useState)('{\n "model": "openai/gpt-4o",\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n },\n {\n "role": "user",\n "content": "Explain quantum computing in simple terms"\n }\n ],\n "temperature": 0.7,\n "max_tokens": 500,\n "stream": true\n}'),[m,u]=(0,l.useState)(""),[x,h]=(0,l.useState)(!1),p=(e,s,t)=>{let r=JSON.stringify(s,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),l=Object.entries(t).map(e=>{let[s,t]=e;return"-H '".concat(s,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(l?"".concat(l," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(r,"\n }'")},g=async()=>{h(!0);try{let e;try{e=JSON.parse(t)}catch(e){c.Z.fromBackend("Invalid JSON in request body"),h(!1);return}let r={call_type:"completion",request_body:e};if(!s){c.Z.fromBackend("No access token found"),h(!1);return}let l=await (0,o.transformRequestCall)(s,r);if(l.raw_request_api_base&&l.raw_request_body){let e=p(l.raw_request_api_base,l.raw_request_body,l.raw_request_headers||{});u(e),c.Z.success("Request transformed successfully")}else{let e="string"==typeof l?l:JSON.stringify(l);u(e),c.Z.info("Transformed request received in unexpected format")}}catch(e){console.error("Error transforming request:",e),c.Z.fromBackend("Failed to transform request")}finally{h(!1)}};return(0,r.jsxs)("div",{className:"w-full m-2",style:{overflow:"hidden"},children:[(0,r.jsx)(i.Z,{children:"Playground"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"See how LiteLLM transforms your request for the specified provider."}),(0,r.jsxs)("div",{style:{display:"flex",gap:"16px",width:"100%",minWidth:0,overflow:"hidden"},className:"mt-4",children:[(0,r.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"600px",minWidth:0},children:[(0,r.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,r.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Original Request"}),(0,r.jsx)("p",{style:{color:"#666",margin:0},children:"The request you would send to LiteLLM /chat/completions endpoint."})]}),(0,r.jsx)("textarea",{style:{flex:"1 1 auto",width:"100%",minHeight:"240px",padding:"16px",border:"1px solid #e8e8e8",borderRadius:"6px",fontFamily:"monospace",fontSize:"14px",resize:"none",marginBottom:"24px",overflow:"auto"},value:t,onChange:e=>d(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),g())},placeholder:"Press Cmd/Ctrl + Enter to transform"}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"auto"},children:(0,r.jsxs)(a.ZP,{type:"primary",style:{backgroundColor:"#000",display:"flex",alignItems:"center",gap:"8px"},onClick:g,loading:x,children:[(0,r.jsx)("span",{children:"Transform"}),(0,r.jsx)("span",{children:"→"})]})})]}),(0,r.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"800px",minWidth:0},children:[(0,r.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,r.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Transformed Request"}),(0,r.jsx)("p",{style:{color:"#666",margin:0},children:"How LiteLLM transforms your request for the specified provider."}),(0,r.jsx)("br",{}),(0,r.jsx)("p",{style:{color:"#666",margin:0},className:"text-xs",children:"Note: Sensitive headers are not shown."})]}),(0,r.jsxs)("div",{style:{position:"relative",backgroundColor:"#f5f5f5",borderRadius:"6px",flex:"1 1 auto",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,r.jsx)("pre",{style:{padding:"16px",fontFamily:"monospace",fontSize:"14px",margin:0,overflow:"auto",flex:"1 1 auto"},children:m||'curl -X POST \\\n https://api.openai.com/v1/chat/completions \\\n -H \'Authorization: Bearer sk-xxx\' \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "model": "gpt-4",\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n }\n ],\n "temperature": 0.7\n }\''}),(0,r.jsx)(a.ZP,{type:"text",icon:(0,r.jsx)(n.Z,{}),style:{position:"absolute",right:"8px",top:"8px"},size:"small",onClick:()=>{navigator.clipboard.writeText(m||""),c.Z.success("Copied to clipboard")}})]})]})]}),(0,r.jsx)("div",{className:"mt-4 text-right w-full",children:(0,r.jsxs)("p",{className:"text-sm text-gray-500",children:["Found an error? File an issue"," ",(0,r.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})]})}},5183:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(19046),n=t(69734),i=t(19250),o=t(9114);s.Z=e=>{let{userID:s,userRole:t,accessToken:c}=e,{logoUrl:d,setLogoUrl:m}=(0,n.F)(),[u,x]=(0,l.useState)(""),[h,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{c&&g()},[c]);let g=async()=>{try{let s=(0,i.getProxyBaseUrl)(),t=await fetch(s?"".concat(s,"/get/ui_theme_settings"):"/get/ui_theme_settings",{method:"GET",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"}});if(t.ok){var e;let s=await t.json(),r=(null===(e=s.values)||void 0===e?void 0:e.logo_url)||"";x(r),m(r||null)}}catch(e){console.error("Error fetching theme settings:",e)}},f=async()=>{p(!0);try{let e=(0,i.getProxyBaseUrl)();if((await fetch(e?"".concat(e,"/update/ui_theme_settings"):"/update/ui_theme_settings",{method:"PATCH",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"},body:JSON.stringify({logo_url:u||null})})).ok)o.Z.success("Logo settings updated successfully!"),m(u||null);else throw Error("Failed to update settings")}catch(e){console.error("Error updating logo settings:",e),o.Z.fromBackend("Failed to update logo settings")}finally{p(!1)}},j=async()=>{x(""),m(null),p(!0);try{let e=(0,i.getProxyBaseUrl)();if((await fetch(e?"".concat(e,"/update/ui_theme_settings"):"/update/ui_theme_settings",{method:"PATCH",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"},body:JSON.stringify({logo_url:null})})).ok)o.Z.success("Logo reset to default!");else throw Error("Failed to reset logo")}catch(e){console.error("Error resetting logo:",e),o.Z.fromBackend("Failed to reset logo")}finally{p(!1)}};return c?(0,r.jsxs)("div",{className:"w-full mx-auto max-w-4xl px-6 py-8",children:[(0,r.jsxs)("div",{className:"mb-8",children:[(0,r.jsx)(a.Dx,{className:"text-2xl font-bold mb-2",children:"Logo Customization"}),(0,r.jsx)(a.xv,{className:"text-gray-600",children:"Customize your LiteLLM admin dashboard with a custom logo."})]}),(0,r.jsx)(a.Zb,{className:"shadow-sm p-6",children:(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(a.xv,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Custom Logo URL"}),(0,r.jsx)(a.oi,{placeholder:"https://example.com/logo.png",value:u,onValueChange:e=>{x(e),m(e||null)},className:"w-full"}),(0,r.jsx)(a.xv,{className:"text-xs text-gray-500 mt-1",children:"Enter a URL for your custom logo or leave empty to use the default LiteLLM logo"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(a.xv,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Current Logo"}),(0,r.jsx)("div",{className:"bg-gray-50 rounded-lg p-6 flex items-center justify-center min-h-[120px]",children:u?(0,r.jsx)("img",{src:u,alt:"Custom logo",className:"max-w-full max-h-24 object-contain",onError:e=>{var s;let t=e.target;t.style.display="none";let r=document.createElement("div");r.className="text-gray-500 text-sm",r.textContent="Failed to load image",null===(s=t.parentElement)||void 0===s||s.appendChild(r)}}):(0,r.jsx)(a.xv,{className:"text-gray-500 text-sm",children:"Default LiteLLM logo will be used"})})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,r.jsx)(a.zx,{onClick:f,loading:h,disabled:h,color:"indigo",children:"Save Changes"}),(0,r.jsx)(a.zx,{onClick:j,loading:h,disabled:h,variant:"secondary",color:"gray",children:"Reset to Default"})]})]})})]}):null}}},function(e){e.O(0,[3665,6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,7281,9343,7906,8077,2344,9165,1264,1487,7732,169,6433,1160,722,4388,3250,4886,4338,4688,131,2202,874,4292,7526,2004,2012,8160,1598,7164,3801,4138,3765,7029,7155,6204,1739,6600,773,6925,8143,4289,2273,603,2019,2971,2117,1744],function(){return e(e.s=97731)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/ui/litellm-dashboard/src/components/callback_info_helpers.tsx b/ui/litellm-dashboard/src/components/callback_info_helpers.tsx index 7abe255acc..e7e7cc078b 100644 --- a/ui/litellm-dashboard/src/components/callback_info_helpers.tsx +++ b/ui/litellm-dashboard/src/components/callback_info_helpers.tsx @@ -7,7 +7,7 @@ interface CallbackConfig { description: string; } -const asset_logos_folder = "/ui/assets/logos/"; +const asset_logos_folder = "../ui/assets/logos/"; export const CALLBACK_CONFIGS: CallbackConfig[] = [ { diff --git a/ui/litellm-dashboard/src/components/provider_info_helpers.tsx b/ui/litellm-dashboard/src/components/provider_info_helpers.tsx index f3b7357ffa..8d41719029 100644 --- a/ui/litellm-dashboard/src/components/provider_info_helpers.tsx +++ b/ui/litellm-dashboard/src/components/provider_info_helpers.tsx @@ -86,7 +86,7 @@ export const provider_map: Record = { Infinity: "infinity", }; -const asset_logos_folder = "/ui/assets/logos/"; +const asset_logos_folder = "../ui/assets/logos/"; export const providerLogoMap: Record = { [Providers.AIML]: `${asset_logos_folder}aiml_api.svg`, diff --git a/ui/litellm-dashboard/src/components/search_tools/create_search_tool.tsx b/ui/litellm-dashboard/src/components/search_tools/create_search_tool.tsx index 4a354e95ee..9dd14256ee 100644 --- a/ui/litellm-dashboard/src/components/search_tools/create_search_tool.tsx +++ b/ui/litellm-dashboard/src/components/search_tools/create_search_tool.tsx @@ -13,7 +13,7 @@ import Image from "next/image"; const { TextArea } = Input; // Search provider logos folder path (matches existing provider logo pattern) -const searchProviderLogosFolder = "/ui/assets/logos/"; +const searchProviderLogosFolder = "../ui/assets/logos/"; // Helper function to get logo path for a search provider const getSearchProviderLogo = (providerName: string): string => { diff --git a/ui/litellm-dashboard/src/components/vector_store_providers.tsx b/ui/litellm-dashboard/src/components/vector_store_providers.tsx index 36da5a79ba..a6f222da67 100644 --- a/ui/litellm-dashboard/src/components/vector_store_providers.tsx +++ b/ui/litellm-dashboard/src/components/vector_store_providers.tsx @@ -14,7 +14,7 @@ export const vectorStoreProviderMap: Record = { Azure: "azure", }; -const asset_logos_folder = "/ui/assets/logos/"; +const asset_logos_folder = "../ui/assets/logos/"; export const vectorStoreProviderLogoMap: Record = { [VectorStoreProviders.Bedrock]: `${asset_logos_folder}bedrock.svg`, From 0699430206edcbc9f96e76c8253ef486e19a1a93 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Sat, 15 Nov 2025 08:58:46 -0800 Subject: [PATCH 22/52] test logging tests + mcp server QA checks --- .../mcp_server/mcp_server_manager.py | 24 +++++++++++-------- .../standard_logging_payload.json | 3 ++- .../completion_with_complex_metadata.json | 6 +++-- .../completion_with_tags.json | 6 +++-- .../completion_with_tags_stream.json | 6 +++-- .../complex_metadata.json | 6 +++-- .../complex_metadata_2.json | 6 +++-- .../empty_metadata.json | 6 +++-- .../metadata_with_function.json | 6 +++-- .../metadata_with_lock.json | 6 +++-- .../nested_metadata.json | 6 +++-- .../simple_metadata.json | 6 +++-- .../simple_metadata2.json | 6 +++-- .../simple_metadata3.json | 6 +++-- .../test_langsmith_unit_test.py | 1 + .../mcp_server/test_mcp_server_manager.py | 19 +++++---------- 16 files changed, 71 insertions(+), 48 deletions(-) diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py index 71f1fab13b..c6690c1766 100644 --- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py +++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py @@ -828,10 +828,13 @@ class MCPServerManager: return [], None try: - async with httpx.AsyncClient(timeout=10.0, follow_redirects=True) as client: - response = await client.get(resource_metadata_url) - response.raise_for_status() - data = response.json() + client = get_async_httpx_client( + llm_provider=httpxSpecialProvider.MCP, + params={"timeout": 10.0, "follow_redirects": True}, + ) + response = await client.get(resource_metadata_url) + response.raise_for_status() + data = response.json() except Exception as exc: # pragma: no cover - network issues verbose_logger.debug( "Failed to fetch MCP OAuth metadata from %s: %s", @@ -921,12 +924,13 @@ class MCPServerManager: for url in candidate_urls: try: - async with httpx.AsyncClient( - timeout=10.0, follow_redirects=True - ) as client: - response = await client.get(url) - response.raise_for_status() - data = response.json() + client = get_async_httpx_client( + llm_provider=httpxSpecialProvider.MCP, + params={"timeout": 10.0, "follow_redirects": True}, + ) + response = await client.get(url) + response.raise_for_status() + data = response.json() except Exception as exc: # pragma: no cover - network issues verbose_logger.debug( "Failed to fetch authorization metadata from %s: %s", diff --git a/tests/logging_callback_tests/gcs_pub_sub_body/standard_logging_payload.json b/tests/logging_callback_tests/gcs_pub_sub_body/standard_logging_payload.json index c2940930b8..82173b57cc 100644 --- a/tests/logging_callback_tests/gcs_pub_sub_body/standard_logging_payload.json +++ b/tests/logging_callback_tests/gcs_pub_sub_body/standard_logging_payload.json @@ -61,7 +61,8 @@ "content": "hi", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null } } ], diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_complex_metadata.json b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_complex_metadata.json index 62cb01dfbf..15794de7a0 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_complex_metadata.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_complex_metadata.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -99,7 +100,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-09-27-51-150898_chatcmpl-b783291c-dc76-4660-bfef-b79be9d54e57", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_tags.json b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_tags.json index f4c99a4b45..fd3d3194a5 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_tags.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_tags.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [ "test_tag", @@ -67,7 +68,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-07-31-28-960749_chatcmpl-f06338f0-8c49-45d8-be35-2854a89723c1", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_tags_stream.json b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_tags_stream.json index f3b660dc67..af15f35118 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_tags_stream.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_tags_stream.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [ "test_tag_stream", @@ -67,7 +68,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-08-38-25-665692_chatcmpl-8b67ffb8-4326-4e1b-bf4a-f70930c11c00", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/complex_metadata.json b/tests/logging_callback_tests/langfuse_expected_request_body/complex_metadata.json index 51f7ffa60a..82a115a089 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/complex_metadata.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/complex_metadata.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -74,7 +75,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-09-59-39-362554_chatcmpl-d20ba1d9-cda6-4773-822e-921ebcd426a0", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/complex_metadata_2.json b/tests/logging_callback_tests/langfuse_expected_request_body/complex_metadata_2.json index 5bd15e98cd..33e6b01bee 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/complex_metadata_2.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/complex_metadata_2.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -66,7 +67,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-10-06-50-957097_chatcmpl-62d4ad7c-291b-4fc7-a8a4-3ed0fc3912a5", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/empty_metadata.json b/tests/logging_callback_tests/langfuse_expected_request_body/empty_metadata.json index 803fe75270..f4040f1f8f 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/empty_metadata.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/empty_metadata.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -60,7 +61,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-09-59-32-878577_chatcmpl-1195f870-fd4d-4e38-8dc8-99dd3da5ab0b", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/metadata_with_function.json b/tests/logging_callback_tests/langfuse_expected_request_body/metadata_with_function.json index b9ac7aecba..77ca252c86 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/metadata_with_function.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/metadata_with_function.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -60,7 +61,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-09-59-36-161090_chatcmpl-1ee988c9-9133-4655-bbe4-b97ffb6e3dc9", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/metadata_with_lock.json b/tests/logging_callback_tests/langfuse_expected_request_body/metadata_with_lock.json index 803fe75270..f4040f1f8f 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/metadata_with_lock.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/metadata_with_lock.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -60,7 +61,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-09-59-32-878577_chatcmpl-1195f870-fd4d-4e38-8dc8-99dd3da5ab0b", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/nested_metadata.json b/tests/logging_callback_tests/langfuse_expected_request_body/nested_metadata.json index aec7f2ab86..f4a1bb9dce 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/nested_metadata.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/nested_metadata.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -66,7 +67,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-09-55-28-852503_chatcmpl-131cf0da-a47b-4cd1-850b-50fa077362ac", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata.json b/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata.json index a05595299d..d895378e2c 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -66,7 +67,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-09-53-53-752422_chatcmpl-e99bc1d3-a393-493f-8afe-4507c0acff15", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata2.json b/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata2.json index 769ab97d59..87eba33cff 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata2.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata2.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -70,7 +71,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-09-56-35-474752_chatcmpl-9b152610-3d1e-4731-a84e-d0341ea69a0f", diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata3.json b/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata3.json index 0c41f0fc80..dd3bb4a301 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata3.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/simple_metadata3.json @@ -19,7 +19,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "tags": [] }, @@ -74,7 +75,8 @@ "content": "Hello! How can I assist you today?", "role": "assistant", "tool_calls": null, - "function_call": null + "function_call": null, + "provider_specific_fields": null }, "level": "DEFAULT", "id": "time-09-56-38-784548_chatcmpl-438c8727-86b3-44d9-9b46-42330922cf50", diff --git a/tests/logging_callback_tests/test_langsmith_unit_test.py b/tests/logging_callback_tests/test_langsmith_unit_test.py index 2ec5f1a2e4..4a1807ec83 100644 --- a/tests/logging_callback_tests/test_langsmith_unit_test.py +++ b/tests/logging_callback_tests/test_langsmith_unit_test.py @@ -278,6 +278,7 @@ async def test_langsmith_key_based_logging(mocker): "role": "assistant", "tool_calls": None, "function_call": None, + "provider_specific_fields": None, }, } ], diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py index d5b3832971..33f013696b 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py @@ -9,13 +9,14 @@ from fastapi import HTTPException sys.path.insert(0, "../../../../../") import httpx + from litellm.proxy._experimental.mcp_server.mcp_server_manager import ( MCPServerManager, _deserialize_json_dict, ) from litellm.proxy._types import LiteLLM_MCPServerTable, MCPTransport from litellm.types.mcp import MCPAuth -from litellm.types.mcp_server.mcp_server_manager import MCPServer, MCPOAuthMetadata +from litellm.types.mcp_server.mcp_server_manager import MCPOAuthMetadata, MCPServer class TestMCPServerManager: @@ -237,13 +238,9 @@ class TestMCPServerManager: mock_client = MagicMock() mock_client.get = AsyncMock(return_value=mock_response) - async_client_context = MagicMock() - async_client_context.__aenter__ = AsyncMock(return_value=mock_client) - async_client_context.__aexit__ = AsyncMock(return_value=None) - with patch( - "litellm.proxy._experimental.mcp_server.mcp_server_manager.httpx.AsyncClient", - return_value=async_client_context, + "litellm.proxy._experimental.mcp_server.mcp_server_manager.get_async_httpx_client", + return_value=mock_client, ): servers, scopes = await manager._fetch_oauth_metadata_from_resource( "https://protected.example.com/.well-known/oauth" @@ -277,10 +274,6 @@ class TestMCPServerManager: mock_client = MagicMock() mock_client.get = AsyncMock(return_value=response_obj) - async_client_context = MagicMock() - async_client_context.__aenter__ = AsyncMock(return_value=mock_client) - async_client_context.__aexit__ = AsyncMock(return_value=None) - mock_metadata = MCPOAuthMetadata( scopes=None, authorization_url="https://example.com/auth", @@ -289,8 +282,8 @@ class TestMCPServerManager: ) with patch( - "litellm.proxy._experimental.mcp_server.mcp_server_manager.httpx.AsyncClient", - return_value=async_client_context, + "litellm.proxy._experimental.mcp_server.mcp_server_manager.get_async_httpx_client", + return_value=mock_client, ), patch.object( manager, "_fetch_oauth_metadata_from_resource", From 9f45348bb2b77ca93e52b3dbcbe05117f975159e Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 15 Nov 2025 09:03:29 -0800 Subject: [PATCH 23/52] Building UI for QA (#16686) --- ...{1160-3efb81c958413447.js => 1160-08491effeedbaae3.js} | 2 +- .../out/_next/static/chunks/131-2eebef89ebe87d26.js | 1 - .../out/_next/static/chunks/131-d505623ce13e3958.js | 1 + .../out/_next/static/chunks/1486-75f734aab34a8112.js | 1 - ...{1491-8280340b5391aa11.js => 1491-80dbf1ebc561e9b6.js} | 2 +- .../out/_next/static/chunks/1598-289ef226f27484da.js | 1 - .../out/_next/static/chunks/1598-b4dd64df9427ab1c.js | 1 + ...{1739-30569ada7b1a5a9c.js => 1739-1495570659e854dc.js} | 2 +- .../out/_next/static/chunks/2004-2acee05add5250f4.js | 1 + .../out/_next/static/chunks/2004-c3d6befd75faa51d.js | 1 - .../out/_next/static/chunks/2012-0f598b370e2766b0.js | 1 + .../out/_next/static/chunks/2012-8f0fb5740e369b49.js | 1 - .../out/_next/static/chunks/2019-02887e9caea1e319.js | 1 + .../out/_next/static/chunks/2019-0c9cdab17a49595e.js | 1 - .../out/_next/static/chunks/2202-404db85e26800c7a.js | 1 + .../out/_next/static/chunks/2202-72d27668a17045b2.js | 1 - .../out/_next/static/chunks/226-81daaf8cff08ccfe.js | 1 - ...{2273-33cab2cc8cd58f80.js => 2273-40f31894fc8c0e24.js} | 0 .../out/_next/static/chunks/2284-4cbc9a7f33eb7c89.js | 1 - .../out/_next/static/chunks/2284-6840f6cabd9dbd7e.js | 1 + .../out/_next/static/chunks/2312-02f166690919a2cc.js | 1 + ...{2344-cbe5939116545b80.js => 2344-f7ddb9b01f1ad4ec.js} | 2 +- .../out/_next/static/chunks/2409-33ed6e753f8afe9b.js | 1 + .../out/_next/static/chunks/2772-2d7d7afe0a5dbc2e.js | 1 + ...{3250-3256164511237d25.js => 3250-f8c476289792167a.js} | 2 +- .../out/_next/static/chunks/3310-cb7d557650f7f2d9.js | 1 - ...{9632-8b234decc2d4f256.js => 3354-50bba6f08a0cab6e.js} | 2 +- .../out/_next/static/chunks/3655-7dee4252a2b35874.js | 1 + .../out/_next/static/chunks/3765-0cf1bb929892471f.js | 1 - ...{3801-ef2a34968c4cff5b.js => 3801-a6c59be67a81d7dc.js} | 2 +- .../out/_next/static/chunks/395-9ca940835820f5fa.js | 1 + .../out/_next/static/chunks/4138-1e014623b3f3f85a.js | 1 - .../out/_next/static/chunks/4138-bbc045e58cfe8f02.js | 1 + ...{4289-1afc296c9a6702e2.js => 4289-988122838795ecce.js} | 0 .../out/_next/static/chunks/4292-c755f0704f2336bb.js | 1 + .../out/_next/static/chunks/4292-f03b21fbabd94eb2.js | 1 - .../out/_next/static/chunks/4338-65b4c4c850458423.js | 1 - .../out/_next/static/chunks/4366-cc3fb310f1498d39.js | 1 - .../out/_next/static/chunks/4688-362be3e860cee438.js | 1 - .../{603-cbbf290a41745008.js => 603-ced069c6ecb41baf.js} | 0 .../out/_next/static/chunks/6190-838cf0edd54d6216.js | 1 - ...{6204-910abacf940e6b75.js => 6204-5c34c11f5a32fb09.js} | 2 +- .../out/_next/static/chunks/6455-4e6e27a5b944326d.js | 1 - .../out/_next/static/chunks/6478-f5fd91a406dd265e.js | 1 + ...{6600-fa654553376e4551.js => 6600-bbc506133f5d9c17.js} | 0 .../out/_next/static/chunks/6925-058fe84b7bd44718.js | 1 - .../out/_next/static/chunks/7029-1e996bdfdc84639b.js | 1 - .../out/_next/static/chunks/710-7549fbb4532c452b.js | 1 + .../out/_next/static/chunks/7155-5d31a6a1ad834cf0.js | 1 + .../out/_next/static/chunks/7155-b7450952092e9618.js | 1 - ...{7164-cdaf6a202e5ccbb3.js => 7164-cc01ff2b7f3ae404.js} | 2 +- .../out/_next/static/chunks/7220-6db32c86493cbcd6.js | 1 + .../out/_next/static/chunks/7519-c017e0c3b119c340.js | 1 + .../out/_next/static/chunks/7526-64e8890047228caf.js | 1 - .../out/_next/static/chunks/7526-c6c315293f6101de.js | 1 + .../out/_next/static/chunks/773-0c95c1384e8b4ba5.js | 1 - .../out/_next/static/chunks/773-0cc38c7be8272a14.js | 1 + ...{7732-beabba2779472f55.js => 7732-8e30b84aca950b2b.js} | 2 +- .../out/_next/static/chunks/7906-11071e9e2e7b8318.js | 1 - .../out/_next/static/chunks/7906-342b027633384c4c.js | 1 + .../out/_next/static/chunks/7996-b8f03ca5be1ef8d1.js | 1 + .../out/_next/static/chunks/8049-db73a2d52dc11ceb.js | 1 + ...{8143-3681c0c60afea9c5.js => 8143-4d1d42f30f79c699.js} | 0 .../out/_next/static/chunks/8160-12bc82b6a0051fb3.js | 1 - .../out/_next/static/chunks/8160-c965bc78b5ab7bb4.js | 1 + .../out/_next/static/chunks/8624-54b4dee8acfc3279.js | 1 + .../out/_next/static/chunks/8714-9bfbade577ce106c.js | 1 - .../out/_next/static/chunks/874-93132d6951f9f945.js | 1 + .../out/_next/static/chunks/874-d2dc6ab8e9242cf1.js | 1 - .../out/_next/static/chunks/9111-ca07479fa2062306.js | 1 + .../out/_next/static/chunks/9343-6ab059c233abb1a6.js | 1 - .../out/_next/static/chunks/9411-c310347bea2a098e.js | 1 + .../out/_next/static/chunks/9775-ac7313139c5f089d.js | 1 - ...{page-9257d2efeb3a12ba.js => page-a4ead20f98f45ddf.js} | 2 +- ...{page-9470d6c8fea6495e.js => page-5c781ccfe853de48.js} | 2 +- .../experimental/budgets/page-6d258b7776bc3ce7.js | 1 + .../experimental/budgets/page-c8d0b319f577e903.js | 1 - ...{page-bd274cbddd59c12d.js => page-345792bdf6b31029.js} | 2 +- ...{page-010fa8dfb79d1c9f.js => page-aa14fcce61a98cae.js} | 2 +- .../experimental/prompts/page-13938449af52edb8.js | 1 - .../experimental/prompts/page-be80069385d6d581.js | 1 + ...{page-3a0f845b4ef5f3db.js => page-9adbdbc7a0844ed6.js} | 2 +- ...{page-63a0fe276c3eebab.js => page-93dbf37f5765488e.js} | 2 +- ...out-36555ce775a4d546.js => layout-e6c01f120876bb3b.js} | 2 +- .../chunks/app/(dashboard)/logs/page-0b6d711a6e6e47a8.js | 1 + .../chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js | 1 - ...{page-ae84485c01bdb4d5.js => page-f87904b9acc850df.js} | 2 +- .../models-and-endpoints/page-41cb8448fd40a510.js | 1 + .../models-and-endpoints/page-e8e7977789ef33b7.js | 1 - .../(dashboard)/organizations/page-74523c2b19799bf5.js | 1 - .../(dashboard)/organizations/page-930a3a6c479fdc56.js | 1 + ...{page-3fa0cce755f1e0f7.js => page-590040b2c5b2d07f.js} | 2 +- ...{page-9879d5f79e798cff.js => page-a3561c81525bb1c4.js} | 2 +- ...{page-c74b1104b41fa368.js => page-e279c78de9481f8b.js} | 2 +- ...{page-0a2f67a8126ad082.js => page-f243061b79b938ba.js} | 2 +- ...{page-61d65b25f3e3c300.js => page-1fe5d2c441bb3959.js} | 2 +- ...{page-f536da4064bd1547.js => page-142020f9e6dfa205.js} | 2 +- ...{page-3851c0d7162337c4.js => page-5ba9e4bed2a45b2c.js} | 2 +- .../tools/vector-stores/page-63482bd2e2962cff.js | 1 + .../tools/vector-stores/page-9c3caf73da576ffa.js | 1 - .../chunks/app/(dashboard)/usage/page-62e98a09eac1291f.js | 1 + .../chunks/app/(dashboard)/usage/page-e277e34746497b13.js | 1 - ...{page-81a06a6c51449187.js => page-041741916f7fa54a.js} | 2 +- .../app/(dashboard)/virtual-keys/page-3ef67b1d6c711dff.js | 1 - .../app/(dashboard)/virtual-keys/page-84ea7111221d0f49.js | 1 + ...out-74d8887f5698d884.js => layout-820cedabc8a0fb7a.js} | 2 +- ...{page-03c9fb7071bf97d7.js => page-a3c078e7643ba9f5.js} | 2 +- ...{page-0f92d33a8b8f9551.js => page-c7afd46ac073b5b1.js} | 2 +- .../static/chunks/app/onboarding/page-919a95d688f282f8.js | 1 - .../static/chunks/app/onboarding/page-9d2237541bf5adf9.js | 1 + .../out/_next/static/chunks/app/page-366f0e8180b3165b.js | 1 + .../out/_next/static/chunks/app/page-3ac57035eb8ce002.js | 1 - ...p-77a6ca3c04ee9adf.js => main-app-c6945ec5b2d5e671.js} | 2 +- .../out/_next/static/css/9bba2469df3eb88d.css | 3 --- .../out/_next/static/css/d1d84bbc374a5a03.css | 3 +++ .../_buildManifest.js | 0 .../_ssgManifest.js | 0 .../out/{api-reference/index.html => api-reference.html} | 2 +- litellm/proxy/_experimental/out/api-reference.txt | 8 ++++---- .../_experimental/out/experimental/api-playground.html | 2 +- .../_experimental/out/experimental/api-playground.txt | 8 ++++---- litellm/proxy/_experimental/out/experimental/budgets.html | 2 +- litellm/proxy/_experimental/out/experimental/budgets.txt | 8 ++++---- litellm/proxy/_experimental/out/experimental/caching.html | 2 +- litellm/proxy/_experimental/out/experimental/caching.txt | 8 ++++---- .../proxy/_experimental/out/experimental/old-usage.html | 2 +- .../proxy/_experimental/out/experimental/old-usage.txt | 8 ++++---- litellm/proxy/_experimental/out/experimental/prompts.html | 2 +- litellm/proxy/_experimental/out/experimental/prompts.txt | 8 ++++---- .../_experimental/out/experimental/tag-management.html | 2 +- .../_experimental/out/experimental/tag-management.txt | 8 ++++---- litellm/proxy/_experimental/out/guardrails.html | 1 + litellm/proxy/_experimental/out/guardrails.txt | 8 ++++---- litellm/proxy/_experimental/out/index.html | 2 +- litellm/proxy/_experimental/out/index.txt | 6 +++--- litellm/proxy/_experimental/out/logs.html | 1 + litellm/proxy/_experimental/out/logs.txt | 8 ++++---- litellm/proxy/_experimental/out/logs/index.html | 1 - .../out/{model-hub/index.html => model-hub.html} | 2 +- litellm/proxy/_experimental/out/model-hub.txt | 8 ++++---- litellm/proxy/_experimental/out/model_hub.txt | 6 +++--- .../{model_hub_table/index.html => model_hub_table.html} | 2 +- litellm/proxy/_experimental/out/model_hub_table.txt | 6 +++--- litellm/proxy/_experimental/out/models-and-endpoints.html | 1 + litellm/proxy/_experimental/out/models-and-endpoints.txt | 8 ++++---- .../_experimental/out/models-and-endpoints/index.html | 1 - litellm/proxy/_experimental/out/onboarding.html | 1 + litellm/proxy/_experimental/out/onboarding.txt | 6 +++--- litellm/proxy/_experimental/out/organizations.html | 1 + litellm/proxy/_experimental/out/organizations.txt | 8 ++++---- .../proxy/_experimental/out/settings/admin-settings.html | 2 +- .../proxy/_experimental/out/settings/admin-settings.txt | 8 ++++---- .../_experimental/out/settings/logging-and-alerts.html | 2 +- .../_experimental/out/settings/logging-and-alerts.txt | 8 ++++---- .../proxy/_experimental/out/settings/router-settings.html | 2 +- .../proxy/_experimental/out/settings/router-settings.txt | 8 ++++---- litellm/proxy/_experimental/out/settings/ui-theme.html | 2 +- litellm/proxy/_experimental/out/settings/ui-theme.txt | 8 ++++---- .../_experimental/out/{teams/index.html => teams.html} | 2 +- litellm/proxy/_experimental/out/teams.txt | 8 ++++---- .../out/{test-key/index.html => test-key.html} | 2 +- litellm/proxy/_experimental/out/test-key.txt | 8 ++++---- litellm/proxy/_experimental/out/tools/mcp-servers.html | 2 +- litellm/proxy/_experimental/out/tools/mcp-servers.txt | 8 ++++---- litellm/proxy/_experimental/out/tools/vector-stores.html | 2 +- litellm/proxy/_experimental/out/tools/vector-stores.txt | 8 ++++---- litellm/proxy/_experimental/out/usage.html | 1 + litellm/proxy/_experimental/out/usage.txt | 8 ++++---- litellm/proxy/_experimental/out/usage/index.html | 1 - litellm/proxy/_experimental/out/users.html | 1 + litellm/proxy/_experimental/out/users.txt | 8 ++++---- litellm/proxy/_experimental/out/users/index.html | 1 - .../out/{organizations/index.html => virtual-keys.html} | 2 +- litellm/proxy/_experimental/out/virtual-keys.txt | 8 ++++---- litellm/proxy/_experimental/out/virtual-keys/index.html | 1 - 175 files changed, 202 insertions(+), 200 deletions(-) rename litellm/proxy/_experimental/out/_next/static/chunks/{1160-3efb81c958413447.js => 1160-08491effeedbaae3.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/131-d505623ce13e3958.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1486-75f734aab34a8112.js rename litellm/proxy/_experimental/out/_next/static/chunks/{1491-8280340b5391aa11.js => 1491-80dbf1ebc561e9b6.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1598-289ef226f27484da.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1598-b4dd64df9427ab1c.js rename litellm/proxy/_experimental/out/_next/static/chunks/{1739-30569ada7b1a5a9c.js => 1739-1495570659e854dc.js} (99%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2004-2acee05add5250f4.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2004-c3d6befd75faa51d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2012-0f598b370e2766b0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2012-8f0fb5740e369b49.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2019-02887e9caea1e319.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2019-0c9cdab17a49595e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2202-404db85e26800c7a.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2202-72d27668a17045b2.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/226-81daaf8cff08ccfe.js rename litellm/proxy/_experimental/out/_next/static/chunks/{2273-33cab2cc8cd58f80.js => 2273-40f31894fc8c0e24.js} (100%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2284-4cbc9a7f33eb7c89.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2284-6840f6cabd9dbd7e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2312-02f166690919a2cc.js rename litellm/proxy/_experimental/out/_next/static/chunks/{2344-cbe5939116545b80.js => 2344-f7ddb9b01f1ad4ec.js} (98%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2409-33ed6e753f8afe9b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2772-2d7d7afe0a5dbc2e.js rename litellm/proxy/_experimental/out/_next/static/chunks/{3250-3256164511237d25.js => 3250-f8c476289792167a.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3310-cb7d557650f7f2d9.js rename litellm/proxy/_experimental/out/_next/static/chunks/{9632-8b234decc2d4f256.js => 3354-50bba6f08a0cab6e.js} (63%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3655-7dee4252a2b35874.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3765-0cf1bb929892471f.js rename litellm/proxy/_experimental/out/_next/static/chunks/{3801-ef2a34968c4cff5b.js => 3801-a6c59be67a81d7dc.js} (99%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/395-9ca940835820f5fa.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4138-1e014623b3f3f85a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4138-bbc045e58cfe8f02.js rename litellm/proxy/_experimental/out/_next/static/chunks/{4289-1afc296c9a6702e2.js => 4289-988122838795ecce.js} (100%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4292-c755f0704f2336bb.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4292-f03b21fbabd94eb2.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4338-65b4c4c850458423.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4366-cc3fb310f1498d39.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4688-362be3e860cee438.js rename litellm/proxy/_experimental/out/_next/static/chunks/{603-cbbf290a41745008.js => 603-ced069c6ecb41baf.js} (100%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6190-838cf0edd54d6216.js rename litellm/proxy/_experimental/out/_next/static/chunks/{6204-910abacf940e6b75.js => 6204-5c34c11f5a32fb09.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6455-4e6e27a5b944326d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6478-f5fd91a406dd265e.js rename litellm/proxy/_experimental/out/_next/static/chunks/{6600-fa654553376e4551.js => 6600-bbc506133f5d9c17.js} (100%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6925-058fe84b7bd44718.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7029-1e996bdfdc84639b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/710-7549fbb4532c452b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7155-5d31a6a1ad834cf0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7155-b7450952092e9618.js rename litellm/proxy/_experimental/out/_next/static/chunks/{7164-cdaf6a202e5ccbb3.js => 7164-cc01ff2b7f3ae404.js} (99%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7220-6db32c86493cbcd6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7519-c017e0c3b119c340.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7526-64e8890047228caf.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7526-c6c315293f6101de.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/773-0c95c1384e8b4ba5.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/773-0cc38c7be8272a14.js rename litellm/proxy/_experimental/out/_next/static/chunks/{7732-beabba2779472f55.js => 7732-8e30b84aca950b2b.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7906-11071e9e2e7b8318.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7906-342b027633384c4c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7996-b8f03ca5be1ef8d1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8049-db73a2d52dc11ceb.js rename litellm/proxy/_experimental/out/_next/static/chunks/{8143-3681c0c60afea9c5.js => 8143-4d1d42f30f79c699.js} (100%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8160-12bc82b6a0051fb3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8160-c965bc78b5ab7bb4.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8624-54b4dee8acfc3279.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8714-9bfbade577ce106c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/874-93132d6951f9f945.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/874-d2dc6ab8e9242cf1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9111-ca07479fa2062306.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9343-6ab059c233abb1a6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9411-c310347bea2a098e.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9775-ac7313139c5f089d.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/api-reference/{page-9257d2efeb3a12ba.js => page-a4ead20f98f45ddf.js} (99%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/api-playground/{page-9470d6c8fea6495e.js => page-5c781ccfe853de48.js} (98%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/budgets/page-6d258b7776bc3ce7.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/budgets/page-c8d0b319f577e903.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/caching/{page-bd274cbddd59c12d.js => page-345792bdf6b31029.js} (96%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/old-usage/{page-010fa8dfb79d1c9f.js => page-aa14fcce61a98cae.js} (96%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/prompts/page-13938449af52edb8.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/prompts/page-be80069385d6d581.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/tag-management/{page-3a0f845b4ef5f3db.js => page-9adbdbc7a0844ed6.js} (67%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/guardrails/{page-63a0fe276c3eebab.js => page-93dbf37f5765488e.js} (94%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/{layout-36555ce775a4d546.js => layout-e6c01f120876bb3b.js} (98%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-0b6d711a6e6e47a8.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/model-hub/{page-ae84485c01bdb4d5.js => page-f87904b9acc850df.js} (97%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-41cb8448fd40a510.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/organizations/page-74523c2b19799bf5.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/organizations/page-930a3a6c479fdc56.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/admin-settings/{page-3fa0cce755f1e0f7.js => page-590040b2c5b2d07f.js} (94%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/{page-9879d5f79e798cff.js => page-a3561c81525bb1c4.js} (51%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/router-settings/{page-c74b1104b41fa368.js => page-e279c78de9481f8b.js} (94%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/ui-theme/{page-0a2f67a8126ad082.js => page-f243061b79b938ba.js} (98%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/teams/{page-61d65b25f3e3c300.js => page-1fe5d2c441bb3959.js} (99%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/test-key/{page-f536da4064bd1547.js => page-142020f9e6dfa205.js} (88%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/mcp-servers/{page-3851c0d7162337c4.js => page-5ba9e4bed2a45b2c.js} (95%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-63482bd2e2962cff.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-62e98a09eac1291f.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-e277e34746497b13.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/users/{page-81a06a6c51449187.js => page-041741916f7fa54a.js} (96%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/virtual-keys/page-3ef67b1d6c711dff.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/virtual-keys/page-84ea7111221d0f49.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/{layout-74d8887f5698d884.js => layout-820cedabc8a0fb7a.js} (91%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/model_hub/{page-03c9fb7071bf97d7.js => page-a3c078e7643ba9f5.js} (97%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/model_hub_table/{page-0f92d33a8b8f9551.js => page-c7afd46ac073b5b1.js} (96%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-919a95d688f282f8.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-9d2237541bf5adf9.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/page-366f0e8180b3165b.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/page-3ac57035eb8ce002.js rename litellm/proxy/_experimental/out/_next/static/chunks/{main-app-77a6ca3c04ee9adf.js => main-app-c6945ec5b2d5e671.js} (81%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/css/9bba2469df3eb88d.css create mode 100644 litellm/proxy/_experimental/out/_next/static/css/d1d84bbc374a5a03.css rename litellm/proxy/_experimental/out/_next/static/{nynjENYG9eyWwqRWz7fGE => zzKcMfj4Db-ZZ7hcspdhR}/_buildManifest.js (100%) rename litellm/proxy/_experimental/out/_next/static/{nynjENYG9eyWwqRWz7fGE => zzKcMfj4Db-ZZ7hcspdhR}/_ssgManifest.js (100%) rename litellm/proxy/_experimental/out/{api-reference/index.html => api-reference.html} (87%) create mode 100644 litellm/proxy/_experimental/out/guardrails.html create mode 100644 litellm/proxy/_experimental/out/logs.html delete mode 100644 litellm/proxy/_experimental/out/logs/index.html rename litellm/proxy/_experimental/out/{model-hub/index.html => model-hub.html} (80%) rename litellm/proxy/_experimental/out/{model_hub_table/index.html => model_hub_table.html} (79%) create mode 100644 litellm/proxy/_experimental/out/models-and-endpoints.html delete mode 100644 litellm/proxy/_experimental/out/models-and-endpoints/index.html create mode 100644 litellm/proxy/_experimental/out/onboarding.html create mode 100644 litellm/proxy/_experimental/out/organizations.html rename litellm/proxy/_experimental/out/{teams/index.html => teams.html} (80%) rename litellm/proxy/_experimental/out/{test-key/index.html => test-key.html} (84%) create mode 100644 litellm/proxy/_experimental/out/usage.html delete mode 100644 litellm/proxy/_experimental/out/usage/index.html create mode 100644 litellm/proxy/_experimental/out/users.html delete mode 100644 litellm/proxy/_experimental/out/users/index.html rename litellm/proxy/_experimental/out/{organizations/index.html => virtual-keys.html} (57%) delete mode 100644 litellm/proxy/_experimental/out/virtual-keys/index.html diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1160-3efb81c958413447.js b/litellm/proxy/_experimental/out/_next/static/chunks/1160-08491effeedbaae3.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/1160-3efb81c958413447.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1160-08491effeedbaae3.js index 2a26d9fe08..192f36bba2 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1160-3efb81c958413447.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1160-08491effeedbaae3.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1160],{69993:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"},a=n(55015),c=o.forwardRef(function(e,t){return o.createElement(a.Z,(0,r.Z)({},e,{ref:t,icon:i}))})},14042:function(e,t,n){"use strict";n.d(t,{Z:function(){return eM}});var r=n(5853),o=n(7084),i=n(26898),a=n(97324),c=n(1153),l=n(2265),s=n(60474),u=n(47625),p=n(93765),f=n(86757),d=n.n(f),y=n(9841),m=n(81889),h=n(87602),v=n(82944),b=["points","className","baseLinePoints","connectNulls"];function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(function(e){x(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),x(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},j=function(e,t){var n=k(e);t&&(n=[n.reduce(function(e,t){return[].concat(A(e),A(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y)},"")}).join("");return 1===n.length?"".concat(r,"Z"):r},w=function(e,t,n){var r=j(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(j(t.reverse(),n).slice(1))},P=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,o=e.connectNulls,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,b);if(!t||!t.length)return null;var a=(0,h.Z)("recharts-polygon",n);if(r&&r.length){var c=i.stroke&&"none"!==i.stroke,s=w(t,r,o);return l.createElement("g",{className:a},l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"Z"===s.slice(-1)?i.fill:"none",stroke:"none",d:s})),c?l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"none",d:j(t,o)})):null,c?l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"none",d:j(r,o)})):null)}var u=j(t,o);return l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"Z"===u.slice(-1)?i.fill:"none",className:a,d:u}))},E=n(58811),S=n(41637),T=n(39206);function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function L(){return(L=Object.assign?Object.assign.bind():function(e){for(var t=1;t1e-5?"outer"===t?"start":"end":n<-.00001?"outer"===t?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,o=e.axisLine,i=e.axisLineType,a=I(I({},(0,v.L6)(this.props,!1)),{},{fill:"none"},(0,v.L6)(o,!1));if("circle"===i)return l.createElement(m.o,L({className:"recharts-polar-angle-axis-line"},a,{cx:t,cy:n,r:r}));var c=this.props.ticks.map(function(e){return(0,T.op)(t,n,r,e.coordinate)});return l.createElement(P,L({className:"recharts-polar-angle-axis-line"},a,{points:c}))}},{key:"renderTicks",value:function(){var e=this,t=this.props,n=t.ticks,r=t.tick,o=t.tickLine,a=t.tickFormatter,c=t.stroke,s=(0,v.L6)(this.props,!1),u=(0,v.L6)(r,!1),p=I(I({},s),{},{fill:"none"},(0,v.L6)(o,!1)),f=n.map(function(t,n){var f=e.getTickLineCoord(t),d=I(I(I({textAnchor:e.getTickTextAnchor(t)},s),{},{stroke:"none",fill:c},u),{},{index:n,payload:t,x:f.x2,y:f.y2});return l.createElement(y.m,L({className:"recharts-polar-angle-axis-tick",key:"tick-".concat(t.coordinate)},(0,S.bw)(e.props,t,n)),o&&l.createElement("line",L({className:"recharts-polar-angle-axis-tick-line"},p,f)),r&&i.renderTickItem(r,d,a?a(t.value,n):t.value))});return l.createElement(y.m,{className:"recharts-polar-angle-axis-ticks"},f)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return!(n<=0)&&t&&t.length?l.createElement(y.m,{className:"recharts-polar-angle-axis"},r&&this.renderAxisLine(),this.renderTicks()):null}}],r=[{key:"renderTickItem",value:function(e,t,n){return l.isValidElement(e)?l.cloneElement(e,t):d()(e)?e(t):l.createElement(E.x,L({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],n&&C(i.prototype,n),r&&C(i,r),Object.defineProperty(i,"prototype",{writable:!1}),i}(l.PureComponent);_(B,"displayName","PolarAngleAxis"),_(B,"axisType","angleAxis"),_(B,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var K=n(35802),V=n.n(K),z=n(37891),$=n.n(z),H=n(26680),q=["cx","cy","angle","ticks","axisLine"],G=["ticks","tick","angle","tickFormatter","stroke"];function Y(e){return(Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Q(e,t){for(var n=0;n0?ec()(e,"paddingAngle",0):0;if(n){var c=(0,eh.k4)(n.endAngle-n.startAngle,e.endAngle-e.startAngle),l=ek(ek({},e),{},{startAngle:i+a,endAngle:i+c(r)+a});o.push(l),i=l.endAngle}else{var s=e.endAngle,p=e.startAngle,f=(0,eh.k4)(0,s-p)(r),d=ek(ek({},e),{},{startAngle:i+a,endAngle:i+f+a});o.push(d),i=d.endAngle}}),l.createElement(y.m,null,e.renderSectorsStatically(o))})}},{key:"attachKeyboardHandlers",value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case"ArrowLeft":var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case"ArrowRight":var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case"Escape":t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return n&&t&&t.length&&(!r||!es()(r,t))?this.renderSectorsWithAnimation():this.renderSectorsStatically(t)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,o=t.className,i=t.label,a=t.cx,c=t.cy,s=t.innerRadius,u=t.outerRadius,p=t.isAnimationActive,f=this.state.isAnimationFinished;if(n||!r||!r.length||!(0,eh.hj)(a)||!(0,eh.hj)(c)||!(0,eh.hj)(s)||!(0,eh.hj)(u))return null;var d=(0,h.Z)("recharts-pie",o);return l.createElement(y.m,{tabIndex:this.props.rootTabIndex,className:d,ref:function(t){e.pieRef=t}},this.renderSectors(),i&&this.renderLabels(r),H._.renderCallByParent(this.props,null,!1),(!p||f)&&ed.e.renderCallByParent(this.props,r,!1))}}],r=[{key:"getDerivedStateFromProps",value:function(e,t){return t.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors!==t.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,t){return e>t?"start":e=360?A:A-1)*u,x=i.reduce(function(e,t){var n=(0,ev.F$)(t,g,0);return e+((0,eh.hj)(n)?n:0)},0);return x>0&&(t=i.map(function(e,t){var r,o=(0,ev.F$)(e,g,0),i=(0,ev.F$)(e,f,t),a=((0,eh.hj)(o)?o:0)/x,s=(r=t?n.endAngle+(0,eh.uY)(v)*u*(0!==o?1:0):l)+(0,eh.uY)(v)*((0!==o?m:0)+a*O),p=(r+s)/2,d=(h.innerRadius+h.outerRadius)/2,b=[{name:i,value:o,payload:e,dataKey:g,type:y}],A=(0,T.op)(h.cx,h.cy,d,p);return n=ek(ek(ek({percent:a,cornerRadius:c,name:i,tooltipPayload:b,midAngle:p,middleRadius:d,tooltipPosition:A},e),h),{},{value:(0,ev.F$)(e,g),startAngle:r,endAngle:s,payload:e,paddingAngle:(0,eh.uY)(v)*u})})),ek(ek({},h),{},{sectors:t,data:i})});var eL=(0,p.z)({chartName:"PieChart",GraphicalChild:eR,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:B},{axisType:"radiusAxis",AxisComp:eo}],formatAxisMap:T.t9,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),eN=n(8147),eI=n(69448),eC=n(98593);let eD=e=>{let{active:t,payload:n,valueFormatter:r}=e;if(t&&(null==n?void 0:n[0])){let e=null==n?void 0:n[0];return l.createElement(eC.$B,null,l.createElement("div",{className:(0,a.q)("px-4 py-2")},l.createElement(eC.zX,{value:r(e.value),name:e.name,color:e.payload.color})))}return null},eF=(e,t)=>e.map((e,n)=>{let r=ne||t((0,c.vP)(n.map(e=>e[r]))),eZ=e=>{let{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c}=e;return l.createElement("g",null,l.createElement(s.L,{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c,fill:"",opacity:.3,style:{outline:"none"}}))},eM=l.forwardRef((e,t)=>{let{data:n=[],category:s="value",index:p="name",colors:f=i.s,variant:d="donut",valueFormatter:y=c.Cj,label:m,showLabel:h=!0,animationDuration:v=900,showAnimation:b=!1,showTooltip:g=!0,noDataText:A,onValueChange:O,customTooltip:x,className:k}=e,j=(0,r._T)(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),w="donut"==d,P=e_(m,y,n,s),[E,S]=l.useState(void 0),T=!!O;return(0,l.useEffect)(()=>{let e=document.querySelectorAll(".recharts-pie-sector");e&&e.forEach(e=>{e.setAttribute("style","outline: none")})},[E]),l.createElement("div",Object.assign({ref:t,className:(0,a.q)("w-full h-40",k)},j),l.createElement(u.h,{className:"h-full w-full"},(null==n?void 0:n.length)?l.createElement(eL,{onClick:T&&E?()=>{S(void 0),null==O||O(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},h&&w?l.createElement("text",{className:(0,a.q)("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},P):null,l.createElement(eR,{className:(0,a.q)("stroke-tremor-background dark:stroke-dark-tremor-background",O?"cursor-pointer":"cursor-default"),data:eF(n,f),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:w?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:s,nameKey:p,isAnimationActive:b,animationDuration:v,onClick:function(e,t,n){n.stopPropagation(),T&&(E===t?(S(void 0),null==O||O(null)):(S(t),null==O||O(Object.assign({eventType:"slice"},e.payload.payload))))},activeIndex:E,inactiveShape:eZ,style:{outline:"none"}}),l.createElement(eN.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:g?e=>{var t;let{active:n,payload:r}=e;return x?l.createElement(x,{payload:null==r?void 0:r.map(e=>{var t,n,i;return Object.assign(Object.assign({},e),{color:null!==(i=null===(n=null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.payload)||void 0===n?void 0:n.color)&&void 0!==i?i:o.fr.Gray})}),active:n,label:null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.name}):l.createElement(eD,{active:n,payload:r,valueFormatter:y})}:l.createElement(l.Fragment,null)})):l.createElement(eI.Z,{noDataText:A})))});eM.displayName="DonutChart"},7366:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(41154),o=n(25721),i=n(55463),a=n(99735),c=n(7656),l=n(47869);function s(e,t){if((0,c.Z)(2,arguments),!t||"object"!==(0,r.Z)(t))return new Date(NaN);var n=t.years?(0,l.Z)(t.years):0,s=t.months?(0,l.Z)(t.months):0,u=t.weeks?(0,l.Z)(t.weeks):0,p=t.days?(0,l.Z)(t.days):0,f=t.hours?(0,l.Z)(t.hours):0,d=t.minutes?(0,l.Z)(t.minutes):0,y=t.seconds?(0,l.Z)(t.seconds):0,m=(0,a.Z)(e),h=s||n?(0,i.Z)(m,s+12*n):m;return new Date((p||u?(0,o.Z)(h,p+7*u):h).getTime()+1e3*(y+60*(d+60*f)))}},35802:function(e,t,n){var r=n(67646),o=n(58905),i=n(88157);e.exports=function(e,t){return e&&e.length?r(e,i(t,2),o):void 0}},37891:function(e,t,n){var r=n(67646),o=n(88157),i=n(20121);e.exports=function(e,t){return e&&e.length?r(e,o(t,2),i):void 0}},58710:function(e,t,n){"use strict";var r=n(2265);let o=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o}}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1160],{69993:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1119),o=n(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"},a=n(55015),c=o.forwardRef(function(e,t){return o.createElement(a.Z,(0,r.Z)({},e,{ref:t,icon:i}))})},14042:function(e,t,n){"use strict";n.d(t,{Z:function(){return eM}});var r=n(5853),o=n(7084),i=n(26898),a=n(97324),c=n(1153),l=n(2265),s=n(60474),u=n(47625),p=n(93765),f=n(86757),d=n.n(f),y=n(9841),m=n(81889),h=n(61994),v=n(82944),b=["points","className","baseLinePoints","connectNulls"];function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(function(e){x(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),x(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},j=function(e,t){var n=k(e);t&&(n=[n.reduce(function(e,t){return[].concat(A(e),A(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y)},"")}).join("");return 1===n.length?"".concat(r,"Z"):r},w=function(e,t,n){var r=j(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(j(t.reverse(),n).slice(1))},P=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,o=e.connectNulls,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,b);if(!t||!t.length)return null;var a=(0,h.Z)("recharts-polygon",n);if(r&&r.length){var c=i.stroke&&"none"!==i.stroke,s=w(t,r,o);return l.createElement("g",{className:a},l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"Z"===s.slice(-1)?i.fill:"none",stroke:"none",d:s})),c?l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"none",d:j(t,o)})):null,c?l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"none",d:j(r,o)})):null)}var u=j(t,o);return l.createElement("path",g({},(0,v.L6)(i,!0),{fill:"Z"===u.slice(-1)?i.fill:"none",className:a,d:u}))},E=n(58811),S=n(41637),T=n(39206);function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function L(){return(L=Object.assign?Object.assign.bind():function(e){for(var t=1;t1e-5?"outer"===t?"start":"end":n<-.00001?"outer"===t?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,o=e.axisLine,i=e.axisLineType,a=I(I({},(0,v.L6)(this.props,!1)),{},{fill:"none"},(0,v.L6)(o,!1));if("circle"===i)return l.createElement(m.o,L({className:"recharts-polar-angle-axis-line"},a,{cx:t,cy:n,r:r}));var c=this.props.ticks.map(function(e){return(0,T.op)(t,n,r,e.coordinate)});return l.createElement(P,L({className:"recharts-polar-angle-axis-line"},a,{points:c}))}},{key:"renderTicks",value:function(){var e=this,t=this.props,n=t.ticks,r=t.tick,o=t.tickLine,a=t.tickFormatter,c=t.stroke,s=(0,v.L6)(this.props,!1),u=(0,v.L6)(r,!1),p=I(I({},s),{},{fill:"none"},(0,v.L6)(o,!1)),f=n.map(function(t,n){var f=e.getTickLineCoord(t),d=I(I(I({textAnchor:e.getTickTextAnchor(t)},s),{},{stroke:"none",fill:c},u),{},{index:n,payload:t,x:f.x2,y:f.y2});return l.createElement(y.m,L({className:"recharts-polar-angle-axis-tick",key:"tick-".concat(t.coordinate)},(0,S.bw)(e.props,t,n)),o&&l.createElement("line",L({className:"recharts-polar-angle-axis-tick-line"},p,f)),r&&i.renderTickItem(r,d,a?a(t.value,n):t.value))});return l.createElement(y.m,{className:"recharts-polar-angle-axis-ticks"},f)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return!(n<=0)&&t&&t.length?l.createElement(y.m,{className:"recharts-polar-angle-axis"},r&&this.renderAxisLine(),this.renderTicks()):null}}],r=[{key:"renderTickItem",value:function(e,t,n){return l.isValidElement(e)?l.cloneElement(e,t):d()(e)?e(t):l.createElement(E.x,L({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],n&&C(i.prototype,n),r&&C(i,r),Object.defineProperty(i,"prototype",{writable:!1}),i}(l.PureComponent);_(B,"displayName","PolarAngleAxis"),_(B,"axisType","angleAxis"),_(B,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var K=n(35802),V=n.n(K),z=n(37891),$=n.n(z),H=n(26680),q=["cx","cy","angle","ticks","axisLine"],G=["ticks","tick","angle","tickFormatter","stroke"];function Y(e){return(Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Q(e,t){for(var n=0;n0?ec()(e,"paddingAngle",0):0;if(n){var c=(0,eh.k4)(n.endAngle-n.startAngle,e.endAngle-e.startAngle),l=ek(ek({},e),{},{startAngle:i+a,endAngle:i+c(r)+a});o.push(l),i=l.endAngle}else{var s=e.endAngle,p=e.startAngle,f=(0,eh.k4)(0,s-p)(r),d=ek(ek({},e),{},{startAngle:i+a,endAngle:i+f+a});o.push(d),i=d.endAngle}}),l.createElement(y.m,null,e.renderSectorsStatically(o))})}},{key:"attachKeyboardHandlers",value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case"ArrowLeft":var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case"ArrowRight":var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case"Escape":t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return n&&t&&t.length&&(!r||!es()(r,t))?this.renderSectorsWithAnimation():this.renderSectorsStatically(t)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,o=t.className,i=t.label,a=t.cx,c=t.cy,s=t.innerRadius,u=t.outerRadius,p=t.isAnimationActive,f=this.state.isAnimationFinished;if(n||!r||!r.length||!(0,eh.hj)(a)||!(0,eh.hj)(c)||!(0,eh.hj)(s)||!(0,eh.hj)(u))return null;var d=(0,h.Z)("recharts-pie",o);return l.createElement(y.m,{tabIndex:this.props.rootTabIndex,className:d,ref:function(t){e.pieRef=t}},this.renderSectors(),i&&this.renderLabels(r),H._.renderCallByParent(this.props,null,!1),(!p||f)&&ed.e.renderCallByParent(this.props,r,!1))}}],r=[{key:"getDerivedStateFromProps",value:function(e,t){return t.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors!==t.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,t){return e>t?"start":e=360?A:A-1)*u,x=i.reduce(function(e,t){var n=(0,ev.F$)(t,g,0);return e+((0,eh.hj)(n)?n:0)},0);return x>0&&(t=i.map(function(e,t){var r,o=(0,ev.F$)(e,g,0),i=(0,ev.F$)(e,f,t),a=((0,eh.hj)(o)?o:0)/x,s=(r=t?n.endAngle+(0,eh.uY)(v)*u*(0!==o?1:0):l)+(0,eh.uY)(v)*((0!==o?m:0)+a*O),p=(r+s)/2,d=(h.innerRadius+h.outerRadius)/2,b=[{name:i,value:o,payload:e,dataKey:g,type:y}],A=(0,T.op)(h.cx,h.cy,d,p);return n=ek(ek(ek({percent:a,cornerRadius:c,name:i,tooltipPayload:b,midAngle:p,middleRadius:d,tooltipPosition:A},e),h),{},{value:(0,ev.F$)(e,g),startAngle:r,endAngle:s,payload:e,paddingAngle:(0,eh.uY)(v)*u})})),ek(ek({},h),{},{sectors:t,data:i})});var eL=(0,p.z)({chartName:"PieChart",GraphicalChild:eR,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:B},{axisType:"radiusAxis",AxisComp:eo}],formatAxisMap:T.t9,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),eN=n(8147),eI=n(69448),eC=n(98593);let eD=e=>{let{active:t,payload:n,valueFormatter:r}=e;if(t&&(null==n?void 0:n[0])){let e=null==n?void 0:n[0];return l.createElement(eC.$B,null,l.createElement("div",{className:(0,a.q)("px-4 py-2")},l.createElement(eC.zX,{value:r(e.value),name:e.name,color:e.payload.color})))}return null},eF=(e,t)=>e.map((e,n)=>{let r=ne||t((0,c.vP)(n.map(e=>e[r]))),eZ=e=>{let{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c}=e;return l.createElement("g",null,l.createElement(s.L,{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c,fill:"",opacity:.3,style:{outline:"none"}}))},eM=l.forwardRef((e,t)=>{let{data:n=[],category:s="value",index:p="name",colors:f=i.s,variant:d="donut",valueFormatter:y=c.Cj,label:m,showLabel:h=!0,animationDuration:v=900,showAnimation:b=!1,showTooltip:g=!0,noDataText:A,onValueChange:O,customTooltip:x,className:k}=e,j=(0,r._T)(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),w="donut"==d,P=e_(m,y,n,s),[E,S]=l.useState(void 0),T=!!O;return(0,l.useEffect)(()=>{let e=document.querySelectorAll(".recharts-pie-sector");e&&e.forEach(e=>{e.setAttribute("style","outline: none")})},[E]),l.createElement("div",Object.assign({ref:t,className:(0,a.q)("w-full h-40",k)},j),l.createElement(u.h,{className:"h-full w-full"},(null==n?void 0:n.length)?l.createElement(eL,{onClick:T&&E?()=>{S(void 0),null==O||O(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},h&&w?l.createElement("text",{className:(0,a.q)("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},P):null,l.createElement(eR,{className:(0,a.q)("stroke-tremor-background dark:stroke-dark-tremor-background",O?"cursor-pointer":"cursor-default"),data:eF(n,f),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:w?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:s,nameKey:p,isAnimationActive:b,animationDuration:v,onClick:function(e,t,n){n.stopPropagation(),T&&(E===t?(S(void 0),null==O||O(null)):(S(t),null==O||O(Object.assign({eventType:"slice"},e.payload.payload))))},activeIndex:E,inactiveShape:eZ,style:{outline:"none"}}),l.createElement(eN.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:g?e=>{var t;let{active:n,payload:r}=e;return x?l.createElement(x,{payload:null==r?void 0:r.map(e=>{var t,n,i;return Object.assign(Object.assign({},e),{color:null!==(i=null===(n=null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.payload)||void 0===n?void 0:n.color)&&void 0!==i?i:o.fr.Gray})}),active:n,label:null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.name}):l.createElement(eD,{active:n,payload:r,valueFormatter:y})}:l.createElement(l.Fragment,null)})):l.createElement(eI.Z,{noDataText:A})))});eM.displayName="DonutChart"},7366:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(41154),o=n(25721),i=n(55463),a=n(99735),c=n(7656),l=n(47869);function s(e,t){if((0,c.Z)(2,arguments),!t||"object"!==(0,r.Z)(t))return new Date(NaN);var n=t.years?(0,l.Z)(t.years):0,s=t.months?(0,l.Z)(t.months):0,u=t.weeks?(0,l.Z)(t.weeks):0,p=t.days?(0,l.Z)(t.days):0,f=t.hours?(0,l.Z)(t.hours):0,d=t.minutes?(0,l.Z)(t.minutes):0,y=t.seconds?(0,l.Z)(t.seconds):0,m=(0,a.Z)(e),h=s||n?(0,i.Z)(m,s+12*n):m;return new Date((p||u?(0,o.Z)(h,p+7*u):h).getTime()+1e3*(y+60*(d+60*f)))}},35802:function(e,t,n){var r=n(67646),o=n(58905),i=n(88157);e.exports=function(e,t){return e&&e.length?r(e,i(t,2),o):void 0}},37891:function(e,t,n){var r=n(67646),o=n(88157),i=n(20121);e.exports=function(e,t){return e&&e.length?r(e,o(t,2),i):void 0}},58710:function(e,t,n){"use strict";var r=n(2265);let o=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js b/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js deleted file mode 100644 index 77e6671ad7..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[131],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return c.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return o.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),o=a(69552),c=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},80443:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914);t.Z=()=>{var e,t,a,i,o,c,d;let u=(0,r.useRouter)(),m="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{m||u.replace("/sso/key/generate")},[m,u]);let g=(0,s.useMemo)(()=>{if(!m)return null;try{return(0,l.o)(m)}catch(e){return(0,n.b)(),u.replace("/sso/key/generate"),null}},[m,u]);return{token:m,accessToken:null!==(e=null==g?void 0:g.key)&&void 0!==e?e:null,userId:null!==(t=null==g?void 0:g.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==g?void 0:g.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(i=null==g?void 0:g.user_role)&&void 0!==i?i:null),premiumUser:null!==(o=null==g?void 0:g.premium_user)&&void 0!==o?o:null,disabledPersonalKeyCreation:null!==(c=null==g?void 0:g.disabled_non_admin_personal_key_creation)&&void 0!==c?c:null,showSSOBanner:(null==g?void 0:g.login_method)==="username_password"}}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},O0:function(){return r},PA:function(){return c},RD:function(){return i},Z3:function(){return o},_3:function(){return d}});let s="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),o=e=>e.map(e=>n[e]||e),c=e=>e.map(e=>i[e]||e),d=e=>r.find(t=>t.id===e)},51601:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,g]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(o,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);g(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[o,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:c,onChange:t,value:a,loading:p,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(o){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(o),(0,n.fetchMCPAccessGroups)(o)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),p(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[o]);let f=[...g.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:e=>{t({servers:e.filter(e=>!g.includes(e)),accessGroups:e.filter(e=>g.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(87908),o=a(61994),c=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){p([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));p(s)}catch(e){console.error("Error fetching MCP servers:",e),p([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{g.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[g]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:g.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(c.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(o.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:o,...c}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:o,...c})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(52787),l=a(89970),n=a(23496),i=a(15424),o=a(20831),c=a(12514),d=a(49566),u=a(91777),m=a(82182),g=a(22452),p=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let o=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(o).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(o).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(o.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:g.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(c.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(o.Z,{variant:"light",onClick:()=>N(t),icon:p.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){p(!0);try{let e=await (0,n.vectorStoreListCall)(o);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[o]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:t,value:a,loading:g,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e)}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/131-d505623ce13e3958.js b/litellm/proxy/_experimental/out/_next/static/chunks/131-d505623ce13e3958.js new file mode 100644 index 0000000000..adb625f3c8 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/131-d505623ce13e3958.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[131],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return c.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return o.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),o=a(69552),c=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},80443:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914);t.Z=()=>{var e,t,a,i,o,c,d;let u=(0,r.useRouter)(),m="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{m||u.replace("/sso/key/generate")},[m,u]);let g=(0,s.useMemo)(()=>{if(!m)return null;try{return(0,l.o)(m)}catch(e){return(0,n.b)(),u.replace("/sso/key/generate"),null}},[m,u]);return{token:m,accessToken:null!==(e=null==g?void 0:g.key)&&void 0!==e?e:null,userId:null!==(t=null==g?void 0:g.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==g?void 0:g.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(i=null==g?void 0:g.user_role)&&void 0!==i?i:null),premiumUser:null!==(o=null==g?void 0:g.premium_user)&&void 0!==o?o:null,disabledPersonalKeyCreation:null!==(c=null==g?void 0:g.disabled_non_admin_personal_key_creation)&&void 0!==c?c:null,showSSOBanner:(null==g?void 0:g.login_method)==="username_password"}}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},O0:function(){return r},PA:function(){return c},RD:function(){return i},Z3:function(){return o},_3:function(){return d}});let s="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),o=e=>e.map(e=>n[e]||e),c=e=>e.map(e=>i[e]||e),d=e=>r.find(t=>t.id===e)},51601:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,g]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(o,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);g(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[o,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:c,onChange:t,value:a,loading:p,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(o){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(o),(0,n.fetchMCPAccessGroups)(o)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),p(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[o]);let f=[...g.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:e=>{t({servers:e.filter(e=>!g.includes(e)),accessGroups:e.filter(e=>g.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(87908),o=a(4156),c=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){p([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));p(s)}catch(e){console.error("Error fetching MCP servers:",e),p([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{g.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[g]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:g.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(c.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(o.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:o,...c}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:o,...c})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(52787),l=a(89970),n=a(23496),i=a(15424),o=a(20831),c=a(12514),d=a(49566),u=a(91777),m=a(82182),g=a(22452),p=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let o=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(o).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(o).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(o.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:g.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(c.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(o.Z,{variant:"light",onClick:()=>N(t),icon:p.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){p(!0);try{let e=await (0,n.vectorStoreListCall)(o);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[o]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:t,value:a,loading:g,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e)}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1486-75f734aab34a8112.js b/litellm/proxy/_experimental/out/_next/static/chunks/1486-75f734aab34a8112.js deleted file mode 100644 index fdf73cd3d0..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1486-75f734aab34a8112.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1486],{12660:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"},i=r(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},5540:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},i=r(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},78355:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},i=r(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},8881:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},i=r(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},35291:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},i=r(55015),l=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},59664:function(e,t,r){"use strict";r.d(t,{Z:function(){return S}});var n=r(5853),o=r(2265),a=r(47625),i=r(93765),l=r(54061),s=r(97059),c=r(62994),u=r(25311),d=(0,i.z)({chartName:"LineChart",GraphicalChild:l.x,axisComponents:[{axisType:"xAxis",AxisComp:s.K},{axisType:"yAxis",AxisComp:c.B}],formatAxisMap:u.t9}),p=r(56940),m=r(8147),f=r(22190),h=r(81889),g=r(65278),v=r(98593),y=r(69448),b=r(32644),k=r(7084),x=r(26898),w=r(97324),C=r(1153);let S=o.forwardRef((e,t)=>{let{data:r=[],categories:i=[],index:u,colors:S=x.s,valueFormatter:E=C.Cj,startEndOnly:_=!1,showXAxis:O=!0,showYAxis:j=!0,yAxisWidth:z=56,intervalType:N="equidistantPreserveStart",animationDuration:T=900,showAnimation:L=!1,showTooltip:Z=!0,showLegend:P=!0,showGridLines:R=!0,autoMinValue:F=!1,curveType:M="linear",minValue:A,maxValue:B,connectNulls:I=!1,allowDecimals:q=!0,noDataText:D,className:W,onValueChange:V,enableLegendSlider:K=!1,customTooltip:H,rotateLabelX:G,tickGap:Y=5}=e,X=(0,n._T)(e,["data","categories","index","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","tickGap"]),U=O||j?20:0,[$,Q]=(0,o.useState)(60),[J,ee]=(0,o.useState)(void 0),[et,er]=(0,o.useState)(void 0),en=(0,b.me)(i,S),eo=(0,b.i4)(F,A,B),ea=!!V;function ei(e){ea&&(e===et&&!J||(0,b.FB)(r,e)&&J&&J.dataKey===e?(er(void 0),null==V||V(null)):(er(e),null==V||V({eventType:"category",categoryClicked:e})),ee(void 0))}return o.createElement("div",Object.assign({ref:t,className:(0,w.q)("w-full h-80",W)},X),o.createElement(a.h,{className:"h-full w-full"},(null==r?void 0:r.length)?o.createElement(d,{data:r,onClick:ea&&(et||J)?()=>{ee(void 0),er(void 0),null==V||V(null)}:void 0},R?o.createElement(p.q,{className:(0,w.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,o.createElement(s.K,{padding:{left:U,right:U},hide:!O,dataKey:u,interval:_?"preserveStartEnd":N,tick:{transform:"translate(0, 6)"},ticks:_?[r[0][u],r[r.length-1][u]]:void 0,fill:"",stroke:"",className:(0,w.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,minTickGap:Y,angle:null==G?void 0:G.angle,dy:null==G?void 0:G.verticalShift,height:null==G?void 0:G.xAxisHeight}),o.createElement(c.B,{width:z,hide:!j,axisLine:!1,tickLine:!1,type:"number",domain:eo,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,w.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:E,allowDecimals:q}),o.createElement(m.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:Z?e=>{let{active:t,payload:r,label:n}=e;return H?o.createElement(H,{payload:null==r?void 0:r.map(e=>{var t;return Object.assign(Object.assign({},e),{color:null!==(t=en.get(e.dataKey))&&void 0!==t?t:k.fr.Gray})}),active:t,label:n}):o.createElement(v.ZP,{active:t,payload:r,label:n,valueFormatter:E,categoryColors:en})}:o.createElement(o.Fragment,null),position:{y:0}}),P?o.createElement(f.D,{verticalAlign:"top",height:$,content:e=>{let{payload:t}=e;return(0,g.Z)({payload:t},en,Q,et,ea?e=>ei(e):void 0,K)}}):null,i.map(e=>{var t;return o.createElement(l.x,{className:(0,w.q)((0,C.bM)(null!==(t=en.get(e))&&void 0!==t?t:k.fr.Gray,x.K.text).strokeColor),strokeOpacity:J||et&&et!==e?.3:1,activeDot:e=>{var t;let{cx:n,cy:a,stroke:i,strokeLinecap:l,strokeLinejoin:s,strokeWidth:c,dataKey:u}=e;return o.createElement(h.o,{className:(0,w.q)("stroke-tremor-background dark:stroke-dark-tremor-background",V?"cursor-pointer":"",(0,C.bM)(null!==(t=en.get(u))&&void 0!==t?t:k.fr.Gray,x.K.text).fillColor),cx:n,cy:a,r:5,fill:"",stroke:i,strokeLinecap:l,strokeLinejoin:s,strokeWidth:c,onClick:(t,n)=>{n.stopPropagation(),ea&&(e.index===(null==J?void 0:J.index)&&e.dataKey===(null==J?void 0:J.dataKey)||(0,b.FB)(r,e.dataKey)&&et&&et===e.dataKey?(er(void 0),ee(void 0),null==V||V(null)):(er(e.dataKey),ee({index:e.index,dataKey:e.dataKey}),null==V||V(Object.assign({eventType:"dot",categoryClicked:e.dataKey},e.payload))))}})},dot:t=>{var n;let{stroke:a,strokeLinecap:i,strokeLinejoin:l,strokeWidth:s,cx:c,cy:u,dataKey:d,index:p}=t;return(0,b.FB)(r,e)&&!(J||et&&et!==e)||(null==J?void 0:J.index)===p&&(null==J?void 0:J.dataKey)===e?o.createElement(h.o,{key:p,cx:c,cy:u,r:5,stroke:a,fill:"",strokeLinecap:i,strokeLinejoin:l,strokeWidth:s,className:(0,w.q)("stroke-tremor-background dark:stroke-dark-tremor-background",V?"cursor-pointer":"",(0,C.bM)(null!==(n=en.get(d))&&void 0!==n?n:k.fr.Gray,x.K.text).fillColor)}):o.createElement(o.Fragment,{key:p})},key:e,name:e,type:M,dataKey:e,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:L,animationDuration:T,connectNulls:I})}),V?i.map(e=>o.createElement(l.x,{className:(0,w.q)("cursor-pointer"),strokeOpacity:0,key:e,name:e,type:M,dataKey:e,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:I,onClick:(e,t)=>{t.stopPropagation();let{name:r}=e;ei(r)}})):null):o.createElement(y.Z,{noDataText:D})))});S.displayName="LineChart"},92858:function(e,t,r){"use strict";r.d(t,{Z:function(){return N}});var n=r(5853),o=r(2265),a=r(62963),i=r(90945),l=r(13323),s=r(17684),c=r(80004),u=r(93689),d=r(38198),p=r(47634),m=r(56314),f=r(27847),h=r(64518);let g=(0,o.createContext)(null),v=Object.assign((0,f.yV)(function(e,t){let r=(0,s.M)(),{id:n="headlessui-description-".concat(r),...a}=e,i=function e(){let t=(0,o.useContext)(g);if(null===t){let t=Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}return t}(),l=(0,u.T)(t);(0,h.e)(()=>i.register(n),[n,i.register]);let c={ref:l,...i.props,id:n};return(0,f.sY)({ourProps:c,theirProps:a,slot:i.slot||{},defaultTag:"p",name:i.name||"Description"})}),{});var y=r(37388);let b=(0,o.createContext)(null),k=Object.assign((0,f.yV)(function(e,t){let r=(0,s.M)(),{id:n="headlessui-label-".concat(r),passive:a=!1,...i}=e,l=function e(){let t=(0,o.useContext)(b);if(null===t){let t=Error("You used a