Skip to main content

Module deflate

Module deflate 

Source
Expand description

Deflate: the items canonical → legacy OpenAI-shaped ChatRequest.

Pure data transformation — no I/O, no runtime (enforced by the purity lint): an accumulator folds each inbound message’s content items into an OpenAI wire message, tool results split off as role:“tool” messages, and typed cfg fields / extras map onto the ChatRequest the pipeline consumes. Moved verbatim from proxy_api.rs (its former home); lives here because it operates on the items model that owns this tree.

Functions§

items_to_chat_request
Deflate the items canonical back into the legacy OpenAI-shaped ChatRequest the pipeline consumes. Item order is semantic; tool results split off as role:“tool” messages (each carrying its tool_call_id — a bare role:“tool” message 400s on every real upstream).