fix: exclude null fields from streaming chunks for Open WebUI compatibility
Build and Push / release (push) Successful in 3s
Build and Push / build (push) Successful in 1m24s

OpenAI's API omits null fields in streaming chunks, but Tatlock was
including them (content: null, reasoning_content: null). This caused
parsing issues in Open WebUI's streaming handler.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 15:36:37 +01:00
co-authored by Claude Opus 4.5
parent e469746f75
commit 8092740fa4
3 changed files with 8 additions and 2 deletions
+6
View File
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [2.0.5] - 2026-02-05
### Fixed
- **Streaming JSON compatibility** - Exclude null fields from streaming chunks using `exclude_none=True`; OpenAI's API omits null fields entirely, and including them (e.g., `content: null`, `reasoning_content: null`) caused parsing issues in Open WebUI
## [2.0.4] - 2026-02-05
### Fixed
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "tatlock"
version = "2.0.4"
version = "2.0.5"
description = "OpenAI-compatible API with Ollama backend"
requires-python = ">=3.12"
dependencies = []
+1 -1
View File
@@ -31,7 +31,7 @@ async def _stream_response(
"""
try:
async for chunk in service.create_chat_completion_stream(request):
yield f"data: {chunk.model_dump_json()}\n\n"
yield f"data: {chunk.model_dump_json(exclude_none=True)}\n\n"
yield "data: [DONE]\n\n"