n8n

How to Automate Qdrant Anomaly Thresholds?

Set medoids and clear thresholds in Qdrant to spot outliers in crop clusters. This helps data teams build stable anomaly rules without hand tuning every group. It works for image or text embeddings stored in a vector database.

The run starts on click. It gathers total points and crop counts, then splits by each crop name. For each group, it calls the Qdrant distance matrix, builds a sparse matrix in Python, picks the medoid, marks it in Qdrant, gets its vector, then measures distances to set a threshold using the Nth furthest point. A second branch embeds simple text crop descriptions with Voyage AI, finds a medoid by text, and sets a matching threshold. Results from both paths are merged to keep numeric and text logic aligned.

You need Qdrant with a collection that has a crop_name field and vectors indexed for voyage. You also need a Voyage AI key for the text step. Expect faster rollout of anomaly checks, fewer manual reviews, and reliable limits per cluster. Good for quality control on farm imagery, dataset cleanup, and watching for changes over time in data.

What are the key features?

  • Manual start for safe, controlled runs during setup or audits
  • Counts total points in the collection to size API calls correctly
  • Builds per crop clusters using facet counts and splits processing by crop_name
  • Calls Qdrant distance matrix per cluster to compute pairwise distances
  • Uses Python to build a sparse matrix and choose the medoid point
  • Marks the medoid in Qdrant payload and fetches its vector for scoring
  • Calculates a threshold from the Nth furthest distance and writes it back to Qdrant
  • Embeds plain text crop descriptions with Voyage AI to find a text based medoid and threshold
  • Merges text and distance results so both views stay in sync

What are the benefits?

  • Reduce manual threshold work from 3 hours to 10 minutes per dataset
  • Streamline cluster setup by about 70 percent with automatic medoid selection
  • Improve consistency of anomaly scores with a single rule per cluster
  • Scale to hundreds of points per cluster without custom scripts
  • Connect Qdrant and Voyage AI to align vector and text signals

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You will need accounts with Qdrant and Voyage AI. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, create a Qdrant credential: double click any Qdrant HTTP Request node, open the Credential to connect with menu, click Create new credential, then follow the on screen steps. Use your Qdrant URL and API key from the Qdrant dashboard.
  4. Set the cluster details: open the Qdrant cluster variables node and enter your Qdrant Cloud URL and the collection name that holds your vectors and crop_name payload.
  5. Open the Crop Counts node and click Execute node to confirm the collection count returns a value. If it fails, check your Qdrant URL and key.
  6. Open Info About Crop Clusters and ensure your payload contains crop_name. The flow expects crop_name to group points.
  7. Configure threshold behavior: in the Medoids Variables and Text Medoids Variables nodes, set which furthest point rank to use when drawing the threshold.
  8. Create a Voyage AI credential: double click the Embed text node, choose Credential to connect with, click Create new credential for HTTP Header Auth, and paste your Voyage AI key from the Voyage AI account page.
  9. Run a test: click the manual trigger Test workflow button. After completion, verify in Qdrant that medoid points have is_medoid set and threshold scores are written.
  10. If distance matrix calls are slow, reduce sample and limit values or skip very large labeled clusters. Make sure the using field matches your vector configuration, for example voyage.
  11. Validate thresholds: run a few searches in Qdrant for known normal and known odd samples and confirm the scores align with the stored threshold.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Qdrant

Sign up

Free tier: $0, 1 GB free cluster (no credit card), accessible via REST/GRPC API

Voyage AI

Sign up

Free tier via API: first 200M text tokens (embeddings) and 150B image pixels (multimodal). After free: as low as $0.02 per 1M tokens (voyage-3.5-lite); multimodal $0.12 per 1M tokens + $0.60 per 1B pixels (min $0.00003/image).

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.