Class ChatResponse

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

public final class ChatResponse extends 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 Details

  • 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()