ailoy-web
    Preparing search index...

    Interface Message

    A chat message generated by a user, model, or tool.

    Message is the concrete, non-streaming container used by the application to store, transmit, or feed structured content into models or tools. It can represent various kinds of messages, including user input, assistant responses, tool-call outputs, or signed thinking metadata.

    Note that many different kinds of messages can be produced. For example, a language model may internally generate a thinking trace before emitting its final output, in order to improve reasoning accuracy. In other cases, a model may produce function calls — structured outputs that instruct external tools to perform specific actions.

    This struct is designed to handle all of these situations in a unified way.

    Example

    let msg = Message::new(Role::User).with_contents([Part::text(\"hello\")]);
    assert_eq!(msg.role, Role::User);
    assert_eq!(msg.contents.len(), 1);
    interface Message {
        contents: Part[];
        id?: string;
        role: Role;
        signature?: string;
        thinking?: string;
        tool_calls?: Part[];
    }
    Index

    Properties

    contents: Part[]

    Primary parts of the message (e.g., text, image, value, or function).

    id?: string

    Optional stable identifier for deduplication or threading.

    role: Role

    Author of the message.

    signature?: string

    Optional signature for the thinking field.

    This is only applicable to certain LLM APIs that require a signature as part of the thinking payload.

    thinking?: string

    Internal “thinking” text used by some models before producing final output.

    tool_calls?: Part[]

    Tool-call parts emitted alongside the main contents.