I am getting messages where chunking happens mid-json like:
data: {"id": "cmpl-8238bb566a84454bb3f1b5b872377e82", "object": "chat.completion.chunk", "created": 1702644750, "model": "mistral-medium", "choices": [{"index": 0, "delta": {"role": null, "content": " squad"}, "finish_reason": null}]}
data: {"id": "cmpl-8238bb566a84454bb3f1b5b872377e82", "object": "chat.completion.chunk", "created": 1702644750, "model": "mistral-medium", "choices": [{"inde
[-----------------new chunk-------------------]
x": 0, "delta": {"role": null, "content": ":"}, "finish_reason": null}]}
data: {"id": "cmpl-8238bb566a84454bb3f1b5b872377e82", "object": "chat.completion.chunk", "created": 1702644750, "model": "mistral-medium", "choices": [{"index": 0, "delta": {"role": null, "content": " Ar"}, "finish_reason": null}]}
data: {"id": "cmpl-8238bb566a84454bb3f1b5b872377e82", "object": "chat.completion.chunk", "created": 1702644750, "model": "mistral-medium", "choices": [{"index": 0, "delta": {"role": null, "content": "sen"}, "finish_reason": null}]}
I don't know if this is valid by spec or not, but it would simplify things for clients if every chunk only contained valid self-contained json.