[Misc] add return token strs for tokenize (#18941)
Signed-off-by: reidliu41 <reid201711@gmail.com> Co-authored-by: reidliu41 <reid201711@gmail.com>
This commit is contained in:
@@ -1563,6 +1563,11 @@ class TokenizeCompletionRequest(OpenAIBaseModel):
|
||||
"If true (the default), special tokens (e.g. BOS) will be added to "
|
||||
"the prompt."),
|
||||
)
|
||||
return_token_strs: Optional[bool] = Field(
|
||||
default=False,
|
||||
description=("If true, also return the token strings "
|
||||
"corresponding to the token ids."),
|
||||
)
|
||||
|
||||
|
||||
class TokenizeChatRequest(OpenAIBaseModel):
|
||||
@@ -1576,6 +1581,11 @@ class TokenizeChatRequest(OpenAIBaseModel):
|
||||
"This is a parameter used by chat template in tokenizer config of the "
|
||||
"model."),
|
||||
)
|
||||
return_token_strs: Optional[bool] = Field(
|
||||
default=False,
|
||||
description=("If true, also return the token strings "
|
||||
"corresponding to the token ids."),
|
||||
)
|
||||
continue_final_message: bool = Field(
|
||||
default=False,
|
||||
description=
|
||||
@@ -1633,6 +1643,7 @@ class TokenizeResponse(OpenAIBaseModel):
|
||||
count: int
|
||||
max_model_len: int
|
||||
tokens: list[int]
|
||||
token_strs: Optional[list[str]] = None
|
||||
|
||||
|
||||
class DetokenizeRequest(OpenAIBaseModel):
|
||||
|
||||
Reference in New Issue
Block a user