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]

_apply_prompt_template_core

Ishaan Jaffer9be76be1521e
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: