diff --git a/litellm/litellm_core_utils/streaming_chunk_builder_utils.py b/litellm/litellm_core_utils/streaming_chunk_builder_utils.py index 149bdef7491..26347c85a72 100644 --- a/litellm/litellm_core_utils/streaming_chunk_builder_utils.py +++ b/litellm/litellm_core_utils/streaming_chunk_builder_utils.py @@ -9,9 +9,6 @@ from litellm.types.llms.openai import ( ChatCompletionAssistantContentValue, ChatCompletionAudioDelta, ) -from litellm.litellm_core_utils.openai_tool_name_mapping import ( - restore_openai_tool_name_for_user, -) from litellm.types.utils import ( ChatCompletionAudioResponse, ChatCompletionMessageToolCall, diff --git a/litellm/utils.py b/litellm/utils.py index 8ba9f80db66..c140584132d 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -7918,13 +7918,13 @@ def _maybe_fix_openai_function_tool_name( if tool_type is not None and tool_type != "function": return raw = fn.get("name") - raw_original = str(raw) if raw is not None else "" + raw_original = str(raw) if raw is not None else None base = _sanitize_openai_function_tool_name( str(raw) if raw is not None else "", index ) unique = _make_unique_openai_tool_name(base, used_names) fn["name"] = unique - if unique != raw_original: + if raw_original and unique != raw_original: store_openai_tool_name_mapping(unique, raw_original)