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

Method init

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

Source from the content-addressed store, hash-verified

93 }
94
95 async init(options = {}) {
96 if (options.dimension) {
97 this.dimension = options.dimension;
98 }
99 if (!this.dimension || this.dimension <= 0) {
100 throw new Error('Vector dimension must be provided.');
101 }
102 this.metric = normalizeMetric(options.metric || this.metric);
103 this.normalizeVectors = options.normalize ?? this.normalizeVectors ?? (this.metric === 'cosine');
104 if (!this.vectors || this.vectors.length !== this.capacity * this.dimension) {
105 this.vectors = new Float32Array(this.capacity * this.dimension);
106 }
107 }
108
109 prepareItems(items) {
110 const prepared = [];

Callers

nothing calls this directly

Calls 1

normalizeMetricFunction · 0.90

Tested by

no test coverage detected