[Bugfix][Frontend] Guard remaining before-validators against non-object JSON bodies (#52528)
Signed-off-by: Kaif <kaifkohari10@gmail.com>
This commit is contained in:
@@ -467,6 +467,8 @@ class ResponsesRequest(OpenAIBaseModel):
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def validate_background(cls, data):
|
||||
if not isinstance(data, dict):
|
||||
return data
|
||||
if not data.get("background"):
|
||||
return data
|
||||
if not data.get("store", True):
|
||||
@@ -479,6 +481,8 @@ class ResponsesRequest(OpenAIBaseModel):
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def validate_prompt(cls, data):
|
||||
if not isinstance(data, dict):
|
||||
return data
|
||||
if data.get("prompt") is not None:
|
||||
raise VLLMValidationError(
|
||||
"prompt template is not supported", parameter="prompt"
|
||||
@@ -499,6 +503,8 @@ class ResponsesRequest(OpenAIBaseModel):
|
||||
|
||||
Invalid structures are left for Pydantic to reject.
|
||||
"""
|
||||
if not isinstance(data, dict):
|
||||
return data
|
||||
input_data = data.get("input")
|
||||
|
||||
# Early return for None, strings, or bytes
|
||||
|
||||
Reference in New Issue
Block a user