FunctionsSimilarity

Similarity Remote Api

ai-research-agent / similarity/similarity-remote-api

Similarity

weighRelevanceConceptVectorAPI()

function weighRelevanceConceptVectorAPI(
   source_sentence: string, 
   sentences: string[], 
   options?: object): object[];

Defined in: src/similarity/similarity-remote-api.js:19

Calculate the semantic similarity between one text and a list of other sentences by comparing their embeddings. https://huggingface.co/docs/api-inference/detailed_parameters#sentence-similarity-task

Parameters

ParameterTypeDescription

source_sentence

string

The string that you wish to compare the other strings with. This can be a phrase, sentence, or longer passage, depending on the model being used.

sentences

string[]

A list of strings which will be compared against the source_sentence.

options?

{ HF_API_KEY: string; model: string; }

options.HF_API_KEY?

string

Required https://huggingface.co/settings/tokens

options.model?

string

default="sentence-transformers/all-MiniLM-L6-v2"

Returns

object[]

sentences with relevance scores sorted by relevance *

On this page