def test_get_model_name():
    """Test different model name formats are properly handled."""
    with (
        patch("llama_index.llms.openai.responses.SyncOpenAI"),
        patch("llama_index.llms.openai.responses.AsyncOpenAI"),
    ):
        # Standard model
        llm = OpenAIResponses(model="gpt-4o-mini")
        assert llm._get_model_name() == "gpt-4o-mini"

        # Legacy fine-tuning format
        llm = OpenAIResponses(model="ft-model:gpt-4")
        assert llm._get_model_name() == "ft-model"

        # New fine-tuning format
        llm = OpenAIResponses(model="ft:gpt-4:org:custom:id")
        assert llm._get_model_name() == "gpt-4"
Test different model name formats are properly handled.
llama-index-integrations/llms/llama-index-llms-openai/tests/test_openai_responses.py