Instructions to use ServiceNow-AI/SuperApriel-15B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ServiceNow-AI/SuperApriel-15B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ServiceNow-AI/SuperApriel-15B-Instruct", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModelForImageTextToText model = AutoModelForImageTextToText.from_pretrained("ServiceNow-AI/SuperApriel-15B-Instruct", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ServiceNow-AI/SuperApriel-15B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ServiceNow-AI/SuperApriel-15B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ServiceNow-AI/SuperApriel-15B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ServiceNow-AI/SuperApriel-15B-Instruct
- SGLang
How to use ServiceNow-AI/SuperApriel-15B-Instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ServiceNow-AI/SuperApriel-15B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ServiceNow-AI/SuperApriel-15B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ServiceNow-AI/SuperApriel-15B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ServiceNow-AI/SuperApriel-15B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ServiceNow-AI/SuperApriel-15B-Instruct with Docker Model Runner:
docker model run hf.co/ServiceNow-AI/SuperApriel-15B-Instruct
| {# ---------------------------------------------------------------------- #} | |
| {# ƛƬ Default setup and flags #} | |
| {# ---------------------------------------------------------------------- #} | |
| {%- set messages = messages or [] -%} | |
| {%- set tools = tools or [] -%} | |
| {%- set add_generation_prompt = add_generation_prompt or false -%} | |
| {%- set available_tool_string, add_tool_id = '', true -%} | |
| {%- set add_thoughts = false -%} {# whether to include <thinking> reasoning blocks #} | |
| {%- set add_generation_prompt = true -%} {# whether to emit reasoning starter before assistant response #} | |
| {# Optional token placeholders (safe defaults) #} | |
| {%- set bos_token = bos_token if (bos_token is defined) else '' -%} | |
| {%- set eos_token = eos_token if (eos_token is defined) else '' -%} | |
| {# ---------------------------------------------------------------------- #} | |
| {# Core reasoning prompt and assistant reasoning prefix #} | |
| {# ---------------------------------------------------------------------- #} | |
| {%- set reasoning_prompt = | |
| 'You are a thoughtful, systematic AI assistant from ServiceNow Language Models (SLAM) lab. ' | |
| 'Analyze each question carefully, present your reasoning step-by-step, then provide the final ' | |
| 'response after the marker [BEGIN FINAL RESPONSE].' | |
| -%} | |
| {%- set reasoning_asst_turn_start = 'Here are my reasoning steps:\n' -%} | |
| {# ---------------------------------------------------------------------- #} | |
| {# Tool list and tool call output format #} | |
| {# ---------------------------------------------------------------------- #} | |
| {%- if tools is not none and tools|length > 0 -%} | |
| {%- set available_tool_string -%} | |
| You are provided with function signatures within <available_tools></available_tools> XML tags. | |
| You may call one or more functions to assist with the user query. | |
| Don't make assumptions about the arguments. You should infer the argument values from previous | |
| user responses and the system message. | |
| Here are the available tools: | |
| <available_tools> | |
| {% for tool in tools %}{{ tool|string }}{% endfor %} | |
| </available_tools>. | |
| Return all function calls as a list of JSON objects within <tool_calls></tool_calls> XML tags. | |
| Each JSON object should contain a function name and arguments as follows: | |
| <tool_calls>[ | |
| {"name": <function-name-1>, "arguments": <args-dict-1>}, | |
| {"name": <function-name-2>, "arguments": <args-dict-2>}, | |
| ... | |
| ]</tool_calls> | |
| {%- endset -%} | |
| {%- endif -%} | |
| {# ---------------------------------------------------------------------- #} | |
| {# Start system block if first message is not system #} | |
| {# ---------------------------------------------------------------------- #} | |
| {%- if messages|length > 0 and messages[0]['role'] != 'system' -%} | |
| {%- if tools is not none and tools|length > 0 -%} | |
| {{ bos_token + '<|begin_system|>\n' + reasoning_prompt + '\n' + available_tool_string + '\n' }} | |
| {%- else -%} | |
| {{ bos_token + '<|begin_system|>\n' + reasoning_prompt + '\n' }} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {# ---------------------------------------------------------------------- #} | |
| {# Iterate through messages #} | |
| {# ---------------------------------------------------------------------- #} | |
| {%- for message in messages -%} | |
| {# ---------------- USER MESSAGE ---------------- #} | |
| {%- if message['role'] == 'user' -%} | |
| {{ '<|begin_user|>\n' }} | |
| {%- if message['content'] is not string -%} | |
| {%- for chunk in message['content'] -%} | |
| {%- if chunk['type'] == 'text' -%} | |
| {{ chunk['text'] }} | |
| {%- elif chunk['type'] in ['image', 'image_url'] -%} | |
| {{ '[IMG]' }} | |
| {%- else -%} | |
| {{ raise_exception('Unrecognized content type!') }} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- else -%} | |
| {{ message['content'] }} | |
| {%- endif -%} | |
| {# ---------------- SYSTEM MESSAGE ---------------- #} | |
| {%- elif message['role'] == 'system' -%} | |
| {%- if message['content'] is not none and message['content']|length > 0 -%} | |
| {%- if message['content'] is string -%} | |
| {%- set system_message = message['content'] -%} | |
| {%- else -%} | |
| {%- set system_message = message['content'][0]['text'] -%} | |
| {%- endif -%} | |
| {%- else -%} | |
| {%- set system_message = '' -%} | |
| {%- endif -%} | |
| {%- if tools is not none and tools|length > 0 -%} | |
| {{ bos_token + '<|begin_system|>\n' + reasoning_prompt + '\n' + system_message + '\n' + available_tool_string + '\n' }} | |
| {%- else -%} | |
| {{ bos_token + '<|begin_system|>\n' + reasoning_prompt + '\n' + system_message + '\n' }} | |
| {%- endif -%} | |
| {# ---------------- ASSISTANT MESSAGE ---------------- #} | |
| {%- elif message['role'] == 'assistant' -%} | |
| {%- if loop.last -%} | |
| {%- set add_tool_id = false -%} | |
| {%- endif -%} | |
| {{ '\n<|begin_assistant|>\n' }} | |
| {%- if add_thoughts and 'thought' in message and message['thought'] is not none -%} | |
| <thinking>{{ message['thought'] }}</thinking> | |
| {%- endif -%} | |
| {%- if message['content'] is not none and message['content']|length > 0 -%} | |
| {%- if message['content'] is not string -%} | |
| {{ message['content'][0]['text'] }} | |
| {%- else -%} | |
| {{ message['content'] }} | |
| {%- endif -%} | |
| {%- elif message['chosen'] is not none and message['chosen']|length > 0 -%} | |
| {{ message['chosen'][0] }} | |
| {%- endif -%} | |
| {# Tool call output #} | |
| {%- if message['tool_calls'] is not none and message['tool_calls']|length > 0 -%} | |
| {{ '\n<tool_calls>[' }} | |
| {%- for tool_call in message['tool_calls'] -%} | |
| {{ '{"name": "' + tool_call['function']['name'] + '", "arguments": ' + tool_call['function']['arguments']|string }} | |
| {%- if add_tool_id == true and 'id' in tool_call -%} | |
| {{ ', "id": "' + tool_call['id'] + '"' }} | |
| {%- endif -%} | |
| {{ '}' }} | |
| {%- if not loop.last -%}{{ ', ' }}{%- endif -%} | |
| {%- endfor -%} | |
| {{ ']</tool_calls>' }} | |
| {%- endif -%} | |
| {%- if not loop.last or training_prompt -%} | |
| {{ '\n<|end|>\n' }} | |
| {%- endif -%} | |
| {# ---------------- TOOL RESULT MESSAGE ---------------- #} | |
| {%- elif message['role'] == 'tool' -%} | |
| {%- if message['content'] is string -%} | |
| {%- set tool_message = message['content'] -%} | |
| {%- else -%} | |
| {%- set tool_message = message['content'][0]['text'] -%} | |
| {%- endif -%} | |
| {{ '<|begin_tool_result|>\n' + tool_message|string + '\n' }} | |
| {# ---------------- CONTENT MESSAGE ---------------- #} | |
| {%- elif message['role'] == 'content' -%} | |
| {%- if message['content'] is not string -%} | |
| {{ '<|begin_content|>\n' + message['content'][0]['text'] + '\n' }} | |
| {%- else -%} | |
| {{ '<|begin_content|>\n' + message['content'] + '\n' }} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {# ---------------- REASONING PROMPT BEFORE NEXT ASSISTANT ---------------- #} | |
| {%- if loop.last and add_generation_prompt and message['role'] != 'assistant' -%} | |
| {{ '\n<|begin_assistant|>\n' + reasoning_asst_turn_start }} | |
| {%- endif -%} | |
| {%- endfor -%} |