Skip to main content

Similarity

Compute the cosine similarity between two stored vectors.

POST /v1/collections/{name}/similarity

Request

Headers:

x-api-key: your-api-key
Content-Type: application/json

Path Parameters:

ParameterDescription
nameCollection name

Query Parameters:

ParameterTypeRequiredDescription
id1stringExternal ID of the first vector
id2stringExternal ID of the second vector

Example

curl -X POST "http://localhost:8000/v1/collections/articles/similarity?id1=doc-1&id2=doc-2" \
-H "x-api-key: test-key"

Response

{
"status": "success",
"data": {
"id1": "doc-1",
"id2": "doc-2",
"similarity": 0.9234
}
}

Errors

CodeReason
404Collection or one of the vectors not found
401Missing or invalid API key