pig/ai/message

Types

Unified message type for all conversation participants.

pub type Message {
  User(content: String)
  System(content: String)
  Assistant(
    content: String,
    tool_calls: List(ToolCall),
    thinking: option.Option(Thinking),
    stop_reason: option.Option(stop_reason.StopReason),
  )
  Tool(tool_call_id: String, content: String)
}

Constructors

The role of a message participant.

pub type Role {
  UserRole
  AssistantRole
  SystemRole
  ToolRole
}

Constructors

  • UserRole
  • AssistantRole
  • SystemRole
  • ToolRole

A thinking/reasoning block from the assistant.

pub type Thinking {
  Thinking(content: String)
}

Constructors

  • Thinking(content: String)

A tool call requested by the assistant.

pub type ToolCall {
  ToolCall(id: String, name: String, arguments_json: String)
}

Constructors

  • ToolCall(id: String, name: String, arguments_json: String)

Values

pub fn role(msg: Message) -> Role

Get the role of a message.

Search Document