MCPcopy
hub / github.com/ModelTC/LightLLM / FinishStatus

Class FinishStatus

lightllm/server/core/objs/req.py:14–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13
14class FinishStatus(ctypes.Structure):
15 _pack_ = 4
16 _fields_ = [("status", ctypes.c_int)]
17
18 NO_FINISH = 0
19 FINISHED_STOP = 1
20 FINISHED_LENGTH = 2
21
22 def __init__(self, init_state=NO_FINISH):
23 self.status = init_state
24
25 def set_status(self, new_status):
26 assert 0 <= new_status <= 2
27 self.status = new_status
28
29 def get_status(self):
30 return self.status
31
32 def is_finished(self):
33 return self.FINISHED_STOP <= self.status <= self.FINISHED_LENGTH
34
35 def is_stopped(self):
36 return self.status == self.FINISHED_STOP
37
38 def get_finish_reason(self):
39 if self.status == self.FINISHED_STOP:
40 return "stop"
41 elif self.status == self.FINISHED_LENGTH:
42 return "length"
43 return None
44
45
46class PrefixTokenIdsStruct(ctypes.Structure):

Callers 4

fetch_streamMethod · 0.90
_init_all_stateMethod · 0.90
handle_loopMethod · 0.90
initMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected