Allow send list of str for the Prompt on openai demo endpoint /v1/completions (#323)

* allow str or List[str] for prompt

* Update vllm/entrypoints/openai/api_server.py

Co-authored-by: Zhuohan Li <zhuohan123@gmail.com>

---------

Co-authored-by: Zhuohan Li <zhuohan123@gmail.com>
This commit is contained in:
Michele Catalano
2023-07-03 18:17:50 +02:00
committed by GitHub
parent 49b26e2cec
commit 0bd2a573a5
2 changed files with 6 additions and 2 deletions

View File

@@ -357,7 +357,11 @@ async def create_completion(raw_request: Request):
model_name = request.model
request_id = f"cmpl-{random_uuid()}"
prompt = request.prompt
if isinstance(request.prompt, list):
assert len(request.prompt) == 1
prompt = request.prompt[0]
else:
prompt = request.prompt
created_time = int(time.time())
try:
sampling_params = SamplingParams(