Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions python/sglang/srt/openai_api/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,20 @@ def v1_embedding_request(all_requests, tokenizer_manager):
first_prompt_type = type(all_requests[0].input)

for request in all_requests:
# Add validation for empty input string
if isinstance(request.input, str) and request.input == "":
raise HTTPException(
status_code=400, detail="Input cannot be an empty string."
)
if (
isinstance(request.input, list)
and len(request.input) == 1
and request.input[0] == ""
):
raise HTTPException(
status_code=400, detail="Input cannot be an empty string."
)
# End of validation
prompt = request.input
assert (
type(prompt) is first_prompt_type
Expand Down
Loading