Skip to main content

Module chat

Module chat 

Source
Expand description

The chat-wire layer: the ChatMessage/ChatAttachment request model, the lenient and strict parsers that turn an incoming OpenAI/Ollama payload into messages, the outbound payload_value rendering, tool-spec decoding, and the generic ChatML prompt fallback. This is what a gateway uses to bridge a wire request to the kernel’s dispatch surface and back.

Structs§

ChatAttachment
A file attached to a chat message: an image forwarded to a vision model, or a document inlined into the prompt text.
ChatMessage
A chat turn: role and content plus optional tool calls, tool-result routing, and attachments.
ChatMlPrompt
The generic ChatML fallback prompt for a model with no chat template.

Enums§

AttachmentKind
What kind of thing a ChatAttachment carries.
ChatRole
A chat message’s author.
ChatWireError
Why a chat-wire payload could not be parsed.

Functions§

decode_tool_specs
Decode OpenAI-style function tools from a request’s tools value: an array of {type: "function", function: {name, description?, parameters?}}. Absent → empty; malformed → ChatWireError.