Metadata-Version: 2.4
Name: mikro-sdk
Version: 0.1.0
Summary: Python client for the Mikro.ai API.
Author: Mikro.ai
License: UNLICENSED
Project-URL: Homepage, https://mikro.ai
Project-URL: Documentation, https://mikro.ai
Keywords: mikro,retrieval,audit,vector
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# Mikro Python SDK

Public Python client for the `Mikro.ai` API.

## What It Covers

- staged asset upload from bytes, file-like objects, or filesystem paths
- vector recommendation and saved retrieval audit flows
- Labs publish, browse, and resolve routes
- control-plane, runner, and operator routes
- operator metrics scrape via `client.control.get_metrics()`
- long-polling with `wait_for_run()`

## Install Locally

```bash
pip install -e packages/sdk-py
```

## Basic Usage

```python
from pathlib import Path

from mikro_sdk import create_client

client = create_client(
    base_url="http://127.0.0.1:3030",
    api_key="your-project-key",
    project_slug="demo",
)

staged = client.assets.stage_source(
    Path("./corpus.zip"),
    file_name="corpus.zip",
    media_type="application/zip",
)

audit = client.vector.create_audit(
    {
        "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",
        },
    }
)

terminal_run = client.control.wait_for_run(audit["output_packet"]["recommend_run_id"])
```

`publish_labs_report=True` requires a public `workload_ref`.

## Publish

```bash
npm run release:check:sdk-py
python3 -m twine upload packages/sdk-py/dist/*
```

This package publishes as `mikro-sdk` once PyPI credentials and `twine` are available on the publishing machine.
