import { MossClient } from '@inferedge/moss'
const client = new MossClient(process.env.MOSS_PROJECT_ID!, process.env.MOSS_PROJECT_KEY!)
await client.createIndex('my-index', [
{ id: 'doc-1', text: '...', metadata: { category: 'faq', tags: 'returns,shipping', lang: 'en' } },
{ id: 'doc-2', text: '...' }
], 'moss-minilm')
// Upsert more docs later
await client.addDocs('my-index', [
{ id: 'doc-2', text: 'updated text' }, // will be updated
{ id: 'doc-3', text: 'new text' }
], { upsert: true })
// Fetch specific docs
const subset = await client.getDocs('my-index', { docIds: ['doc-1', 'doc-3'] })
// Delete docs or the index when done
await client.deleteDocs('my-index', ['doc-3'])
await client.deleteIndex('my-index')