From 9be76be1521ec5d1dc2afab628e9a5112801abd2 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Sat, 22 Nov 2025 10:53:48 -0800 Subject: [PATCH] _apply_prompt_template_core --- litellm/llms/watsonx/chat/transformation.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/litellm/llms/watsonx/chat/transformation.py b/litellm/llms/watsonx/chat/transformation.py index 865dc71939d..917f7d89a2b 100644 --- a/litellm/llms/watsonx/chat/transformation.py +++ b/litellm/llms/watsonx/chat/transformation.py @@ -142,7 +142,13 @@ class IBMWatsonXChatConfig(IBMWatsonXMixin, OpenAIGPTConfig): elif WatsonXModelPattern.IBM_MISTRAL.value in model: return mistral_instruct_pt(messages=messages) elif WatsonXModelPattern.GPT_OSS.value in model: - hf_model = model.split("watsonx/")[-1] if "watsonx/" in model else model + # Extract HuggingFace model name from watsonx/ or watsonx_text/ prefix + if "watsonx/" in model: + hf_model = model.split("watsonx/")[-1] + elif "watsonx_text/" in model: + hf_model = model.split("watsonx_text/")[-1] + else: + hf_model = model try: return hf_template_fn(model=hf_model, messages=messages) except Exception: @@ -188,7 +194,13 @@ class IBMWatsonXChatConfig(IBMWatsonXMixin, OpenAIGPTConfig): elif WatsonXModelPattern.IBM_MISTRAL.value in model: return mistral_instruct_pt(messages=messages) elif WatsonXModelPattern.GPT_OSS.value in model: - hf_model = model.split("watsonx/")[-1] if "watsonx/" in model else model + # Extract HuggingFace model name from watsonx/ or watsonx_text/ prefix + if "watsonx/" in model: + hf_model = model.split("watsonx/")[-1] + elif "watsonx_text/" in model: + hf_model = model.split("watsonx_text/")[-1] + else: + hf_model = model try: # Use sync if cached, async if not if hf_model in litellm.known_tokenizer_config: