Package Exports
- vector-cosine-similarity
- vector-cosine-similarity/lib/cosineSimilarity.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vector-cosine-similarity) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vector-cosine-similarity
A lightweight Cosine Similarity Function. Built as an alternative to the compute-cosine-similarity package. Works with high dimension vectors like openAI embeddings.
Installation
$ npm install vector-cosine-similarity
Usage
As an ES module
import { cosineSimilarity } from 'vector-cosine-similarity';
const similarity = cosineSimilarity(vector1, vector2);
console.log(similarity) // => .78456378