[Frontend] Add tokenize/detokenize endpoints (#5054)
This commit is contained in:
@@ -699,3 +699,24 @@ class BatchRequestOutput(OpenAIBaseModel):
|
||||
# For requests that failed with a non-HTTP error, this will contain more
|
||||
# information on the cause of the failure.
|
||||
error: Optional[Any]
|
||||
|
||||
|
||||
class TokenizeRequest(OpenAIBaseModel):
|
||||
model: str
|
||||
prompt: str
|
||||
add_special_tokens: bool = Field(default=True)
|
||||
|
||||
|
||||
class TokenizeResponse(OpenAIBaseModel):
|
||||
tokens: List[int]
|
||||
count: int
|
||||
max_model_len: int
|
||||
|
||||
|
||||
class DetokenizeRequest(OpenAIBaseModel):
|
||||
model: str
|
||||
tokens: List[int]
|
||||
|
||||
|
||||
class DetokenizeResponse(OpenAIBaseModel):
|
||||
prompt: str
|
||||
|
||||
Reference in New Issue
Block a user