Generate a minimal streaming response for the NULL model.
(self)
| 279 | yield f"data: {json.dumps({'error': f'Unexpected error: {exc}'})}\n\n" |
| 280 | |
| 281 | async def _generate_null_stream(self): |
| 282 | """Generate a minimal streaming response for the NULL model.""" |
| 283 | chunk_id = f"chatcmpl-null-{int(time.time())}" |
| 284 | created = int(time.time()) |
| 285 | |
| 286 | # Send initial chunk with a single space |
| 287 | yield f"data: {json.dumps({'id': chunk_id, 'object': 'chat.completion.chunk', 'created': created, 'model': 'NULL', 'choices': [{'index': 0, 'delta': {'role': 'assistant', 'content': ' '}, 'finish_reason': None}]})}\n\n" |
| 288 | |
| 289 | # Send final chunk marking completion |
| 290 | yield f"data: {json.dumps({'id': chunk_id, 'object': 'chat.completion.chunk', 'created': created, 'model': 'NULL', 'choices': [{'index': 0, 'delta': {}, 'finish_reason': 'stop'}]})}\n\n" |
| 291 | |
| 292 | # Send [DONE] marker |
| 293 | yield "data: [DONE]\n\n" |