Find the nearest neighbors to a provided instance contained in a known Entity
Using the standard API querying and adding in the entity, the id of the instance of the entity to be compared to plus the number of nearest neighbors (entity_knn_k, 10 in the sample), will generate an output in probability order
COLUMNSSpecify the names and sequence of columns you want to be provided in the response. These are shown in the entity dashboard |
curl https://app.graft.com/v1/query -H 'Content-Type: application/json' -X POST -d '{
"secret": "SArh7qq.4q9vhmwgh17JAJ6EuhAlJJUYavhtXVgiRTabcmgS",
"organization": "<your_organization_name>",
"project": "my_project",
"output_format": "csv",
"entity": "MyEntity",
"embedding_name": "my_embedding",
"entity_columns": ["id", "data"],
"entity_knn_id": "id123",
"entity_knn_k": 10
}'
Simple Example
Please see REST API overview for the example values
"Find the 5 nearest matches to the kevin101’s photo ID"
curl https://app.graft.com/v1/query -H 'Content-Type: application/json' -X POST -d '{
"secret": "somethingiamnotgoingtosaveingithub",
"organization": "supervillain",
"project": "world_domination",
"output_format": "csv",
"entity": "despicable_plan_1",
"embedding_name": "my_embedding",
"entity_columns": ["id", "name", "speciality", "number_of_fims", "id_photo"],
"entity_knn_id": "kevin_101",
"entity_knn_k": 5
}'