Skip to content

Commit 6d243ef

Browse files
authored
[Misc] Convert use_structured_output property into constant (#23060)
Signed-off-by: Woosuk Kwon <[email protected]>
1 parent c55bc1d commit 6d243ef

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

vllm/v1/request.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,23 @@ def __init__(
5454
time.time()
5555

5656
self.status = RequestStatus.WAITING
57-
if sampling_params and sampling_params.guided_decoding is not None:
58-
self.status = RequestStatus.WAITING_FOR_FSM
57+
self.use_structured_output = False
5958
self.events: list[EngineCoreEvent] = []
6059
self.stop_reason: Union[int, str, None] = None
6160

6261
# P/D: Connector-specific KV transfer parameters.
6362
self.kv_transfer_params: Optional[dict[str, Any]] = None
6463

6564
if pooling_params is not None:
65+
# Pooling models.
6666
self.max_tokens = 1
6767
elif sampling_params is not None:
68+
# Generative models.
6869
assert sampling_params.max_tokens is not None
6970
self.max_tokens = sampling_params.max_tokens
7071
if sampling_params.guided_decoding is not None:
7172
self.status = RequestStatus.WAITING_FOR_FSM
73+
self.use_structured_output = True
7274

7375
if sampling_params.extra_args is not None:
7476
self.kv_transfer_params = \
@@ -192,11 +194,6 @@ def get_num_encoder_tokens(self, input_id: int) -> int:
192194
num_tokens = self.mm_positions[input_id].length
193195
return num_tokens
194196

195-
@property
196-
def use_structured_output(self) -> bool:
197-
return self.sampling_params is not None and \
198-
self.sampling_params.guided_decoding is not None
199-
200197
def record_event(
201198
self,
202199
event_type: EngineCoreEventType,

0 commit comments

Comments
 (0)