LLMService constructor
LLMService({
- bool enableCaching = true,
Creates a new LLM service.
enableCaching - Whether to enable response caching (default: true).
Implementation
LLMService({bool enableCaching = true}) : _cachingEnabled = enableCaching {
if (_cachingEnabled) {
final home =
Platform.environment['HOME'] ?? Platform.environment['USERPROFILE'];
if (home == null) {
throw StateError(
'Unable to determine home directory. Neither HOME nor USERPROFILE environment variables are set.',
);
}
_cache = LLMCache(
maxEntries: 100,
ttl: const Duration(hours: 24),
persistPath: '$home/.spectra/cache.json',
);
}
}