LlmRequest class

LLM request.

Supports two patterns:

  • Simple: Use prompt for single-turn completion
  • Conversation: Use messages for multi-turn conversations

Constructors

LlmRequest({String? prompt, List<LlmMessage>? messages, String? systemPrompt, String? model, double? temperature, int? maxTokens, String? responseFormat, List<LlmTool>? tools, Map<String, dynamic>? options})
const
LlmRequest.conversation(List<LlmMessage> messages, {String? systemPrompt, int? maxTokens, double? temperature, List<LlmTool>? tools})
Create a conversation request with messages.
factory
LlmRequest.fromJson(Map<String, dynamic> json)
Create from JSON.
factory
LlmRequest.simple(String prompt, {String? systemPrompt})
Create a simple request with a single prompt.
factory

Properties

effectiveMessages → List<LlmMessage>
Get effective messages (converts prompt to message if needed).
no setter
effectivePrompt → String
Get effective prompt — the latest user message content when using messages.
no setter
hashCode → int
The hash code for this object.
no setterinherited
maxTokens → int?
Maximum tokens to generate.
final
messages → List<LlmMessage>?
Messages in the conversation (for multi-turn requests).
final
model → String?
Model identifier.
final
options → Map<String, dynamic>?
Additional options.
final
prompt → String?
User prompt (for simple single-turn requests).
final
responseFormat → String?
Response format (text, json).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
systemPrompt → String?
System prompt.
final
temperature → double?
Sampling temperature (0.0-2.0).
final
tools → List<LlmTool>?
Tools available for the LLM.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Convert to JSON.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited