LlmRequest class

Represents a request to an LLM

Constructors

LlmRequest({required String prompt, List<LlmMessage> history = const [], Map<String, dynamic> parameters = const {}, LlmContext? context, CacheHints? cacheHints})
Create a new LLM request

Properties

cacheHints → CacheHints?
Provider-agnostic prompt-caching hints. When null, providers fall back to their package-level default policy (Anthropic / OpenAI ON, Gemini OFF — see mcp_llm package docs).
final
context → LlmContext?
Optional context for the request
final
hashCode int
The hash code for this object.
no setterinherited
history List<LlmMessage>
Conversation history
final
parameters Map<String, dynamic>
Request parameters (temperature, max_tokens, etc.)
final
prompt String
The prompt to send to the LLM
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({String? prompt, List<LlmMessage>? history, Map<String, dynamic>? parameters, LlmContext? context, CacheHints? cacheHints}) LlmRequest
Create a copy with modified values
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
withMaxTokens(int maxTokens) LlmRequest
Set the maximum number of tokens
withMessage(LlmMessage message) LlmRequest
Add a message to the history
withSystemInstruction(String instruction) LlmRequest
Add a system instruction to the request
withTemperature(double temperature) LlmRequest
Set the temperature

Operators

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