Skip to main content

llm-router-utils

Lightweight extraction of sglang's reasoning parser, tool-call parser, and chat template rendering, for use in custom router services and lightweight LLM applications.

This library does not include any inference engine code. It only provides the "frontend" message processing pipeline: OpenAIServingChat._process_messages and its dependencies.

Upstream source: sglang release/v0.5.16.

Usage

from llm_router_utils.sglang.srt.configs.model_config import ModelConfig
from llm_router_utils.sglang.srt.managers.tokenizer_manager import TokenizerManager
from llm_router_utils.sglang.srt.parser.template_manager import TemplateManager
from llm_router_utils.sglang.srt.entrypoints.openai.serving_chat import OpenAIServingChat
from llm_router_utils.sglang.srt.server_args import ServerArgs, PortArgs

server_args = ServerArgs(model_path="Qwen/Qwen3-32B", tool_call_parser="qwen3_coder")
port_args = PortArgs()
tokenizer_manager = TokenizerManager(server_args, port_args)
template_manager = TemplateManager()
template_manager.initialize_templates(
    tokenizer_manager=tokenizer_manager,
    model_path=server_args.model_path,
    chat_template=server_args.chat_template,
)
openai_serving_chat = OpenAIServingChat(tokenizer_manager, template_manager)
result = openai_serving_chat._process_messages(request, is_multimodal=False)

License

Apache 2.0, adapted from sglang.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_router_utils-0.1.0.tar.gz (197.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_router_utils-0.1.0-py3-none-any.whl (248.2 kB view details)

Uploaded Python 3

File details

Details for the file llm_router_utils-0.1.0.tar.gz.

File metadata

  • Download URL: llm_router_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 197.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for llm_router_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e394696ca4ca46b60b08e504bae9328edf2f24cdd3af84c59b7a905519262d66
MD5 cdbe0df9805f0e93ddbafa6045bcf017
BLAKE2b-256 1e965a7cfeebe9fbbeb461fb7581d764b4e05476fadf1096e86a5e5a7254ad05

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_router_utils-0.1.0.tar.gz:

Publisher: publish.yml on wxsms/llm-router-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_router_utils-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_router_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37a7c62c088b4daaf598c4350efd80f3266a1c6e72bd22ad0abc0ba02919d14e
MD5 e786ff563b848fad405af8226a105e58
BLAKE2b-256 00058ab5371389d33e14c1ba1f2f1c184f93c64d2edcc358c24a7e3b0c508e6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_router_utils-0.1.0-py3-none-any.whl:

Publisher: publish.yml on wxsms/llm-router-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page