diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.py index 1ab390f3e38..aa7d6ca1699 100644 --- a/litellm/litellm_core_utils/core_helpers.py +++ b/litellm/litellm_core_utils/core_helpers.py @@ -261,11 +261,6 @@ def remove_index_from_tool_calls( for tool_call in _tool_calls: if isinstance(tool_call, dict) and "index" in tool_call: # Type guard to ensure it's a dict tool_call.pop("index", None) - elif hasattr(tool_call, "index"): - try: - delattr(tool_call, "index") - except Exception: - pass def remove_items_at_indices(items: list[Any] | None, indices: Iterable[int]) -> None: diff --git a/litellm/llms/cohere/chat/v2_transformation.py b/litellm/llms/cohere/chat/v2_transformation.py index 007b05a5af6..c43635f2f5f 100644 --- a/litellm/llms/cohere/chat/v2_transformation.py +++ b/litellm/llms/cohere/chat/v2_transformation.py @@ -170,10 +170,10 @@ class CohereV2ChatConfig(OpenAIGPTConfig): self, model: str, messages: list[AllMessageValues], - optional_params: dict, - litellm_params: dict, - headers: dict, - ) -> dict: + optional_params: dict[str, object], + litellm_params: dict[str, object], + headers: dict[str, object], + ) -> dict[str, object]: data: Final = super().transform_request(model, messages, optional_params, litellm_params, headers) messages_to_send: Final = data.get("messages") if messages_to_send is not None: @@ -185,10 +185,10 @@ class CohereV2ChatConfig(OpenAIGPTConfig): self, model: str, messages: list[AllMessageValues], - optional_params: dict, - litellm_params: dict, - headers: dict, - ) -> dict: + optional_params: dict[str, object], + litellm_params: dict[str, object], + headers: dict[str, object], + ) -> dict[str, object]: data: Final = await super().async_transform_request(model, messages, optional_params, litellm_params, headers) messages_to_send: Final = data.get("messages") if messages_to_send is not None: