# `LlmComposer.Message`
[🔗](https://github.com/doofinder/llm_composer/blob/master/lib/llm_composer/message.ex#L1)

Module that represents an arbitrary message for any LLM.

## Fields

- `:type` — the role of the message sender (e.g. `:user`, `:assistant`, `:system`, `:tool_result`).
- `:content` — the text or structured content of the message.
- `:reasoning` — optional plain-text reasoning string returned by reasoning models.
  Primarily used with OpenRouter: when an assistant message is included in a follow-up
  request, this field is forwarded so the model can continue from where it left off.
- `:reasoning_details` — optional list of reasoning detail objects (maps) returned by
  reasoning models. Use this instead of (or alongside) `:reasoning` when the provider
  returns structured reasoning blocks (e.g. encrypted or summarised thinking blocks).
  Like `:reasoning`, this field is forwarded by the OpenRouter provider on resend.
- `:function_calls` — optional list of `LlmComposer.FunctionCall` structs returned by the
  model when it requests tool execution. Set by parsers on assistant messages.
- `:metadata` — arbitrary map for provider-specific data (e.g. original raw response).

# `t`

```elixir
@type t() :: %LlmComposer.Message{
  content: binary() | list() | nil,
  function_calls: [LlmComposer.FunctionCall.t()] | nil,
  metadata: map(),
  reasoning: binary() | nil,
  reasoning_details: list() | nil,
  type: binary() | atom()
}
```

A normalized message exchanged with any LLM provider.

- `:type` — role of the sender (e.g. `:user`, `:assistant`, `:system`, `:tool_result`).
- `:content` — text or structured content of the message.
- `:reasoning` — optional plain-text reasoning string returned by reasoning models.
- `:reasoning_details` — optional list of structured reasoning block maps.
- `:function_calls` — optional list of `LlmComposer.FunctionCall` structs requested by the model.
- `:metadata` — arbitrary map for provider-specific data.

# `new`

```elixir
@spec new(
  type :: binary() | atom(),
  content :: binary() | list() | nil,
  metadata :: map()
) :: t()
```

Creates a new message struct with a given type and content.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
