From e92ef8f5c7c33339e0bf6fa94a08dcc56dc36e62 Mon Sep 17 00:00:00 2001 From: kingbri Date: Mon, 25 Dec 2023 15:33:26 -0500 Subject: [PATCH] OAI: Fix rep pen range alias No need to unwrap because the Pydantic alias does that for us. Signed-off-by: kingbri --- OAI/types/common.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/OAI/types/common.py b/OAI/types/common.py index 0a3c51bd..5047e17b 100644 --- a/OAI/types/common.py +++ b/OAI/types/common.py @@ -1,9 +1,6 @@ """ Common types for OAI. """ -from typing import List, Dict, Optional, Union - from pydantic import BaseModel, Field, AliasChoices - -from utils import unwrap +from typing import List, Dict, Optional, Union class LogProbs(BaseModel): @@ -81,7 +78,7 @@ class CommonCompletionRequest(BaseModel): # Aliased variables repetition_range: Optional[int] = Field( - default=None, + default=-1, validation_alias=AliasChoices("repetition_range", "repetition_penalty_range"), ) @@ -109,7 +106,7 @@ def to_gen_params(self): "frequency_penalty": self.frequency_penalty, "presence_penalty": self.presence_penalty, "repetition_penalty": self.repetition_penalty, - "repetition_range": unwrap(self.repetition_range, -1), + "repetition_range": self.repetition_range, "repetition_decay": self.repetition_decay, "mirostat": self.mirostat_mode == 2, "mirostat_tau": self.mirostat_tau,