# Class ChatRequest

java.lang.Object
com.codename1.ai.ChatRequest

public final class ChatRequest extends Object

The full request to `LlmClient.chat(ChatRequest)` / `LlmClient.chatStream(ChatRequest, StreamingListener)`. Built via `builder()`; immutable once constructed so the same request can be re-used across retries.

Numeric tuning fields are boxed so a `null` means "don't send" -- the provider's own default is used instead of one we picked.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `ChatRequest.Builder`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ChatRequest.Builder`
  `builder()`
  `Integer`
  `getMaxTokens()`
  `List<ChatMessage>`
  `getMessages()`
  `Map<String,String>`
  `getMetadata()`
  `String`
  `getModel()`
  `ResponseFormat`
  `getResponseFormat()`
  `SafetyFilter`
  `getSafetyFilter()`
  `Long`
  `getSeed()`
  `List<String>`
  `getStopSequences()`
  `Float`
  `getTemperature()`
  `ToolChoice`
  `getToolChoice()`
  `List<Tool>`
  `getTools()`
  `Float`
  `getTopP()`
  `ChatRequest.Builder`
  `toBuilder()`
  Returns a builder pre-populated with the values of this request.

  ### Methods inherited from class Object

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

- ## Method Details

  - ### builder

    public static ChatRequest.Builder builder()

  - ### getModel

    public String getModel()

  - ### getMessages

    public List<ChatMessage> getMessages()

  - ### getTemperature

    public Float getTemperature()

  - ### getMaxTokens

    public Integer getMaxTokens()

  - ### getTopP

    public Float getTopP()

  - ### getStopSequences

    public List<String> getStopSequences()

  - ### getSeed

    public Long getSeed()

  - ### getResponseFormat

    public ResponseFormat getResponseFormat()

  - ### getTools

    public List<Tool> getTools()

  - ### getToolChoice

    public ToolChoice getToolChoice()

  - ### getMetadata

    public Map<String,String> getMetadata()

  - ### getSafetyFilter

    public SafetyFilter getSafetyFilter()

  - ### toBuilder

    public ChatRequest.Builder toBuilder()
    Returns a builder pre-populated with the values of this request. Useful for replaying a request with one field changed.