ReqLLM.Message (ReqLLM v1.4.0)

View Source

Message represents a single conversation message with multi-modal content support.

Content is always a list of ContentPart structs, never a string. This ensures consistent handling across all providers and eliminates polymorphism.

Reasoning Details

The reasoning_details field contains provider-specific reasoning metadata that must be preserved across conversation turns for reasoning models. This field is:

  • nil for non-reasoning models or models that don't provide structured reasoning metadata
  • A list of normalized ReasoningDetails for reasoning models

For multi-turn reasoning continuity, include the previous assistant message (with its reasoning_details) in subsequent requests.

Summary

Types

t()

@type t() :: %ReqLLM.Message{
  content: [any()],
  metadata: map(),
  name: nil | binary(),
  reasoning_details: nil | [any()],
  role: :user | :assistant | :system | :tool,
  tool_call_id: nil | binary(),
  tool_calls: nil | [any()]
}

Functions

schema()

valid?(arg1)

@spec valid?(t()) :: boolean()