GeneXus SDK for SAP Leonardo: Similarity Scoring

Official Content
This documentation is valid for:

 The Similarity Scoring service(API) allows you to compare vectors using a similarity score (cosine distance) ranging from -1 to 1.


How to use the Similarity Scoring API

To use the Similarity Scoring API on GeneXus you have to use the PostInferenceSync procedure:

GeneXusSAPLeonardo.SimilarityScoring.PostInferenceSync(&options,&File, &Response, &Messages, &IsSuccess)


  • &options: Options parameters must be in json format. Possible values are: - numSimilarVectors - Required. Number of most similar vectors to return in response
  • &File: the file containing the vectors to compare.
    • Archive file: zip, tar, gz, tgz.
    • Vector files in archive file: txt.
    • What a vector file should include: (number, number, number, ..., number)
    • Example: (0.20161056518554688, 1.0347602367401123, ..., 1.5012381076812744)
  • &Response
  • &Messages:is a Message that contains information about the request.
  • &IsSuccess:is a Boolean that is true if no errors were encountered.


Read more about the Similarity Scoring API.