API: set do_sample=false when temperature=0 (#5275)

This commit is contained in:
Stefan Daniel Schwarz 2024-01-18 03:58:11 +01:00 committed by GitHub
parent 3fef37cda8
commit 232c07bf1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,6 +97,9 @@ async def openai_completions(request: Request, request_data: CompletionRequest):
path = request.url.path
is_legacy = "/generate" in path
if request_data.temperature == 0:
request_data.do_sample = False
if request_data.stream:
async def generator():
async with streaming_semaphore:
@ -120,6 +123,9 @@ async def openai_chat_completions(request: Request, request_data: ChatCompletion
path = request.url.path
is_legacy = "/generate" in path
if request_data.temperature == 0:
request_data.do_sample = False
if request_data.stream:
async def generator():
async with streaming_semaphore: