Also allow repetition_penalty

This commit is contained in:
lazymio 2025-02-24 21:07:35 +08:00
parent 8704c09192
commit bf36547f98
No known key found for this signature in database
GPG key ID: DFF27E34A47CB873
3 changed files with 11 additions and 8 deletions

View file

@ -20,7 +20,7 @@ async def create_completion(request:Request,create:CompletionCreate):
if create.stream:
async def inner():
async for token in interface.inference(create.prompt,id,create.temperature,create.top_p):
async for token in interface.inference(create.prompt,id,create.temperature,create.top_p,create.repetition_penalty):
d = {'choices':[{'delta':{'content':token}}]}
yield f"data:{json.dumps(d)}\n\n"
d = {'choices':[{'delta':{'content':''},'finish_reason':''}]}
@ -28,6 +28,6 @@ async def create_completion(request:Request,create:CompletionCreate):
return stream_response(request,inner())
else:
comp = CompletionObject(id=id,object='text_completion',created=int(time()))
async for token in interface.inference(create.prompt,id,create.temperature,create.top_p):
async for token in interface.inference(create.prompt,id,create.temperature,create.top_p,create.repetition_penalty):
comp.append_token(token)
return comp