How This Helps
Semantic Search lets you find images using plain language. A query like “car on highway at night” returns visually and contextually relevant results—even if none of the images are explicitly labeled that way.
Prerequisites
- A dataset ID (visible in the browser URL when viewing a dataset:
https://app.visual-layer.com/dataset/<dataset_id>/data). - A valid JWT token. See Authentication.
- Caption search (
captionparameter): requires CAPTION_IMAGES enrichment. - Semantic vector search (VQL
textfilter): requires MULTIMODEL_IMAGE_ENCODING or CAPTION_IMAGES enrichment. - Full-text search (VQL
fts): works on any dataset with captions.
Check which enrichment models are applied to your dataset by calling
GET /api/v1/enrichment/{dataset_id}/context.Caption Search
Thecaption query parameter searches across AI-generated captions using semantic similarity.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
caption | string | Yes | Natural language search query. |
entity_type | string | Yes | IMAGES or OBJECTS. |
threshold | integer | No | Clustering granularity (0–4). Use 0 for finest granularity. |
textual_similarity_threshold | float | No | Minimum similarity score to include in results (0.0–1.0). |
page_number | integer | No | Page index for pagination (0-based, 100 clusters per page). |
labels | string | No | Filter by label. Format: ["label1","label2"]. Labels are generated by the IMAGE_TAGGING enrichment model. |
tags | string | No | Filter by tag UUID. Format: ["uuid1","uuid2"]. Tag UUIDs are returned in search responses and visible in the Visual Layer UI. |
Example
Response
Understanding relevance_score
When relevance_score_type is cosine_distance, a lower score means a stronger match.
0.0–0.4— strong match0.4–0.6— partial match0.6+— loosely related
textual_similarity_threshold to filter out weak matches. A value of 0.5 returns only results with a score below 0.5 (higher similarity).
The
image_caption parameter is deprecated. Use caption instead.VQL Text Search
Visual Query Language (VQL) is the preferred approach for advanced text queries. It supports both full-text search and semantic vector search, and it composes cleanly with other filters. Pass VQL as a JSON array in thevql query parameter.
Full-Text Search
Full-text search (fts) matches captions using stemming and keyword ranking.
Semantic Search
Semantic search (semantic) uses vector embeddings to find conceptually similar content — even when the exact words don’t appear in the captions.
threshold in the VQL filter (0.0–1.0) sets the minimum similarity score for results.
Combining Filters with VQL
VQL filters combine with AND logic. The following example finds semantically similar images that are also labeled as vehicles.Available VQL Filter Types
| Filter | Description | Example |
|---|---|---|
text | Search by caption text (fts or semantic) | {"text": {"op": "semantic", "value": "dog"}} |
labels | Filter by classification labels | {"labels": {"op": "one_of", "value": ["cat"]}} |
tags | Filter by user tag UUIDs | {"tags": {"op": "is", "value": ["uuid"]}} |
issues | Filter by quality issues | {"issues": {"op": "issue", "value": "blur", "mode": "in"}} |
duplicates | Show duplicate clusters | {"duplicates": {"op": "duplicates", "value": 0.95}} |
uniqueness | Filter by uniqueness score | {"uniqueness": {"op": "uniqueness", "value": 0.8}} |
Python Example
Response Codes
See Error Handling for the error response format and Python handling patterns.| HTTP Code | Meaning |
|---|---|
| 200 | Results returned successfully. |
| 401 | Unauthorized — check your JWT token. |
| 404 | Dataset not found. |
| 422 | Invalid query parameters — check VQL syntax. |