[Frontend] Apply request header overrides to chat completions (#35001)
Co-authored-by: Ye (Charlotte) Qi <ye.charlotte.qi@gmail.com>
This commit is contained in:
@@ -61,6 +61,7 @@ from sglang.srt.entrypoints.openai.utils import (
|
||||
should_include_usage,
|
||||
to_openai_style_logprobs,
|
||||
)
|
||||
from sglang.srt.entrypoints.request_headers import apply_header_overrides
|
||||
from sglang.srt.environ import envs
|
||||
from sglang.srt.function_call.core_types import ToolCallItem
|
||||
from sglang.srt.function_call.function_call_parser import FunctionCallParser
|
||||
@@ -1037,6 +1038,11 @@ class OpenAIServingChat(OpenAIServingBase):
|
||||
return_prompt_token_ids=request.return_prompt_token_ids
|
||||
or request.return_token_ids,
|
||||
)
|
||||
if (
|
||||
raw_request is not None
|
||||
and envs.SGLANG_ENABLE_REQUEST_HEADER_OVERRIDES.get()
|
||||
):
|
||||
apply_header_overrides(adapted_request, raw_request.headers)
|
||||
|
||||
return adapted_request, request
|
||||
|
||||
|
||||
Reference in New Issue
Block a user