Catalog/rag-cosine-threshold-groups

Retrieval

Agglomerative cosine groups API

Single-link agglomerative grouping of vectors by a cosine threshold (union-find), clustering near-duplicates without choosing k. Answers 'How do I group near-duplicate embeddings?', 'How do I cluster vectors above a cosine threshold?'.

Price$0.02per request
MethodPOST
Route/v1/retrieval/cosine-threshold-groups
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
clusteringagglomerativecosinethresholdnear-duplicateunion-findvectorrag
API URLhttps://x402.hexl.dev/v1/retrieval/cosine-threshold-groups
Integration docs
Example request
{
  "vectors": [
    [
      1,
      0
    ],
    [
      1,
      0.01
    ],
    [
      0,
      1
    ]
  ],
  "threshold": 0.9,
  "ids": [
    "x",
    "y",
    "z"
  ]
}
Example response
{
  "threshold": 0.9,
  "groupCount": 2,
  "groups": [
    {
      "group": 0,
      "indices": [
        0,
        1
      ],
      "ids": [
        "x",
        "y"
      ],
      "size": 2
    },
    {
      "group": 1,
      "indices": [
        2
      ],
      "ids": [
        "z"
      ],
      "size": 1
    }
  ],
  "totalItems": 3
}
Input schema
{
  "type": "object",
  "required": [
    "vectors"
  ],
  "properties": {
    "vectors": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    },
    "threshold": {
      "type": "number"
    },
    "ids": {
      "type": "array"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}