LlmContext class

Manages the execution context for LLM requests

Constructors

LlmContext({Map<String, dynamic> contextInfo = const {}, String? systemInstructions, int? maxInputTokens, int? maxOutputTokens, Duration? timeout, bool allowToolUse = true, List<String>? allowedTools, double temperature = 0.7, double? topP, int? topK})
const

Properties

allowedTools List<String>?
final
allowToolUse bool
final
contextInfo Map<String, dynamic>
Additional context information to guide LLM responses
final
hashCode int
The hash code for this object.
no setterinherited
maxInputTokens int?
Context window sizing parameters
final
maxOutputTokens int?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
systemInstructions String?
System instructions to shape LLM behavior
final
temperature double
Execution preferences
final
timeout Duration?
Execution constraints
final
topK int?
final
topP double?
final

Methods

copyWith({Map<String, dynamic>? contextInfo, String? systemInstructions, int? maxInputTokens, int? maxOutputTokens, Duration? timeout, bool? allowToolUse, List<String>? allowedTools, double? temperature, double? topP, int? topK}) LlmContext
Create a new context with updated parameters
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Convert the LLM context to a JSON representation
toProviderParams(String provider) Map<String, dynamic>
Convert to parameter map for LLM provider
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

code() LlmContext
Create a context optimized for code generation
concise() LlmContext
Create a context optimized for concise responses
creative() LlmContext
Create a context optimized for creative generation
factual() LlmContext
Create a context optimized for factual responses
merge(LlmContext base, LlmContext overlay) LlmContext
Merge two contexts, with the second context taking precedence