public final class ChatRequest
- Object
- ChatRequest
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 types
class ChatRequest.Builder | Mutable fluent builder for ChatRequest. |
Methods
Inherited methods
Method details
builder
public static ChatRequest.Builder builder()Starts an empty request builder. At least one message is required.
Returns
a new builder
getModel
public String getModel()Returns
requested provider model, or
null for the client defaultgetMessages
public List<ChatMessage> getMessages()Returns
immutable conversation messages in provider order
getTemperature
public Float getTemperature()Returns
sampling temperature, or
null for the provider defaultgetMaxTokens
public Integer getMaxTokens()Returns
maximum generated tokens, or
null for the provider defaultgetTopP
public Float getTopP()Returns
nucleus-sampling probability, or
null when unspecifiedgetStopSequences
public List<String> getStopSequences()Returns
immutable stop sequences; empty when none were requested
getSeed
public Long getSeed()Returns
deterministic sampling seed, or
null when unspecifiedgetResponseFormat
public ResponseFormat getResponseFormat()Returns
requested text/JSON response format, or
nullgetTools
public List<Tool> getTools()Returns
immutable tools offered to the model
getToolChoice
public ToolChoice getToolChoice()Returns
tool-selection policy, or
null for provider behaviorgetMetadata
public Map<String, String> getMetadata()Returns
immutable provider metadata attached to this request
getSafetyFilter
public SafetyFilter getSafetyFilter()Returns
client-side preflight filter, or
null when disabledtoBuilder
public ChatRequest.Builder toBuilder()Returns a builder pre-populated with the values of this request.
Useful for replaying a request with one field changed.