public enum Role

  1. Object
  2. Enum<Role>
  3. Role

ImplementsComparable<Role>

Author of a ChatMessage. Maps directly to the role string sent on the wire by every supported LLM provider.

Enum constants

SYSTEMDeveloper-supplied instructions that steer the assistant.
USEREnd-user content (text, images, tool results).
ASSISTANTModel output.
TOOLResult of a function/tool invocation, sent back to the model so it can continue reasoning.

Methods

public static Role[] values()
public static Role valueOf(String name)

Inherited methods

Enum constant details

SYSTEM

SYSTEM
Developer-supplied instructions that steer the assistant. Sent once at the head of the conversation. Gemini receives these as systemInstruction rather than a normal message; the Gemini client handles the conversion internally.

USER

USER
End-user content (text, images, tool results).

ASSISTANT

ASSISTANT
Model output. When the assistant calls a tool the ChatMessage also carries one or more ToolCall entries.

TOOL

TOOL
Result of a function/tool invocation, sent back to the model so it can continue reasoning. Paired with the originating ToolCall via ChatMessage.getToolCallId().

Method details

values

public static Role[] values()

valueOf

public static Role valueOf(String name)