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

ParameterTypeDefaultDescription
querystringrequiredNatural language search query
limitnumber10Max results (1-100)
thresholdnumber0.7Minimum similarity (0-1)
seedIdsstring[]nullFilter to specific seeds
imageDatastringnullBase64 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