[Frontend] Add tokenize/detokenize endpoints (#5054)

This commit is contained in:
sasha0552
2024-06-26 16:54:22 +00:00
committed by GitHub
parent 5bfd1bbc98
commit c54269d967
5 changed files with 143 additions and 6 deletions
+21
View File
@@ -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