Similar imagery tool
The SimilarImageryTool, which an agent sees as FindSimilarImagery, finds images whose stored vectors are nearest to a query image. The query is an image: a document id already in the index (like), or a URL (image_uri).
Two ways to name the query image
Pass like with a document id already in the index. The tool reuses that document's stored vector, so the query and the index are in the same embedding space. Pass image_uri with a URL of a query image. Give exactly one of like or image_uri.
When using image_uri, the cluster fetches the image and embeds it with model_id / provider. Use the same model that produced the field's vectors. Supported URI schemes are https, s3, gs, and azure.
Scores
A k-nearest-neighbour search returns up to k results, the nearest neighbours in the index. With min_score set, only neighbours at or above that score are returned.
The score is an ordering in the field's space (l2, cosine, inner product). Compare scores only within the same index and model.
Parameters
| Parameter | Required | Description |
|---|---|---|
index | Yes | The index holding the imagery. |
embedding_field | Yes | The knn_vector field holding each image's embedding. |
like | One of like or image_uri | Document id whose stored vector is reused. |
image_uri | One of like or image_uri | URL of the query image, embedded at query time. |
model_id | With image_uri | The embedding model that produced the field's vectors. |
provider | No | Embedding backend. Default depends on the node; see Local image embedding for onnx. |
k | No | How many neighbours to return. Default is 10. Maximum is 50. |
min_score | No | Neighbours at or above this score are returned. |
filter | No | A phrase that restricts which documents are candidates. |
label_field | No | A field used to name each result in the answer. |
Register a flow agent that runs the SimilarImageryTool
POST /_plugins/_agent/agents/_register
{
"name": "Imagery_Agent",
"type": "flow",
"description": "finds visually similar scenes",
"tools": [
{
"type": "SimilarImageryTool",
"name": "DemoFindSimilarImagery",
"parameters": {
"index": "scenes",
"embedding_field": "embedding"
}
}
]
}
POST /_plugins/_ml/agents/<agent_id>/_execute
{
"parameters": { "like": "chip-441" }
}
Related tools
- Search by a text description:
VectorDBToolorFindByMeaning - What is inside one raster:
FindImageRegions