# Class ChatResponse

java.lang.Object
com.codename1.ai.ChatResponse

public final class ChatResponse extends java.lang.Object

The terminal response from a chat call. For streaming requests, the `ChatResponse` carries the aggregated final assistant message -- the individual deltas were delivered through `StreamingListener` before this object was produced.

`finishReason` is one of: `"stop"`, `"length"`, `"tool_calls"`, `"content_filter"`, `"error"` (normalized across providers).

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ChatResponse(ChatMessage assistantMessage, List<ToolCall> toolCalls, String finishReason, Usage usage, String modelUsed)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ChatMessage`
  `getAssistantMessage()`
  `String`
  `getFinishReason()`
  `String`
  `getModelUsed()`
  `String`
  `getText()`
  Convenience: the assembled assistant text.
  `List<ToolCall>`
  `getToolCalls()`
  `Usage`
  `getUsage()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ChatResponse

    public ChatResponse(ChatMessage assistantMessage, List<ToolCall> toolCalls, String finishReason, Usage usage, String modelUsed)

- ## Method Details

  - ### getAssistantMessage

    public ChatMessage getAssistantMessage()

  - ### getToolCalls

    public List<ToolCall> getToolCalls()

  - ### getText

    public String getText()
    Convenience: the assembled assistant text. Equivalent to `getAssistantMessage().getText()` when there is one.

  - ### getFinishReason

    public String getFinishReason()

  - ### getUsage

    public Usage getUsage()

  - ### getModelUsed

    public String getModelUsed()