Files
open-webui/backend/open_webui
Classic298 ace84b4ae9 perf: use the orjson codec for outbound Ollama request bodies (#27811)
`routers/ollama.py` serializes the outbound body with stdlib `json` on six inference paths: `/api/chat`, the OpenAI-compatible completions and chat completions proxies, embeddings, the Anthropic messages proxy, and responses. All six carry a full conversation or an embedding batch.

They now go through `JSONCodec`, which selects orjson when `ENABLE_ORJSON` is set. Every one is passed to `send_request`, which hands it to aiohttp as `data=`; aiohttp encodes `str` as UTF-8 and derives `Content-Length` from the encoded bytes. None is hashed, cached, length-measured or persisted.

Admin model management keeps stdlib: `/api/unload`, `/api/pull`, `/api/delete` and `/api/show` serialize fixed one- or two-key dicts, as do the blob download and upload progress events and the error frames. Codec dispatch on those costs about what it saves.

With `ENABLE_ORJSON` unset, which is the default, `JSONCodec` is stdlib `json` and this call site behaves exactly as before.
2026-07-31 17:26:38 -04:00
..
…
2026-07-27 04:46:45 -04:00
2026-07-27 19:39:36 -04:00
2026-07-27 19:39:36 -04:00
2026-07-27 19:39:36 -04:00
2026-07-27 19:39:36 -04:00
2026-07-27 19:39:36 -04:00
2026-07-27 19:39:36 -04:00
2026-07-23 03:39:56 -04:00
2026-07-26 22:45:11 -04:00