The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix ui build and mypy lint
yuneng-jiang866991077346
diff --git a/litellm/llms/openai/chat/gpt_transformation.py b/litellm/llms/openai/chat/gpt_transformation.pyindex 04a10bd7fbe..6cc09dafc2f 100644--- a/litellm/llms/openai/chat/gpt_transformation.py+++ b/litellm/llms/openai/chat/gpt_transformation.py@@ -25,6 +25,7 @@ from litellm.litellm_core_utils.llm_response_utils.convert_dict_to_response impo_handle_invalid_parallel_tool_calls,_should_convert_tool_call_to_json_mode,)+from litellm.litellm_core_utils.core_helpers import map_finish_reasonfrom litellm.litellm_core_utils.prompt_templates.common_utils import get_tool_call_namesfrom litellm.litellm_core_utils.prompt_templates.image_handling import (async_convert_url_to_base64,@@ -586,8 +587,10 @@ class OpenAIGPTConfig(BaseLLMModelInfo, BaseConfig):enhancements=None,)- translated_choice.finish_reason = self._get_finish_reason(- translated_message, choice["finish_reason"]+ translated_choice.finish_reason = map_finish_reason(+ self._get_finish_reason(+ translated_message, choice["finish_reason"]+ ))transformed_choices.append(translated_choice)diff --git a/ui/litellm-dashboard/src/components/CostTrackingSettings/pricing_calculator/multi_cost_results.tsx b/ui/litellm-dashboard/src/components/CostTrackingSettings/pricing_calculator/multi_cost_results.tsxindex 624c297f266..db8c065d18a 100644--- a/ui/litellm-dashboard/src/components/CostTrackingSettings/pricing_calculator/multi_cost_results.tsx+++ b/ui/litellm-dashboard/src/components/CostTrackingSettings/pricing_calculator/multi_cost_results.tsx@@ -181,7 +181,7 @@ const MultiCostResults: React.FC<MultiCostResultsProps> = ({ multiResult, timePetitle: "Model",dataIndex: "model",key: "model",- render: (text: string, record: { id: string; provider?: string | null; error?: string | null; loading?: boolean; hasZeroCost?: boolean }) => (+ render: (text: string, record: { id: string; provider?: string | null; error?: string | null; loading?: boolean; hasZeroCost?: boolean | null }) => (<div className="flex flex-col gap-1"><div className="flex items-center gap-2"><span className="font-medium text-sm">{text}</span>diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsxindex 17cddc3ab16..efcf7504b28 100644--- a/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx+++ b/ui/litellm-dashboard/src/components/playground/llm_calls/chat_completion.tsx@@ -33,7 +33,7 @@ export async function makeOpenAIChatCompletionRequest(// base url should be the current base_urlconst isLocal = process.env.NODE_ENV === "development";if (isLocal !== true) {- console.log = function () {};+ console.log = function () { };}console.log("isLocal:", isLocal);const proxyBaseUrl = customBaseUrl || getProxyBaseUrl();@@ -58,7 +58,7 @@ export async function makeOpenAIChatCompletionRequest(// For collecting complete response textlet fullResponseContent = "";let fullReasoningContent = "";-+// Track MCP metadata from final chunklet mcpMetadata: {mcp_list_tools?: any[];@@ -224,15 +224,15 @@ export async function makeOpenAIChatCompletionRequest(}// Convert mcp_tool_calls and mcp_call_results to MCPEvent[]- if (mcpMetadata.mcp_tool_calls && mcpMetadata.mcp_tool_calls.length > 0) {- mcpMetadata.mcp_tool_calls.forEach((toolCall: any, index: number) => {+ if (mcpMetadata?.mcp_tool_calls && mcpMetadata?.mcp_tool_calls.length > 0) {+ mcpMetadata?.mcp_tool_calls.forEach((toolCall: any, index: number) => {const functionName = toolCall.function?.name || toolCall.name || "";const functionArgs = toolCall.function?.arguments || toolCall.arguments || "{}";-+// Find corresponding result- const result = mcpMetadata.mcp_call_results?.find(+ const result = mcpMetadata?.mcp_call_results?.find((r: any) => r.tool_call_id === toolCall.id || r.tool_call_id === toolCall.call_id- ) || mcpMetadata.mcp_call_results?.[index];+ ) || mcpMetadata?.mcp_call_results?.[index];const callEvent: MCPEvent = {type: "response.output_item.done",