Skip to main content

Similarity

This endpoint uses embeddings to measure the semantic similarity between a text anchor and its targets.

Usage#

    Sample Response#

    {
    "similarities": [0.17979126, -0.027569637, 0.1500656]
    }

    Request#

    anchor#

    string

    Used for comparison against the strings in targets.

    targets#

    array of strings

    To be compared to anchor. Maximum number of strings per call is 100.

    Maximum total tokens for the request (sum of tokens in anchor and targets) is 40906.

    Response#

    similarities#

    array of floats

    An array of floats, where each entry represents the similarity of each target to the anchor respectively. A higher value means that a target is more similar to the anchor. The similarity between the anchor and a target is symmetric, i.e.

    similarity(a,b)=similarity(b,a)similarity(a, b) = similarity(b, a)