mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-24 16:29:18 +00:00
API: Fix finish_reason returns
OAI expects finish_reason to be "stop" or "length" (there are others, but they're not in the current scope of this project). Make all completions and chat completions responses return this from the model generation itself rather than putting a placeholder. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -24,7 +24,7 @@ class ChatCompletionMessage(BaseModel):
|
||||
class ChatCompletionRespChoice(BaseModel):
|
||||
# Index is 0 since we aren't using multiple choices
|
||||
index: int = 0
|
||||
finish_reason: str
|
||||
finish_reason: Optional[str] = None
|
||||
message: ChatCompletionMessage
|
||||
logprobs: Optional[ChatCompletionLogprobs] = None
|
||||
|
||||
@@ -32,7 +32,7 @@ class ChatCompletionRespChoice(BaseModel):
|
||||
class ChatCompletionStreamChoice(BaseModel):
|
||||
# Index is 0 since we aren't using multiple choices
|
||||
index: int = 0
|
||||
finish_reason: Optional[str]
|
||||
finish_reason: Optional[str] = None
|
||||
delta: Union[ChatCompletionMessage, dict] = {}
|
||||
logprobs: Optional[ChatCompletionLogprobs] = None
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class CompletionRespChoice(BaseModel):
|
||||
|
||||
# Index is 0 since we aren't using multiple choices
|
||||
index: int = 0
|
||||
finish_reason: str
|
||||
finish_reason: Optional[str] = None
|
||||
logprobs: Optional[CompletionLogProbs] = None
|
||||
text: str
|
||||
|
||||
|
||||
Reference in New Issue
Block a user