import { cos_sim } from '@huggingface/transformers'; import { toSql } from 'pgvector'; class Vector { // eslint-disable-next-line @typescript-eslint/no-explicit-any #value: any; #dimentions: number; // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(value: any, dimentions: number) { this.#value = value; this.#dimentions = dimentions; } public get value() { return this.#value; } // eslint-disable-next-line @typescript-eslint/no-explicit-any public set value(value: any) { this.#value = value; } public get dimentions() { return this.#dimentions; } public toSql = () => { return toSql(this.#value); }; public distanceTo = (other: Vector) => { return cos_sim(this.#value, other.value); }; } export { Vector };