Commit 47abbabb authored by Your Name's avatar Your Name

Fix raw mode variable initialization

Fixed issue where raw mode variables were being re-initialized,
which was overwriting the values set in the prompt handling section.
parent ceb4ae88
......@@ -2170,20 +2170,18 @@ async def chat_completions(request: ChatCompletionRequest, http_request: Request
})
# Handle raw mode - use generate() instead of generate_chat() for raw prompt completion
# Note: These may have been set earlier in the prompt handling section
# Initialize only if not already set
if 'use_raw_mode' not in locals():
use_raw_mode = False
if 'raw_prompt_for_generation' not in locals():
raw_prompt_for_generation = None
if 'raw_stop_sequences' not in locals():
raw_stop_sequences = None
# Check if we set raw mode in the prompt handling section above
# The variables should already be set if raw was in force_reasoning_args
if "raw" in force_reasoning_args:
# Raw mode was already set up in the prompt handling section
# Just verify the variables exist
try:
_ = raw_prompt_for_generation
_ = raw_stop_sequences
except NameError:
# Variables not set - try to get tokenizer again
# Check if we need to set up raw mode (if not already done in prompt handling)
if "raw" in force_reasoning_args and not use_raw_mode:
# Set up raw mode using tokenizer
tokenizer = None
if hasattr(current_manager, 'backend') and hasattr(current_manager.backend, 'tokenizer'):
tokenizer = current_manager.backend.tokenizer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment