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.

High-level overview of the official SDKs. For endpoint details, see the SDK Reference.

What’s included

  • On-device vector search with optional cloud sync for indexes
  • Semantic, keyword, and hybrid retrieval (tune via alpha)
  • Metadata filtering with rich operators ($eq, $ne, $gt/$gte/$lt/$lte, $in, $nin, $near, plus $and/$or)
  • Multi-index support with per-index embedding models

Use cases

  • Knowledge base search with cloud backup
  • Voice/agent knowledge with persistent indexes
  • Personal/edge search with cloud fallback

Install

  • JavaScript/TypeScript: npm install @moss-dev/moss
  • Python: pip install moss

Models

  • moss-minilm (default): fast, lightweight, great for edge/offline
  • moss-mediumlm: higher accuracy with reasonable performance

Client lifecycle

  • Create index with docs + model → Load index → Query (top_k, alpha) → Upsert/delete docs → Delete index when done

Examples (JS/Python)

import { MossClient, DocumentInfo } from '@moss-dev/moss'

const client = new MossClient(projectId, projectKey)

const docs: DocumentInfo[] = [
  { id: 'doc1', text: 'Track orders in your account.', metadata: { category: 'shipping' } },
  { id: 'doc2', text: '30-day return policy for most items.', metadata: { category: 'returns' } },
  { id: 'doc3', text: 'Change address via customer service.', metadata: { category: 'support' } },
]

await client.createIndex('faqs', docs, { modelId: 'moss-minilm' }) // creates & syncs
await client.loadIndex('faqs') // loads from cloud or cache
const results = await client.query('faqs', 'return a damaged product', { topK: 3 })
await client.deleteIndex('faqs')

Common types

  • DocumentInfo{ id: string; text: string; metadata?: Record<string,string>; embedding?: number[] }
  • MutationOptions{ upsert?: boolean; onProgress?: (progress) => void }
  • QueryOptions
    • JavaScript: { topK?: number; alpha?: number; embedding?: number[]; filter?: MetadataFilter }
    • Python: QueryOptions(top_k?: int, alpha?: float, embedding?: Sequence[float], filter?: dict)
  • alpha – blend semantic (1.0) vs keyword (0.0); default 0.8 (semantic-heavy)

Hybrid search controls

await client.query('faqs', 'return policy', { topK: 3, alpha: 0.0 }) // Pure keyword
await client.query('faqs', 'return policy', { topK: 3 })              // Default (semantic heavy)
await client.query('faqs', 'return policy', { topK: 3, alpha: 1.0 }) // Pure semantic

Sample code

  • Repo: moss-samples
  • JavaScript: javascript/comprehensive_sample.ts, javascript/load_and_query_sample.ts
  • Python: python/comprehensive_sample.py, python/load_and_query_sample.py
  • Python deps: pip install -r python/requirements.txt, then python path/to/sample.py
  • Python walkthrough:
Moss Python walkthrough