ClaudeCode.Message.PromptSuggestionMessage (ClaudeCode v0.29.0)

View Source

Represents a prompt suggestion message from the Claude CLI.

Emitted after each turn when the promptSuggestions option is enabled. Contains a predicted next user prompt that can be shown as a suggestion in UI applications.

Fields

  • :suggestion - The suggested next prompt
  • :uuid - Message UUID
  • :session_id - Session identifier

JSON Format

{
  "type": "prompt_suggestion",
  "suggestion": "Now add tests for the new function",
  "uuid": "...",
  "session_id": "..."
}

Summary

Functions

Creates a new PromptSuggestionMessage from JSON data.

Type guard to check if a value is a PromptSuggestionMessage.

Types

t()

@type t() :: %ClaudeCode.Message.PromptSuggestionMessage{
  session_id: String.t(),
  suggestion: String.t(),
  type: :prompt_suggestion,
  uuid: String.t() | nil
}

Functions

new(json)

@spec new(map()) :: {:ok, t()} | {:error, atom()}

Creates a new PromptSuggestionMessage from JSON data.

Examples

iex> PromptSuggestionMessage.new(%{
...>   "type" => "prompt_suggestion",
...>   "suggestion" => "Add tests for the new module",
...>   "session_id" => "session-1"
...> })
{:ok, %PromptSuggestionMessage{type: :prompt_suggestion, ...}}

iex> PromptSuggestionMessage.new(%{"type" => "assistant"})
{:error, :invalid_message_type}

prompt_suggestion_message?(arg1)

@spec prompt_suggestion_message?(any()) :: boolean()

Type guard to check if a value is a PromptSuggestionMessage.