feat: Add vLLM backend, pluggable architecture, and Docker build improvements #1
Loading…
Reference in a new issue
No description provided.
Delete branch "rdenadai/improvements-v0.2.0"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hagalaz v0.2.0: vLLM backend, chat UI, streaming audio, and service-layer refactor
Target release:
v0.2.0(tagged) · Branch:rdenadai/improvements-v0.2.0· Base:mainTL;DR
This release turns Hagalaz from a single-backend transformers API into a multi-backend, production-oriented server. It adds a vLLM backend with continuous batching, a full Alpine.js chat UI with audio playback/recording, streaming TTS in multiple formats, a service-layer API refactor with dependency injection, multimodal model support for Gemma-4 / Qwen3.5-VL / Phi-4-multimodal, and a Docker overhaul with separate CUDA and vLLM images built on pyenv Python 3.13.13. The branch also adds comprehensive unit tests, rewritten documentation, a
CHANGELOG.md, and a refreshed dependency lockfile set.Major changes
vLLM backend
src/core/backends/vllm.pyimplementing the backend protocol via vLLMAsyncLLMEngine.src/streaming/vllm_streamer.pyfor delta-based streaming with shared reasoning detection.compressed-tensors0.17.0, PyTorch 2.11.0 on thenvidia/cuda:12.9.2-runtime-ubuntu22.04base; the vLLM 0.26 wheels link against the CUDA 13 runtime libs shipped in the venv.ninja-buildinstalled in the image so FlashInfer can compile its runtime kernels at first use.--chat-template-model-id/CHAT_TEMPLATE_MODEL_IDfor tokenizers that ship without one.LOAD=allsupport in the vLLM image alongside image/audio/TTS models.Chat web UI
/chatroute andstatic/chat.html.static/js/chat-app.js,static/css/chat.css) with:Audio / TTS streaming
/v1/audio/speech/streamendpoint returning SSE with base64 audio chunks.mistralai/Voxtral-4B-TTS-2603).src/api/text_ingestion.py)./v1/audio/voicesendpoint lists model-specific voice presets.API refactor
src/api/routes.pyare now thin handlers delegating to services.ChatService,ImageService,AudioService,TTSService,HealthService,ModelListingService.src/api/schemas.pyandsrc/api/requests.py.src/api/validation.py).app.statewithModelRegistry,ResourceMonitor, and request deduplication.main.pysplit into focused helper functions with explicit lifespan management.Backend architecture
src/core/backends/with a sharedbase.pyprotocol,transformers.py,vllm.py,reasoning_builder.py, andprocessor_utils.py.ReasoningDetectorinsrc/streaming/reasoning_detector.pyfor<think>/</think>detection across both backends.ReasoningStreamerinsrc/streaming/streamer.pyhandles real-time token streaming, marker stripping, and thread-safe queueing.ModelLoaderorchestrates startup model loading.src/core/repositories/.Model support and compatibility
transformers>=5.1.0for Qwen3.5, Gemma-4, and Phi-4-multimodal.prepare_multimodal_inputs(Gemma-4, Qwen3.5-VL, Phi-4-multimodal).--gguf-fileselection.LOW_CPU_MEM_USAGEcontrols low-CPU-memory loading.Dependency refresh
All three lockfiles were re-resolved and are consistent with their manifests (
uv lock --checkpasses for the root project,docker/uv.cuda.lockanddocker/uv.vllm.lock):torchstays pinned at2.7.1+cu118for the base image and2.11.0for the vLLM image.Docker and deployment
docker/Dockerfile.vllmwith separatepyproject.vllm.tomlanduv.vllm.lock.docker/Dockerfile.cuda(CUDA 12.4) with separatepyproject.cuda.toml/uv.cuda.lock.uv sync --no-cachein every image to avoid duplicating wheels in the uv cache and cut peak build disk usage.docker/build.shmulti-image build script, now defaulting to version0.2.0.docker-compose.ymlwithhagalaz-vllmservice and env-var interpolation.docs/DEPLOY_DOCKER.md,docs/DOCKERHUB.md,docs/VLLM.md,docs/MODELS.md,docs/RULES.md.Configuration
src/config.pyrewritten withpydantic-settingsand environment-specific settings classes (LLMSettings,ImageSettings,AudioSettings,TTSSettings, etc.).--loadnow supports comma-separated values (llm,image,audio,tts) in addition toallandbothaliases.Release engineering
pyproject.tomlanddocker/pyproject.cuda.toml(the vLLM image manifest was already at 0.2.0).CHANGELOG.mdin Keep a Changelog format, covering every change sincev0.1.0.0.2.0indocker/build.shanddocs/DEPLOY_DOCKER.md.v0.2.0on the release commit.Tests
tests/unit/:test_chat_service.py,test_middleware.py,test_routes.py,test_tts_service.py,test_schemas.pytest_transformers_vllm.py,test_reasoning_builder.pytest_streamer.py,test_reasoning_detector.py,test_vllm_streamer.py,test_base_iterator.pyBreaking changes
>=3.13.11(Docker images use 3.13.13).transformers>=5.1.0is now required; v4.x is no longer supported.LOAD: changed fromtts,imagetollm,image./v1/audio/speechnow returns raw audio bytes by default instead of base64 JSON.pydantic-settingswith prefixed env vars.VLLM_*→LLM_VLLM_*(LLM_VLLM_TENSOR_PARALLEL_SIZE,LLM_VLLM_GPU_MEMORY_UTILIZATION,LLM_VLLM_MAX_MODEL_LEN). The unprefixed names were shadowed by theLLM_VLLM_*defaults and never took effect; update any compose file or export that used the old names.docs/, newsrc/core/backends/andsrc/core/repositories/packages.Verification
pytest -q).ruff check .clean across the repository.uv lock --checkpasses for the root project, the CUDA image lock and the vLLM image lock.vllm 0.26.0torch 2.11.0transformers 5.14.1compressed-tensors 0.17.0Known limitations
LLM_VLLM_MAX_MODEL_LENfor long-context models.asyncio.Lock— no concurrent LLM requests.LLM_VLLM_GPU_MEMORY_UTILIZATION=0.60, small image/audio models).mypy --strictis still not clean (395 pre-existing errors in 34 files). It is not enforced as a CI gate yet.rdenadai/improvements-v0.2.0to feat: Add vLLM backend, pluggable architecture, and Docker build improvements33e3a813d0to3d0afc7708