SemanticCache constructor

SemanticCache({
  1. required DocumentStore store,
  2. required Embedder embedder,
  3. String namespace = 'default',
  4. double threshold = 0.95,
  5. Duration? ttl,
})

Creates a cache.

Implementation

SemanticCache({
  required this.store,
  required this.embedder,
  this.namespace = 'default',
  this.threshold = 0.95,
  this.ttl,
}) {
  if (store.dimensions != embedder.dimensions) {
    throw ArgumentError(
      'the store holds ${store.dimensions}-dimensional vectors but the '
      'embedder produces ${embedder.dimensions}',
    );
  }
}