# `Condukt.Message`
[🔗](https://github.com/tuist/condukt/blob/1.5.1/lib/condukt/message.ex#L1)

Represents a message in the conversation history.

Messages can be from the user, the assistant, or represent tool results.
Assistant messages may include tool calls and their results.

## Message Roles

- `:user` - A message from the user
- `:assistant` - A response from the LLM
- `:tool_result` - The result of a tool execution

## Content Blocks

Assistant messages can contain multiple content blocks:

- `{:text, string}` - Plain text
- `{:thinking, string}` - Model's reasoning (if thinking enabled)
- `{:tool_call, id, name, args}` - A tool invocation

# `assistant`

Creates a new assistant message.

Content can be a string or a list of content blocks.

# `has_tool_calls?`

Checks if the message contains any tool calls.

# `text`

Extracts plain text from a message's content.

Returns the concatenated text blocks for assistant messages,
or the content directly for user messages.

# `thinking`

Extracts thinking content from a message.

# `tool_calls`

Extracts tool calls from a message.

Returns a list of `{id, name, args}` tuples.

# `tool_result`

Creates a tool result message.

The content will be JSON-encoded if not a string.

# `tool_result_content`

Extracts the content from a tool result message for display.

# `user`

Creates a new user message.

## Examples

    Message.user("Hello!")
    Message.user("What's in this image?", [%{type: :base64, media_type: "image/png", data: "..."}])

---

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