MCPcopy Create free account
hub / github.com/OpenAnonymity/oa-chat / constructor

Method constructor

vector/memoryBackend.js:82–93  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

80
81export class MemoryBackend {
82 constructor(options = {}) {
83 this.name = options.name || 'default';
84 this.dimension = options.dimension || null;
85 this.metric = normalizeMetric(options.metric);
86 this.normalizeVectors = options.normalize ?? (this.metric === 'cosine');
87 this.size = 0;
88 this.capacity = ensurePositiveInteger(options.capacity, 128);
89 this.ids = new Array(this.capacity);
90 this.metadata = new Array(this.capacity);
91 this.vectors = null;
92 this.idToIndex = new Map();
93 }
94
95 async init(options = {}) {
96 if (options.dimension) {

Callers

nothing calls this directly

Calls 2

normalizeMetricFunction · 0.90
ensurePositiveIntegerFunction · 0.90

Tested by

no test coverage detected