Generate a minimal streaming response for the NULL model.
(self)
| 269 | yield f"data: {json.dumps({'error': f'Unexpected error: {exc}'})}\n\n" |
| 270 | |
| 271 | async def _generate_null_stream(self): |
| 272 | """Generate a minimal streaming response for the NULL model.""" |
| 273 | chunk_id = f"chatcmpl-null-{int(time.time())}" |
| 274 | created = int(time.time()) |
| 275 | |
| 276 | # Send initial chunk with a single space |
| 277 | 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" |
| 278 | |
| 279 | # Send final chunk marking completion |
| 280 | 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" |
| 281 | |
| 282 | # Send [DONE] marker |
| 283 | yield "data: [DONE]\n\n" |