NLP-RAG / backend /services /streaming.py
Qar-Raz's picture
hf-space: deploy branch without frontend/data/results
c7256ee
raw
history blame contribute delete
238 Bytes
import json
from typing import Any
#need ndjson for streaming responses, this is a simple helper to convert dicts to ndjson format
def to_ndjson(payload: dict[str, Any]) -> str:
return json.dumps(payload, ensure_ascii=False) + "\n"