Spaces:
Sleeping
Sleeping
Commit
·
5c77ba3
1
Parent(s):
9e8df1b
adds accumulated chunks for one chunk completions
Browse files- validators/streamer.py +5 -1
validators/streamer.py
CHANGED
|
@@ -63,7 +63,11 @@ class AsyncResponseDataStreamer:
|
|
| 63 |
# Writes the new response state to the response
|
| 64 |
await response.write(new_response_state.encode('utf-8'))
|
| 65 |
|
| 66 |
-
if chunk is not None and isinstance(chunk, StreamPromptingSynapse):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
self.finish_reason = "completed"
|
| 68 |
self.sequence_number += 1
|
| 69 |
# Assuming the last chunk holds the last value yielded which should be a synapse with the completion filled
|
|
|
|
| 63 |
# Writes the new response state to the response
|
| 64 |
await response.write(new_response_state.encode('utf-8'))
|
| 65 |
|
| 66 |
+
if chunk is not None and isinstance(chunk, StreamPromptingSynapse):
|
| 67 |
+
if len(self.accumulated_chunks) == 0:
|
| 68 |
+
self.accumulated_chunks.append(chunk.completion)
|
| 69 |
+
self.accumulated_chunks_timings.append(time.time() - start_time)
|
| 70 |
+
|
| 71 |
self.finish_reason = "completed"
|
| 72 |
self.sequence_number += 1
|
| 73 |
# Assuming the last chunk holds the last value yielded which should be a synapse with the completion filled
|