Semantic Search
Query your content using natural language
Basic Query
Search your documents/text with natural language
const response = await fetch(`${baseUrl}/seeds/query?${params}`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({
query: 'What are the quarterly revenue figures?',
limit: 10,
threshold: 0.7
})
});
const { results } = await response.json();
results.forEach(result => {
console.log({
seedId: result.seedId,
content: result.content,
similarity: result.similarity,
title: result.title
});
});Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| query | string | required | Natural language search query |
| limit | number | 10 | Max results (1-100) |
| threshold | number | 0.7 | Minimum similarity (0-1) |
| seedIds | string[] | null | Filter to specific seeds |
| imageData | string | null | Base64 image for visual search |
Tip: Lower threshold (0.5) = more results. Higher threshold (0.8+) = more precise results.
Filter by Seeds or Bundles
// Search within specific seeds
const response = await fetch(`${baseUrl}/seeds/query?${params}`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({
query: 'What are the key findings?',
seedIds: ['seed-123', 'seed-456'],
limit: 10
})
});
// Search within a bundle
async function searchBundle(bundleId: string, query: string) {
// Get seeds in bundle
const bundleRes = await fetch(`${baseUrl}/bundles/${bundleId}/seeds?${params}`, { headers });
const { seeds } = await bundleRes.json();
const seedIds = seeds.map((s: any) => s.id);
// Search those seeds
return fetch(`${baseUrl}/seeds/query?${params}`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({ query, seedIds, limit: 10 })
}).then(r => r.json());
}Multimodal Search
Search using images
// Image-to-text search
const imageData = await imageToBase64(imageFile);
const response = await fetch(`${baseUrl}/seeds/query?${params}`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({
query: '', // Empty for image-only
imageData,
limit: 10
})
});
// Combined text + image search
body: JSON.stringify({
query: 'charts showing revenue',
imageData,
limit: 10
})Understanding Results
{
"results": [
{
"seedId": "seed-abc123",
"content": "The quarterly revenue increased by 15%...",
"similarity": 0.92,
"title": "Q3 Financial Report",
"type": "pdf",
"chunkIndex": 5
}
]
}High Similarity (0.8+)
Very relevant, directly answers query
Medium Similarity (0.6-0.8)
Related content, provides context