Skip to content

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

fix: remove redundant import os, use Path().name instead

Chesarsd7c253213702
diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.py
index 12447b39e1e..3e639e79b6d 100644
--- a/litellm/litellm_core_utils/prompt_templates/common_utils.py
+++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py
@@ -5,7 +5,6 @@ Common utility functions used for translating messages across providers
import io
import mimetypes
import re
-import os
from os import PathLike
from pathlib import Path
from typing import (
@@ -647,7 +646,7 @@ def extract_file_data(file_data: FileTypes) -> ExtractedFileData:
# If it's a file-like object
# Try to get filename from file handle if not already set
if not filename and hasattr(file_content, 'name'):
- filename = os.path.basename(file_content.name)
+ filename = Path(file_content.name).name
content = file_content.read()