litellm/tests/llm_translation/test_together_ai.py
Yuneng Jiang 515bf8c9d5 refactor(test): validate cost-map entries into a typed model
The selector read raw cost-map dicts as `Mapping[str, Any]`. It now validates
each together_ai entry into a frozen Pydantic model and takes the two
capabilities as keyword booleans, so nothing in the helper is coarsely typed
or stringly addressed.
2026-09-16 14:32:08 -07:00

45 lines
1.4 KiB
Python

"""
Test TogetherAI LLM
"""
from base_llm_unit_tests import BaseLLMChatTest
from tests._live_test_helpers import cheapest_together_chat_model
import json
import os
from datetime import datetime
from unittest.mock import AsyncMock
import litellm
import pytest
class TestTogetherAI(BaseLLMChatTest):
def get_base_completion_call_args(self) -> dict:
litellm.set_verbose = True
return {
"model": cheapest_together_chat_model(
function_calling=True, response_schema=True
)
}
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"""
pass
@pytest.mark.parametrize(
"model",
[
"meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
"nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
],
)
def test_get_supported_response_format_together_ai(self, model: str) -> None:
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
litellm.model_cost = litellm.get_model_cost_map(url="")
optional_params = litellm.get_supported_openai_params(
model, custom_llm_provider="together_ai"
)
assert isinstance(optional_params, list)
assert "response_format" in optional_params
assert "tools" in optional_params