Mindket

Medoid and threshold for each crop group saved in Qdrant

Newversion 1 · updated

Overview

An n8n workflow you start by hand: for each crop in a Qdrant collection it picks a medoid, the most typical photo, in two ways. It saves a similarity threshold on each, for anomaly checks.

Medoid and threshold for each crop group saved in Qdrant is an n8n workflow in the Developer category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

At a glance

Runs in
  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file and steps
  • Qdrant Cloud or your own Qdrant: the collection holds the photos, and the results are saved on its points
  • An anomaly check of your own: read the flags and thresholds from the payloads

Platform

Connects 2 apps

How it works

Trigger

Manual run

It starts when you press Execute workflow, with these values set in nodes:

  • The Qdrant cluster address and the collection name, set in Qdrant cluster variables
  • furthestFromCenter, 5 for the distance matrix branch and 1 for the text branch
  • The crop descriptions, written in Textual (visual) crop descriptions

Actions

  1. The points are counted, and Qdrant lists each crop name with its number of photos
  2. For each crop, Qdrant returns the similarity between all its photos, and a Code node picks the photo most similar to the rest as the medoid
  3. The medoid is flagged in Qdrant, and the photo furthest from it, or the fifth furthest, sets its threshold
  4. Voyage AI embeds each crop description, and the nearest photo of that crop becomes a second medoid
  5. The second medoid is flagged and gets its own threshold in the same way

Result

Four payload fields on the chosen points in your Qdrant collection: the two medoid flags and the two thresholds

Integrations

What you need before you start.

Qdrant

Vector database

Counts the points, lists the crops, returns the distance matrix and the nearest photos, and stores the flags and thresholds as payloads.

NeedsA Qdrant cluster address and an API key, in a Qdrant API credential, and a filled collection

Voyage AI

Embedding model

Turns each crop description into a query vector with voyage-multimodal-3.

NeedsA Voyage AI API key, in a Header Auth credential

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
26 steps, starting by hand
AI
No step calls an AI model
Sign-ins
Signs in to: Qdrant and api.voyageai.com
API keys
No API key is left in the file
Step types
Mindket’s checker reads all 6 of its step types

Read from the workflow’s file, not from a run.

About

What it is

This n8n workflow prepares a Qdrant collection for anomaly checks on pictures. A manual trigger starts it. For each crop it finds a medoid, the photo most similar to all the others of that crop, in two ways. One uses the similarity between photos. The other embeds a written description of the crop with Voyage AI and takes the nearest photo. Each medoid is flagged in Qdrant and gets a similarity threshold. Twenty-six nodes do the work, beside twenty-two sticky notes.

Who it suits

ML engineers who keep labelled images in Qdrant and want a typical photo and a cutoff score for each class. Skip it if you need the anomaly check itself. This file only writes the numbers that such a check reads.

Who uses it, and how
IndustryWho uses itHow they use itExample
AgricultureQuality teamsFind the typical photo of each crop and a cutoff for odd onesA team stores the medoid and a threshold for cucumber.
ManufacturingInspection engineersPrepare a reference photo and a cutoff for each product classAn engineer flags the most typical photo of each part type.
RetailCatalog teamsSpot listing photos that do not match their categoryA team keeps a threshold for each category to catch a wrong photo.
Machine learningData scientistsCompare a medoid from the distance matrix with a text anchored oneA scientist checks whether the two medoids of a class are the same photo.

You need solid n8n and some Qdrant for this one: eleven calls to its API and a collection built in a set way.

Where to use it

Any n8n that can reach Qdrant and Voyage AI will run it. It works on a collection that a batch upload has already filled.

  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file and steps
  • Qdrant Cloud or your own Qdrant: the collection holds the photos, and the results are saved on its points
  • An anomaly check of your own: read the flags and thresholds from the payloads

Setup

Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Two accounts are needed.

What you need first
NeedDetail
n8nOn n8n Cloud or on a server of your own
QdrantA cluster address and an API key in a Qdrant API credential. The collection needs a named vector voyage, a crop_name payload field and a keyword index on it
Voyage AIAn API key, saved in a Header Auth credential named Authorization with the value Bearer and your key
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. Add the Qdrant API credential and select it in the eleven HTTP Request nodes that call Qdrant, from Total Points in Collection to Set text medoid threshold score.
  3. Add the Voyage Header Auth credential and select it in Embed text.
  4. Open Qdrant cluster variables. Replace <YOUR_QDRANT_CLUSTER_URL> with your cluster address and set collectionName to your collection.
  5. Check Medoids Variables and Text Medoids Variables. Their furthestFromCenter decides which point sets the threshold. The file uses 5 and 1.
  6. Open Textual (visual) crop descriptions and replace the 29 crops with your own classes.
  7. Press Execute workflow.

How to use it

Press Execute workflow. The run goes through each crop in the collection and writes four payload fields on the chosen points. Read them back in Qdrant afterwards.

What to change for a different result
To changeWhere
Which point sets the thresholdfurthestFromCenter in the two variable nodes. 1 is the furthest photo, 5 the fifth furthest
The crops and their descriptionsTextual (visual) crop descriptions
The payload namesThe bodies of the four nodes that start with Set
The collectioncollectionName in Qdrant cluster variables

Example

The collection holds many photos labelled cucumber.

The distance matrix branch picks the photo most similar to all other cucumber photos and flags it is_medoid. It then saves the similarity between that photo and the fifth furthest cucumber photo as its threshold. The text branch does the same from a written description.

For newcomers and experts

If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. A medoid is a real photo from the group that sits nearest the middle. A threshold is the lowest similarity to it that still belongs to the group.

For experts. Qdrant’s distance matrix call returns row and column offsets with scores. The Code node sums the scores by row, and the furthest points come from a search with the medoid’s vector multiplied by -1.

Where to look closer
NodeWhat it doesWhat to know
Cluster Distance MatrixPosts to the matrix offsets endpoint with sample and limit set to the biggest group sizeThe cost grows with the square of the group size, which a sticky note warns about
Find MedoidCode, run once for each itemIt adds the scores by row and returns the id of the highest
Searching ScoreExact query with the flipped vectorlimit is furthestFromCenter, and the last score times -1 is the threshold
MergeCombines descriptions and crops by cropNameA crop with no description is left out of the text branch

Good to know

The scipy step was rewritten, and the anomaly check itself is not included.

  • Code: the original medoid step was a Python Code node that used scipy. In n8n 2, native Python cannot import libraries and has no _input (n8n’s docs, read on 12 November 2026). Mindket’s copy, named Find Medoid, adds the scores in JavaScript and picks the same point
  • Not included: the check that compares a new picture with the medoid and threshold is a separate workflow
  • Second runs: Qdrant saves a payload only on the points named in the call, so if your data changed, the old medoid keeps its flag until you clear it
  • Descriptions: the 29 crop descriptions are written into the file, and a sticky note says a chat model made them
  • Your data: the descriptions go to Voyage and the payloads go to your collection. The file holds no credential

README and files

README

Medoid and threshold for each crop group saved in Qdrant

An n8n workflow you start by hand. For every crop in a Qdrant collection it picks a medoid, the photo most similar to the others in its group, in two ways, and saves a similarity threshold on it for later anomaly checks.

What is inside

  • workflow.json: the workflow as n8n exports it, forty-eight nodes. Twenty-six do the work and twenty-two are sticky notes that explain the steps. It holds no credential.
  • README.md: these notes.

What we changed from the original copy

  • The step that finds each group's medoid was a Python Code node that used scipy. In n8n 2, native Python offers only _items and _item, has no _input, and cannot import libraries such as scipy (n8n's docs, read on 12 November 2026). Mindket's copy, renamed Find Medoid, adds up each point's similarity scores in JavaScript and picks the point with the highest total, which is what the original did. One sticky note now says so.
  • The Qdrant cluster address belonged to the original author. It is now the placeholder <YOUR_QDRANT_CLUSTER_URL>.
  • Several nodes were linked to credentials in the author's n8n. The links are gone, so select your own.
  • Nothing else. The thresholds, the crop descriptions and the other sticky notes are the file's own.

Before you start

  • An n8n instance, on n8n Cloud or your own server.
  • A Qdrant collection of labelled photos, made the way a batch upload does it: a named vector voyage from the Voyage model voyage-multimodal-3, a crop_name payload field on every point and a keyword payload index on crop_name. The file's collection is called agricultural-crops.
  • A Qdrant cluster address and an API key.
  • A Voyage AI API key, for the text branch.

Set it up

  1. In n8n, create a workflow, open its menu and choose Import from File. Pick workflow.json.
  2. Add a Qdrant API credential with your cluster address and key. Select it in every HTTP Request node that calls Qdrant. There are eleven, from Total Points in Collection to Set text medoid threshold score.
  3. Add a Header Auth credential for Voyage. Name it Authorization and give it the value Bearer <YOUR_VOYAGE_KEY> with your own key. Select it in Embed text.
  4. Open Qdrant cluster variables. Replace <YOUR_QDRANT_CLUSTER_URL> with your cluster address, with https:// in front and no slash at the end. Set collectionName to your collection.
  5. Check Medoids Variables and Text Medoids Variables. Their furthestFromCenter decides which point sets the threshold. The file uses 5 and 1.
  6. Open Textual (visual) crop descriptions and replace the 29 crops with your own classes, one sentence of how a typical specimen looks for each.
  7. Press Execute workflow.

How a run goes

  1. The manual trigger starts the run, and Qdrant cluster variables leads into two branches.
  2. In the upper branch, Total Points in Collection counts the points exactly. Next, Crop Counts asks Qdrant for the values of crop_name and how many points each has. After that, Info About Crop Clusters keeps the crop names and the size of the biggest group, and Split Out makes one item for each crop.
  3. For each crop, Cluster Distance Matrix asks Qdrant for the similarity between all the points of that crop. Find Medoid adds up the scores of each point and picks the highest. Set medoid id saves is_medoid on that point.
  4. Get Medoid Vector reads the medoid's vector, and Prepare for Searching Threshold flips its sign. Searching Score then finds the points closest to the flipped vector, which are the points furthest from the medoid. Threshold Score takes the last score and Set medoid threshold score saves it as is_medoid_cluster_threshold.
  5. In the lower branch, Textual (visual) crop descriptions holds one description for each crop. Merge pairs it with its crop, and Embed text turns it into a vector with Voyage, with input_type set to query.
  6. Get Medoid by Text finds the photo of that crop nearest to the description. Set text medoid id saves is_text_anchor_medoid on it, and the same threshold steps save is_text_anchor_medoid_cluster_threshold.

Change the result

  • Which point sets the threshold: furthestFromCenter in the two variable nodes. 1 is the furthest photo, 5 is the fifth furthest.
  • The crops and their descriptions: Textual (visual) crop descriptions.
  • The payload names: the bodies of the four nodes that start with Set.
  • The collection: collectionName in Qdrant cluster variables.

Good to know

  • The anomaly check that reads these thresholds is not in this file. The file only writes is_medoid, is_medoid_cluster_threshold, is_text_anchor_medoid and is_text_anchor_medoid_cluster_threshold.
  • Qdrant saves a payload only on the points named in the call. If your data changed between runs, the old medoid keeps its is_medoid flag, so clear the old payloads first.
  • A sticky note warns against the distance matrix call for groups of more than a couple of hundred photos.
  • A crop with no description is left out of the text branch, because Merge pairs by crop name.
  • Voyage bills the embeddings to your key. The descriptions go to Voyage, and the payloads are written to your Qdrant collection.
  • The file holds no credential and no key.
Files
NOTICE.md  707 B
README.md  5 KB
workflow.json  40 KB

3 files, 46 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-12

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

upscaler

uwg · Kit

Holds a set of image upscaling models gathered from the OpenModelDB community, for people who want to enlarge low-resolution pictures with AI on their own comp…

New

Pixel Art XL

nerijs · Kit

A pixel art style add-on for Stable Diffusion XL that turns text prompts into pixel-style images, with an optional LCM LoRA for faster runs. For game makers, d…

New

VibeVoice-1.5B

microsoft · Kit

Turns written conversations into spoken audio with up to four speakers and about 90 minutes of speech, an open Microsoft text-to-speech model for research on p…

New

Similar in Developer

See all in Developer

voicetut-egyptian-tashkeel

masterofaudio2077 · Kit

Reads Egyptian Arabic text aloud and follows the short vowel marks you write into it. A fine-tune of VoiceTut-TTS that keeps its 19 built-in voices and voice c…

New

Runs Meta's Llama 3.1 8B Instruct chat model in 4-bit AWQ form, so it fits on a GPU with about 4 GiB of free memory for the weights. For developers who want a…

New

Ru-Jev

besktech · Kit

Scores a Russian-first decision from a context and a list of options, giving a probability for yes/no, choice or rating questions. Runs on a plain CPU, for tea…

New