Add support for Batch API test (#936)

This commit is contained in:
yichuan~
2024-08-07 14:52:10 +08:00
committed by GitHub
parent 41bb1ab10d
commit 795eab6dda
5 changed files with 164 additions and 4 deletions

View File

@@ -59,6 +59,7 @@ from sglang.srt.openai_api.adapter import (
v1_batches,
v1_chat_completions,
v1_completions,
v1_delete_file,
v1_files_create,
v1_retrieve_batch,
v1_retrieve_file,
@@ -175,6 +176,12 @@ async def openai_v1_files(file: UploadFile = File(...), purpose: str = Form("bat
)
@app.delete("/v1/files/{file_id}")
async def delete_file(file_id: str):
# https://platform.openai.com/docs/api-reference/files/delete
return await v1_delete_file(file_id)
@app.post("/v1/batches")
async def openai_v1_batches(raw_request: Request):
return await v1_batches(tokenizer_manager, raw_request)