Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.moss.dev/llms.txt

Use this file to discover all available pages before exploring further.

Strategies

  • Vector similarity (semantic)
  • Keyword/BM25
  • Hybrid (best of both)
import { MossClient } from '@moss-dev/moss'
const client = new MossClient(process.env.MOSS_PROJECT_ID!, process.env.MOSS_PROJECT_KEY!)
await client.loadIndex('my-index')
const byVector = await client.query('my-index', 'getting started latency', { topK: 5 })

Hybrid weighting (alpha)

  • alpha = 1.0: pure semantic (embeddings)
  • alpha = 0.0: pure keyword
  • Between 0 and 1 blends the two (default is semantic-heavy, 0.8)
// Blend semantic and keyword scores (60/40)
const hybrid = await client.query('my-index', 'return policy', { topK: 3, alpha: 0.6 })

// Pure keyword
const keywordOnly = await client.query('my-index', 'return policy', { topK: 3, alpha: 0.0 })

// Pure semantic
const semanticOnly = await client.query('my-index', 'return policy', { topK: 3, alpha: 1.0 })

Metadata filtering

Narrow query results to documents whose metadata matches a filter. Metadata filtering is evaluated on the locally loaded index — call loadIndex() / load_index() before querying with a filter. Supported operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $near. Compose filters with $and / $or.
await client.loadIndex('products')

const results = await client.query('products', 'running shoes', {
  topK: 5,
  alpha: 0.6,
  filter: {
    $and: [
      { field: 'category', condition: { $eq: 'shoes' } },
      { field: 'price',    condition: { $lt: 100 } },
    ],
  },
})

Tuning

  • Adjust topK / top_k and score thresholds
  • Layer metadata filters to narrow candidate sets
  • Group queries by intent (e.g., returns, billing, onboarding) and tune per index
  • Choose model per index: moss-minilm (fast) or moss-mediumlm (more accurate)