recent changes

This commit is contained in:
Luxferre
2026-10-14 00:00:02 +03:00
parent 8a0c1d0ec0
commit 80ad504d16
7 changed files with 550 additions and 251 deletions
+10 -8
View File
@@ -69,16 +69,18 @@ CORS is enabled for all origins (`Access-Control-Allow-Origin: *`).
## Token usage counting
Responses include an OpenAI-style `usage` object with `prompt_tokens`,
`completion_tokens`, and `total_tokens`. These are computed locally by an
**embedded cl100k_base BPE tokenizer** (vocabulary data in
`tokenizer_data.c`, logic in `tokenizer.c`) — no upstream token counts are
available from the Gradio backend.
`completion_tokens`, `total_tokens`, and `completion_tokens_details`
(`reasoning_tokens`). These are computed locally by an **embedded cl100k_base
BPE tokenizer** (vocabulary data in `tokenizer_data.c`, logic in `tokenizer.c`)
— no upstream token counts are available from the Gradio backend.
- `prompt_tokens` sums each message's `content` (or multi-part content
parts), `reasoning_content`, and any `tool_calls` function `name` /
`arguments`.
- `prompt_tokens` sums the active `system` prompt, each message's `content`
(or individual multi-part content parts), `reasoning_content`, `tool_calls`
/ `function_call` (`name` and `arguments`), `tool` result wrappers, and any
request `tools` function definitions (`name`, `description`, `parameters`).
- `completion_tokens` sums the assistant `content`, `reasoning_content`, and
any emitted `tool_calls`.
any emitted `tool_calls` (`name` and `arguments`), with `reasoning_tokens`
broken out under `completion_tokens_details`.
- `total_tokens = prompt_tokens + completion_tokens`.
cl100k_base is OpenAI's canonical multilingual tokenizer and is used as the