File tree 1 file changed +9
-2
lines changed 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -779,8 +779,15 @@ def update_from_output(
779
779
# NOTE: structured_output_request
780
780
# should not be None if use_structured_output, we have
781
781
# check above, so safe to ignore type warning
782
- request .structured_output_request .grammar .accept_tokens ( # type: ignore[union-attr]
783
- req_id , new_token_ids )
782
+ if not request .structured_output_request .grammar .accept_tokens ( # type: ignore[union-attr]
783
+ req_id , new_token_ids ):
784
+ # Grammar FSM failed to advance - mark request as finished with error
785
+ logger .error (
786
+ "Structured output FSM failed to advance for request %s. "
787
+ "Terminating request." , req_id )
788
+ request .status = RequestStatus .FINISHED_ABORTED
789
+ stopped = True
790
+ self ._free_request (request )
784
791
785
792
# Add newly generated spec token ids to the request.
786
793
if spec_token_ids is not None :
You can’t perform that action at this time.
0 commit comments