sgl-project--sglang
94057c3d3e
PR Test (NPU) / check-changes (push) Has been cancelled
PR Test (NPU) / pr-gate (push) Has been cancelled
PR Test (NPU) / set-image-config (push) Has been cancelled
PR Test (NPU) / stage-b-test-1-npu-a2 (0) (push) Has been cancelled
PR Test (NPU) / stage-b-test-1-npu-a2 (1) (push) Has been cancelled
PR Test (NPU) / stage-b-test-2-npu-a2 (0) (push) Has been cancelled
PR Test (NPU) / stage-b-test-2-npu-a2 (1) (push) Has been cancelled
PR Test (NPU) / stage-b-test-4-npu-a3 (push) Has been cancelled
PR Test (NPU) / stage-b-test-16-npu-a3 (push) Has been cancelled
PR Test (NPU) / multimodal-gen-test-1-npu-a3 (push) Has been cancelled
PR Test (NPU) / multimodal-gen-test-2-npu-a3 (push) Has been cancelled
PR Test (Arm64) / pr-gate (push) Has been cancelled
PR Test (Arm64) / check-changes (push) Has been cancelled
PR Test (Arm64) / build-test (push) Has been cancelled
PR Test (sgl-router) / gate (push) Has been cancelled
PR Test (sgl-router) / tier-1 — lint (push) Has been cancelled
PR Test (sgl-router) / tier-2 — build + test (push) Has been cancelled
PR Test (sgl-router) / tier-3 — docker (placeholder) (push) Has been cancelled
PR Test (sgl-router) / tier-3 — k8s integration (push) Has been cancelled
PR Test (sgl-router) / tier-3 — e2e (push) Has been cancelled
PR Test (sgl-router) / finish (push) Has been cancelled
PR Test (NPU) / single-node-poc (map[name:qwen3_6_27b_w8a8_1p_in64k_out1k_50ms runner:linux-aarch64-a3-2 test_case:test/registered/ascend/performance/qwen3_6_27b/test_npu_qwen3_6_27b_w8a8_1p_in64k_out1k_50ms.py test_type:perf]) (push) Has been cancelled
PR Test (NPU) / pr-test-npu-finish (push) Has been cancelled
PR Test (Xeon) / pr-gate (push) Has been cancelled
PR Test (Xeon) / check-changes (push) Has been cancelled
PR Test (Xeon) / build-test (, xeon-gnr, base-b-test-cpu) (push) Has been cancelled
PR Test (XPU) / check-changes (push) Has been cancelled
PR Test (XPU) / pr-gate (push) Has been cancelled
PR Test (XPU) / stage-a-test-1-gpu-xpu (push) Has been cancelled
PR Test (XPU) / wait-for-stage-a (push) Has been cancelled
PR Test (XPU) / stage-b-test-1-gpu-xpu (push) Has been cancelled
PR Test (XPU) / finish (push) Has been cancelled
CI Model Inventory / build-inventory (push) Has been cancelled
Lint / lint (push) Has been cancelled
PR Benchmark (SMG Components) / Benchmark Compilation Check (push) Has been cancelled
PR Benchmark (SMG Components) / Benchmark - Manual Policy (push) Has been cancelled
PR Benchmark (SMG Components) / Benchmark - Request Processing (push) Has been cancelled
PR Benchmark (SMG Components) / Benchmark Summary (push) Has been cancelled
PR Test (SMG) / build-wheel (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on windows (x86_64 - auto) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on macos (x86_64 - auto) (push) Has been cancelled
PR Test (SMG) / python-unit-tests (push) Has been cancelled
PR Test (SMG) / unit-tests (push) Has been cancelled
PR Test (SMG) / benchmarks (push) Has been cancelled
PR Test (SMG) / chat-completions (push) Has been cancelled
PR Test (SMG) / chat-completions-4gpu (push) Has been cancelled
PR Test (SMG) / e2e (push) Has been cancelled
PR Test (SMG) / docker-build-test (push) Has been cancelled
PR Test (SMG) / k8s-integration (push) Has been cancelled
PR Test (SMG) / finish (push) Has been cancelled
PR Test (SMG) / summarize-benchmarks (push) Has been cancelled
Release SGLang Model Gateway Docker Image / publish (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on macos (aarch64 - auto) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on linux (aarch64 - auto) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on linux (x86_64 - auto) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on linux (aarch64 - musllinux_1_1) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / build on linux (x86_64 - musllinux_1_1) (push) Has been cancelled
Release SGLang Model Gateway to PyPI / Build SDist (push) Has been cancelled
Release SGLang Model Gateway to PyPI / Upload to PyPI (push) Has been cancelled
Release SGLang Kernels / build-cu129-matrix (aarch64, 12.9, 3.10, arm-kernel-build-node) (push) Has been cancelled
Release SGLang Kernels / build-cu129-matrix (x86_64, 12.9, 3.10, x64-kernel-build-node) (push) Has been cancelled
Release SGLang Kernels / release-cu129 (push) Has been cancelled
Release SGLang Kernels / build-cu130-matrix (aarch64, 13.0, 3.10, arm-kernel-build-node) (push) Has been cancelled
Release SGLang Kernels / build-cu130-matrix (x86_64, 13.0, 3.10, x64-kernel-build-node) (push) Has been cancelled
Release SGLang Kernels / release-cu130 (push) Has been cancelled
Release SGLang Kernels / build-rocm-matrix (3.10, 700) (push) Has been cancelled
Release SGLang Kernels / build-rocm-matrix (3.10, 720) (push) Has been cancelled
Release SGLang Kernels / release-rocm700 (push) Has been cancelled
Release SGLang Kernels / release-rocm720 (push) Has been cancelled
Release SGLang Kernels / build-musa43 (43, 3.10) (push) Has been cancelled
Release SGLang Kernels / release-musa43 (push) Has been cancelled
122 行
5.3 KiB
Django/Jinja
122 行
5.3 KiB
Django/Jinja
{# Copied from https://github.com/vllm-project/vllm/blob/main/examples/tool_chat_template_llama3.1_json.jinja to enable better model response. #}
|
|
{{- bos_token }}
|
|
{%- if custom_tools is defined %}
|
|
{%- set tools = custom_tools %}
|
|
{%- endif %}
|
|
{%- if not tools_in_user_message is defined %}
|
|
{#- Llama 3.1 doesn't pass all tests if the tools are in the system prompt #}
|
|
{%- set tools_in_user_message = true %}
|
|
{%- endif %}
|
|
{%- if not date_string is defined %}
|
|
{%- if strftime_now is defined %}
|
|
{%- set date_string = strftime_now("%d %b %Y") %}
|
|
{%- else %}
|
|
{%- set date_string = "26 Jul 2024" %}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- if not tools is defined %}
|
|
{%- set tools = none %}
|
|
{%- endif %}
|
|
|
|
{#- This block extracts the system message, so we can slot it into the right place. #}
|
|
{%- if messages[0]['role'] == 'system' %}
|
|
{%- if messages[0]['content'] is string %}
|
|
{%- set system_message = messages[0]['content']|trim %}
|
|
{%- else %}
|
|
{%- set system_message = messages[0]['content'][0]['text']|trim %}
|
|
{%- endif %}
|
|
{%- set messages = messages[1:] %}
|
|
{%- else %}
|
|
{%- if tools is not none %}
|
|
{%- set system_message = "You are a helpful assistant with tool calling capabilities. Only reply with a tool call if the function exists in the library provided by the user. If it doesn't exist, just reply directly in natural language. When you receive a tool call response, use the output to format an answer to the original user question." %}
|
|
{%- else %}
|
|
{%- set system_message = "" %}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
{#- System message #}
|
|
{{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
|
|
{%- if tools is not none %}
|
|
{{- "Environment: ipython\n" }}
|
|
{%- endif %}
|
|
{{- "Cutting Knowledge Date: December 2023\n" }}
|
|
{{- "Today Date: " + date_string + "\n\n" }}
|
|
{%- if tools is not none and not tools_in_user_message %}
|
|
{{- "You have access to the following functions. To call a function, please respond with JSON for a function call. " }}
|
|
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. ' }}
|
|
{{- "Do not use variables.\n\n" }}
|
|
{%- for t in tools %}
|
|
{{- t | tojson(indent=4) }}
|
|
{{- "\n\n" }}
|
|
{%- endfor %}
|
|
{%- endif %}
|
|
{{- system_message }}
|
|
{{- "<|eot_id|>" }}
|
|
|
|
{#- Custom tools are passed in a user message with some extra guidance #}
|
|
{%- if tools_in_user_message and not tools is none %}
|
|
{#- Extract the first user message so we can plug it in here #}
|
|
{%- if messages | length != 0 %}
|
|
{%- if messages[0]['content'] is string %}
|
|
{%- set first_user_message = messages[0]['content']|trim %}
|
|
{%- else %}
|
|
{%- set first_user_message = messages[0]['content'] | selectattr('type', 'equalto', 'text') | map(attribute='text') | map('trim') | join('\n') %}
|
|
{%- endif %}
|
|
{%- set messages = messages[1:] %}
|
|
{%- else %}
|
|
{{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
|
|
{%- endif %}
|
|
{{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
|
|
{{- "Given the following functions, please respond with a JSON for a function call " }}
|
|
{{- "with its proper arguments that best answers the given prompt.\n\n" }}
|
|
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. ' }}
|
|
{{- "Do not use variables.\n\n" }}
|
|
{%- for t in tools %}
|
|
{{- t | tojson(indent=4) }}
|
|
{{- "\n\n" }}
|
|
{%- endfor %}
|
|
{{- first_user_message + "<|eot_id|>"}}
|
|
{%- endif %}
|
|
|
|
{%- for message in messages %}
|
|
{%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
|
|
{{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' }}
|
|
{%- if message['content'] is string %}
|
|
{{- message['content'] | trim}}
|
|
{%- else %}
|
|
{%- for content in message['content'] %}
|
|
{%- if content['type'] == 'text' %}
|
|
{{- content['text'] | trim }}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- endif %}
|
|
{{- '<|eot_id|>' }}
|
|
{%- elif 'tool_calls' in message %}
|
|
{%- if not message.tool_calls|length == 1 %}
|
|
{{- raise_exception("This model only supports single tool-calls at once!") }}
|
|
{%- endif %}
|
|
{%- set tool_call = message.tool_calls[0].function %}
|
|
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
|
|
{{- '{"name": "' + tool_call.name + '", ' }}
|
|
{{- '"parameters": ' }}
|
|
{{- tool_call.arguments | tojson }}
|
|
{{- "}" }}
|
|
{{- "<|eot_id|>" }}
|
|
{%- elif message.role == "tool" or message.role == "ipython" %}
|
|
{{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
|
|
{%- if message.content is string %}
|
|
{{- { "output": message.content } | tojson }}
|
|
{%- else %}
|
|
{%- for content in message['content'] %}
|
|
{%- if content['type'] == 'text' %}
|
|
{{- { "output": content['text'] } | tojson }}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- endif %}
|
|
{{- "<|eot_id|>" }}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- if add_generation_prompt %}
|
|
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
|
|
{%- endif %}
|