open-index/open-npm huggingface dataset:
npm package: @mikro-ai/sdk-js
Description: JavaScript client for the Mikro.ai API.
Latest version: 0.1.1

# `@mikro-ai/sdk-js`

JavaScript client for the `Mikro.ai` API.

## What It Covers

- staged asset upload via `client.assets.stageSource()`
- vector recommendation and saved retrieval audits
- Labs publish, browse, and resolve flows
- memory-profile control flow
- runner, operator, and control-plane endpoints
- operator metrics scrape via `client.control.getMetrics()`
- run polling with `client.control.waitForRun()`

## Basic Usage

```ts
import { createClient } from "@mikro-ai/sdk-js";

const client = createClient({
  baseUrl: "http://127.0.0.1:3030",
  apiKey: process.env.MIKRO_API_KEY,
  projectSlug: "demo",
});

const staged = await client.assets.stageSource({
  file: await Bun.file("./corpus.zip").arrayBuffer(),
  fileName: "corpus.zip",
  mediaType: "application/zip",
});

const audit = await client.vector.createAudit({
  source: staged.source,
  query_set: [
    {
      query: "Which backend comparison is included?",
      expected_terms: ["qdrant", "pgvector"],
    },
  ],
  publish_labs_report: true,
  workload_ref: {
    source: "public",
    workload_id: "public-corpus-demo",
    workload_version: "v1",
  },
});

const terminalRun = await client.control.waitForRun(audit.output_packet!.recommend_run_id);
```

`publish_labs_report: true` requires a public `workload_ref`.

## Build

```bash
npm --workspace @mikro-ai/sdk-js run build
```

## Publish

```bash
npm run release:check:sdk-js
npm --workspace @mikro-ai/sdk-js publish
```

This package publishes as `@mikro-ai/sdk-js` once npm authentication is configured for the machine running the command.