Skip to main content
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)
  • Multi-index support and privacy-first footprint (Rust core under the hood)

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 @inferedge/moss
  • Python: pip install inferedge-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 '@inferedge/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> }
  • MutationOptions{ upsert?: boolean }
  • QueryOptionsJavaScript: { topK?: number; embedding?: number[] } · Python: QueryOptions(top_k?: int, alpha?: float, embedding?: Sequence[float])
  • alpha (Python query option) – blend semantic (1.0) vs keyword (0.0); defaults to semantic-heavy

Hybrid search controls

await client.query('faqs', 'return policy', { topK: 3 })

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