Skip to main content
High-level overview of the official SDKs. For endpoint details, see the API 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, filters) → 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, 'moss-minilm') // creates & syncs
await client.loadIndex('faqs') // loads from cloud or cache
const results = await client.query('faqs', 'return a damaged product', 3, { alpha: 0.6 }) // alpha: 1.0 semantic, 0.0 keyword
await client.deleteIndex('faqs')

Common types

  • DocumentInfo{ id: string; text: string; metadata?: Record<string,string> }
  • AddDocumentsOptions{ upsert?: boolean }
  • alpha (query option) – blend semantic (1.0) vs keyword (0.0); defaults to semantic-heavy

Hybrid search controls

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

// Default (semantic heavy)
await client.query('faqs', 'return policy', 3) // alpha defaults to semantic-heavy (e.g., ~0.8)

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

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