feat: Add vLLM backend, pluggable architecture, and Docker build improvements #1
Loading…
Add table
Add a link
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
TL;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 and rewritten documentation.
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.docker/Dockerfile.vllm.--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.Docker and deployment
docker/Dockerfile.vllmwith separatepyproject.vllm.tomlanduv.vllm.lock.docker/Dockerfile.cuda(CUDA 12.4) with separatepyproject.cuda.toml/uv.cuda.lock.docker/build.shmulti-image build script.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.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.docs/, newsrc/core/backends/andsrc/core/repositories/packages.Verification
tests/unit/core/backends/test_transformers_vllm.pytests/unit/streaming/test_vllm_streamer.pytests/unit/core/backends/test_reasoning_builder.pytests/unit/streaming/test_streamer.pytests/unit/core/test_multimodal.pytests/unit/streaming/test_reasoning_detector.pytests/unit/streaming/test_reasoning_streamer_final.pyruffpasses on changed source/test files.vllm 0.22.0torch 2.11.0+cu129transformers 5.12.1Known limitations
LLM_VLLM_MAX_MODEL_LENfor long-context models.asyncio.Lock— no concurrent LLM requests.VLLM_GPU_MEMORY_UTILIZATION=0.60, small image/audio models).rdenadai/improvements-v0.2.0to feat: Add vLLM backend, pluggable architecture, and Docker build improvements33e3a813d0to3d0afc7708View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.