MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / count_query_tokens

Function count_query_tokens

llama_cpp/server/app.py:576–582  ·  view source on GitHub ↗
(
    body: TokenizeInputRequest,
    llama_proxy: LlamaProxy = Depends(get_llama_proxy),
)

Source from the content-addressed store, hash-verified

574 tags=[extras_tag],
575)
576async def count_query_tokens(
577 body: TokenizeInputRequest,
578 llama_proxy: LlamaProxy = Depends(get_llama_proxy),
579) -> TokenizeInputCountResponse:
580 tokens = llama_proxy(body.model).tokenize(body.input.encode("utf-8"), special=True)
581
582 return TokenizeInputCountResponse(count=len(tokens))
583
584
585@router.post(

Callers

nothing calls this directly

Calls 3

tokenizeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…