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] TogetherAIConfig.get_supported_openai_params recursion
Yuneng Jiang95e1babf67f6
diff --git a/litellm/llms/together_ai/chat.py b/litellm/llms/together_ai/chat.pyindex e8a784d2779..7efb12fc1b2 100644--- a/litellm/llms/together_ai/chat.py+++ b/litellm/llms/together_ai/chat.py@@ -8,7 +8,7 @@ Docs: https://docs.together.ai/reference/completions-1from typing import Optional-from litellm.utils import get_model_info+from litellm.utils import supports_function_callingfrom litellm._logging import verbose_loggerfrom ..openai.chat.gpt_transformation import OpenAIGPTConfig@@ -21,18 +21,23 @@ class TogetherAIConfig(OpenAIGPTConfig):Docs: https://docs.together.ai/docs/json-mode"""- supports_function_calling: Optional[bool] = None+ # Use supports_function_calling() — which reads _get_model_info_helper+ # directly — instead of get_model_info(). get_model_info() calls+ # get_supported_openai_params() as its first step, which routes back+ # into this method for together_ai models, creating a recursion that+ # only terminates when Python's recursion limit or the "not mapped"+ # exception in _get_model_info_helper is hit (~332 deep calls).+ supports_fc: Optional[bool] = Nonetry:- model_info = get_model_info(model, custom_llm_provider="together_ai")- supports_function_calling = model_info.get(- "supports_function_calling", False+ supports_fc = supports_function_calling(+ model, custom_llm_provider="together_ai")except Exception as e:verbose_logger.debug(f"Error getting supported openai params: {e}")passoptional_params = super().get_supported_openai_params(model)- if supports_function_calling is not True:+ if supports_fc is not True:verbose_logger.debug("Only some together models support function calling/response_format. Docs - https://docs.together.ai/docs/function-calling")diff --git a/tests/llm_translation/test_together_ai.py b/tests/llm_translation/test_together_ai.pyindex 5225ab78f61..4ad0c90230d 100644--- a/tests/llm_translation/test_together_ai.py+++ b/tests/llm_translation/test_together_ai.py@@ -20,7 +20,7 @@ import pytestclass TestTogetherAI(BaseLLMChatTest):def get_base_completion_call_args(self) -> dict:litellm.set_verbose = True- return {"model": "together_ai/Qwen/Qwen3.5-9B"}+ return {"model": "together_ai/Qwen/Qwen2.5-7B-Instruct-Turbo"}def test_tool_call_no_arguments(self, tool_call_no_arguments):"""Test that tool calls with no arguments is translated correctly. Relevant issue: https://github.com/BerriAI/litellm/issues/6833"""diff --git a/tests/local_testing/test_completion.py b/tests/local_testing/test_completion.pyindex f18a2b4afbb..457385a3b0b 100644--- a/tests/local_testing/test_completion.py+++ b/tests/local_testing/test_completion.py@@ -65,7 +65,7 @@ def test_completion_custom_provider_model_name():try:litellm.cache = Noneresponse = completion(- model="together_ai/Qwen/Qwen3.5-9B",+ model="together_ai/Qwen/Qwen2.5-7B-Instruct-Turbo",messages=messages,logger_fn=logger_fn,)@@ -2815,7 +2815,7 @@ def test_customprompt_together_ai():print(litellm.success_callback)print(litellm._async_success_callback)response = completion(- model="together_ai/Qwen/Qwen3.5-9B",+ model="together_ai/Qwen/Qwen2.5-7B-Instruct-Turbo",messages=messages,roles={"system": {@@ -3682,7 +3682,7 @@ def test_completion_together_ai_stream():messages = [{"content": user_message, "role": "user"}]try:response = completion(- model="together_ai/Qwen/Qwen3.5-9B",+ model="together_ai/Qwen/Qwen2.5-7B-Instruct-Turbo",messages=messages,stream=True,max_tokens=5,diff --git a/tests/local_testing/test_multiple_deployments.py b/tests/local_testing/test_multiple_deployments.pyindex 61baa73da04..f7276d4f14e 100644--- a/tests/local_testing/test_multiple_deployments.py+++ b/tests/local_testing/test_multiple_deployments.py@@ -25,7 +25,7 @@ model_list = [{"model_name": "mistral-7b-instruct","litellm_params": { # params for litellm completion/embedding call- "model": "together_ai/Qwen/Qwen3.5-9B",+ "model": "together_ai/Qwen/Qwen2.5-7B-Instruct-Turbo","api_key": os.getenv("TOGETHERAI_API_KEY"),},},diff --git a/tests/local_testing/test_text_completion.py b/tests/local_testing/test_text_completion.pyindex dde5f67ea1c..ace5fed1100 100644--- a/tests/local_testing/test_text_completion.py+++ b/tests/local_testing/test_text_completion.py@@ -4034,7 +4034,7 @@ def test_async_text_completion_together_ai():async def test_get_response():try:response = await litellm.atext_completion(- model="together_ai/Qwen/Qwen3.5-9B",+ model="together_ai/Qwen/Qwen2.5-7B-Instruct-Turbo",prompt="good morning",max_tokens=10,)