copyWith method
Implementation
InvocationContext copyWith({
BaseAgent? agent,
String? branch,
Content? userContent,
String? invocationId,
RunConfig? runConfig,
}) {
return InvocationContext(
artifactService: artifactService,
sessionService: sessionService,
memoryService: memoryService,
credentialService: credentialService,
contextCacheConfig: contextCacheConfig,
invocationId: invocationId ?? this.invocationId,
branch: branch ?? this.branch,
agent: agent ?? this.agent,
userContent: userContent ?? this.userContent?.copyWith(),
session: session,
agentStates: agentStates.map(
(String key, Map<String, Object?> value) =>
MapEntry<String, Map<String, Object?>>(
key,
Map<String, Object?>.from(value),
),
),
endOfAgents: Map<String, bool>.from(endOfAgents),
endInvocation: endInvocation,
liveRequestQueue: liveRequestQueue,
activeStreamingTools: activeStreamingTools == null
? null
: Map<String, ActiveStreamingTool>.from(activeStreamingTools!),
transcriptionCache: transcriptionCache == null
? null
: List<Object?>.from(transcriptionCache!),
liveSessionResumptionHandle: liveSessionResumptionHandle,
inputRealtimeCache: inputRealtimeCache == null
? null
: List<Object?>.from(inputRealtimeCache!),
outputRealtimeCache: outputRealtimeCache == null
? null
: List<Object?>.from(outputRealtimeCache!),
runConfig: runConfig ?? this.runConfig?.copyWith(),
resumabilityConfig: resumabilityConfig,
eventsCompactionConfig: eventsCompactionConfig,
tokenCompactionChecked: tokenCompactionChecked,
pluginManager: pluginManager,
canonicalToolsCache: canonicalToolsCache == null
? null
: List<BaseTool>.from(canonicalToolsCache!),
).._numberOfLlmCalls = _numberOfLlmCalls;
}