File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -493,7 +493,7 @@ async def tokenize(
493493) -> TokenizeInputResponse :
494494 tokens = llama_proxy (body .model ).tokenize (body .input .encode ("utf-8" ), special = True )
495495
496- return { " tokens" : tokens }
496+ return TokenizeInputResponse ( tokens = tokens )
497497
498498
499499@router .post (
@@ -508,7 +508,7 @@ async def count_query_tokens(
508508) -> TokenizeInputCountResponse :
509509 tokens = llama_proxy (body .model ).tokenize (body .input .encode ("utf-8" ), special = True )
510510
511- return { " count" : len (tokens )}
511+ return TokenizeInputCountResponse ( count = len (tokens ))
512512
513513
514514@router .post (
@@ -523,4 +523,4 @@ async def detokenize(
523523) -> DetokenizeInputResponse :
524524 text = llama_proxy (body .model ).detokenize (body .tokens ).decode ("utf-8" )
525525
526- return { " text" : text }
526+ return DetokenizeInputResponse ( text = text )
Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ class ModelList(TypedDict):
268268
269269class TokenizeInputRequest (BaseModel ):
270270 model : Optional [str ] = model_field
271- input : Optional [ str ] = Field (description = "The input to tokenize." )
271+ input : str = Field (description = "The input to tokenize." )
272272
273273 model_config = {
274274 "json_schema_extra" : {"examples" : [{"input" : "How many tokens in this query?" }]}
You can’t perform that action at this time.
0 commit comments