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(ovhcloud): Fix tool calling not working (#25948)

Eliasbd145d18e171
diff --git a/litellm/llms/ovhcloud/chat/transformation.py b/litellm/llms/ovhcloud/chat/transformation.py
index 342ad700e00..ae9271ddb16 100644
--- a/litellm/llms/ovhcloud/chat/transformation.py
+++ b/litellm/llms/ovhcloud/chat/transformation.py
@@ -8,9 +8,8 @@ More information on our website: https://endpoints.ai.cloud.ovh.net
from typing import Optional, Union, List
import httpx
-from litellm.utils import ModelResponseStream, _get_model_info_helper
+from litellm.utils import ModelResponseStream
from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
-from litellm._logging import verbose_logger
from litellm.llms.ovhcloud.utils import OVHCloudException
from litellm.llms.base_llm.base_model_iterator import BaseModelResponseIterator
from litellm.llms.base_llm.chat.transformation import BaseLLMException
@@ -22,34 +21,6 @@ class OVHCloudChatConfig(OpenAIGPTConfig):
def custom_llm_provider(self) -> Optional[str]:
return "ovhcloud"
- def get_supported_openai_params(self, model: str) -> list:
- """
- Details about function calling support can be found here:
- https://help.ovhcloud.com/csm/en-gb-public-cloud-ai-endpoints-function-calling?id=kb_article_view&sysparm_article=KB0071907
- """
- supports_function_calling: Optional[bool] = None
- try:
- model_info = _get_model_info_helper(model, custom_llm_provider="ovhcloud")
- supports_function_calling = model_info.get(
- "supports_function_calling", None
- )
- if supports_function_calling is None:
- supports_function_calling = False
- except Exception as e:
- verbose_logger.debug(f"Error getting supported OpenAI params: {e}")
- supports_function_calling = False
-
- optional_params = super().get_supported_openai_params(model)
- if supports_function_calling is not True:
- verbose_logger.debug(
- "You can see our models supporting function_calling in our catalog: https://endpoints.ai.cloud.ovh.net/catalog "
- )
- optional_params.remove("tools")
- optional_params.remove("tool_choice")
- optional_params.remove("function_call")
- optional_params.remove("response_format")
- return optional_params
-
def get_complete_url(
self,
api_base: Optional[str],
diff --git a/tests/test_litellm/llms/ovhcloud/test_ovhcloud_chat_transformation.py b/tests/test_litellm/llms/ovhcloud/test_ovhcloud_chat_transformation.py
index c2d597a28ea..a1b3b31f786 100644
--- a/tests/test_litellm/llms/ovhcloud/test_ovhcloud_chat_transformation.py
+++ b/tests/test_litellm/llms/ovhcloud/test_ovhcloud_chat_transformation.py
@@ -8,6 +8,7 @@ import sys
import pytest
from litellm.llms.ovhcloud.utils import OVHCloudException
+from litellm.utils import get_optional_params
sys.path.insert(
0, os.path.abspath("../../../../..")
@@ -144,6 +145,38 @@ class TestOVHCloudConfig:
assert error.message == "Test error"
assert error.status_code == 400
+ @pytest.mark.parametrize(
+ "model",
+ [
+ "Meta-Llama-3_3-70B-Instruct",
+ "Meta-Llama-3_1-70B-Instruct",
+ "Mixtral-8x7B-Instruct-v0.1",
+ "gpt-oss-120b",
+ "some-model-not-in-the-cost-map",
+ ],
+ )
+ def test_tools_not_filtered_by_static_model_map(self, model):
+ """
+ OVHCloud AI Endpoints are OpenAI-compatible; tools/tool_choice must pass
+ through for any model. The server is responsible for rejecting unsupported
+ tool calls — LiteLLM must not strip them based on a stale static catalog.
+ """
+
+ params = get_optional_params(
+ model=model,
+ custom_llm_provider="ovhcloud",
+ tools=[
+ {
+ "type": "function",
+ "function": {"name": "x", "parameters": {}},
+ }
+ ],
+ tool_choice="auto",
+ )
+
+ assert "tools" in params
+ assert "tool_choice" in params
+
def test_ovhcloud_integration():
import os