One vLLM plugin for transparent RAIF token savings — install it and existing OpenAI clients get RAIF on tools & response_format with no proxy and no client changes.
Project description
raif-vllm
One vLLM plugin for transparent RAIF token savings. Install it and existing
OpenAI clients get RAIF on tools and response_format — no proxy, no client
changes, no vLLM fork. The fine-tuned model emits compact RAIF-G; the plugin
decodes it to JSON at the request/response boundary.
Install
raif-vllm is not yet on PyPI; install it from the repo (it pulls
raif-format >=0.6 from PyPI
automatically):
pip install "raif-vllm @ git+https://github.com/skrrt-sh/raif-vllm.git"
# or, from a checkout: pip install -e .
vLLM itself is provided by the serving host (it pins CUDA/torch); target
vllm>=0.19,<0.20 — v0.19 is the last CUDA-12 vLLM and carries the hooks the
plugin needs. pip install "raif-vllm[vllm]" pulls a compatible engine for local
experiments.
Serve
VLLM_PLUGINS=raif vllm serve unsloth/Llama-3.2-3B-Instruct \
--enable-lora --lora-modules raif=skrrt-sh/raif-llama-3.2-3b-lora \
--max-lora-rank 32 --max-model-len 8192 \
--chat-template raif_llama32.jinja \
--reasoning-parser raif \
--enable-auto-tool-choice --tool-call-parser raif
VLLM_PLUGINS=raifruns the entry point, which registers theraifreasoning + tool parsers and installs therender_chatinject hook (the seam that adds the compact<schema>cue before chat-templating).--tool-call-parser raifdecodes the tools path intotool_calls;--reasoning-parser raifdecodes theresponse_formatpath intomessage.content.--chat-template raif_llama32.jinja(inchat_templates/) is load-bearing: it renders messages only and ignores thetoolsvariable, so the served prompt matches training. Without it the LoRA echoes the verbose OpenAI tool-def JSON.
What a plain OpenAI client gets
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
# tools -> JSON tool_calls
client.chat.completions.create(model="raif", tools=[...], tool_choice="auto",
messages=[{"role": "user", "content": "Weather in Oslo?"}])
# response_format -> JSON content (use non-streaming — see below)
client.chat.completions.create(model="raif",
response_format={"type": "json_schema", "json_schema": {...}},
messages=[{"role": "user", "content": "..."}])
| OpenAI path | Behavior |
|---|---|
| plain chat | passthrough, untouched |
tools |
RAIF-G → JSON tool_calls (streaming + non-streaming) |
response_format (json_schema / json_object) |
RAIF-G → JSON message.content |
| plain chat streaming | passthrough |
Known limitation: streaming response_format
Streaming a response_format request is not decoded — the client receives raw
RAIF-G. (vLLM's streaming seam passes the parser no schema, and the shared
is_reasoning_end flag must stay True so the tools streaming path keeps
working.) Use non-streaming response_format for structured output — it
decodes fully. Tool-call streaming is unaffected. See
docs/vllm_e2e_results.md.
More
- End-to-end GPU smoke:
scripts/serve_smoke.sh+examples/smoke_plugin.py. - Serving guide + the chat-template fix:
docs/vllm_tool_calling.md. - RunPod runbook:
docs/runpod_testing.md. - The model: the
skrrt-sh/raif-llama-3.2-3b-loraadapter, trained inskrrt-sh/raif-lora. The codec:raif-format.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file raif_vllm-0.1.0.tar.gz.
File metadata
- Download URL: raif_vllm-0.1.0.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad7842a3f45ef8ecff584a46ee49364ac453fea20ffbea54e1cf52385779e2d7
|
|
| MD5 |
e6923d7c3f12f0e71354ab6606e10225
|
|
| BLAKE2b-256 |
9b0870eaf45c818696d66dfc73df237d850387334c647180f4454eae241964eb
|
Provenance
The following attestation bundles were made for raif_vllm-0.1.0.tar.gz:
Publisher:
release.yml on skrrt-sh/raif-vllm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
raif_vllm-0.1.0.tar.gz -
Subject digest:
ad7842a3f45ef8ecff584a46ee49364ac453fea20ffbea54e1cf52385779e2d7 - Sigstore transparency entry: 1896237421
- Sigstore integration time:
-
Permalink:
skrrt-sh/raif-vllm@0a76b428dc21b5cd62cd806c81d01df30a81de02 -
Branch / Tag:
refs/tags/vllm-v0.1.0 - Owner: https://github.com/skrrt-sh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0a76b428dc21b5cd62cd806c81d01df30a81de02 -
Trigger Event:
push
-
Statement type:
File details
Details for the file raif_vllm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: raif_vllm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3872ebc4c7db86974b845811ec943b5d4665a6353a1f30d3f4d3b7e467e0bd2
|
|
| MD5 |
b79a4fccc87dd8544161a7349c7175a0
|
|
| BLAKE2b-256 |
5334e908a402a9ff5a2b43591bb2d57e58e1f98e5713a80957f7fbf7d6caf99c
|
Provenance
The following attestation bundles were made for raif_vllm-0.1.0-py3-none-any.whl:
Publisher:
release.yml on skrrt-sh/raif-vllm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
raif_vllm-0.1.0-py3-none-any.whl -
Subject digest:
b3872ebc4c7db86974b845811ec943b5d4665a6353a1f30d3f4d3b7e467e0bd2 - Sigstore transparency entry: 1896237505
- Sigstore integration time:
-
Permalink:
skrrt-sh/raif-vllm@0a76b428dc21b5cd62cd806c81d01df30a81de02 -
Branch / Tag:
refs/tags/vllm-v0.1.0 - Owner: https://github.com/skrrt-sh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0a76b428dc21b5cd62cd806c81d01df30a81de02 -
Trigger Event:
push
-
Statement type: