Skip to main content

Python client for the Mikro.ai API.

Project description

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

pip install -e packages/sdk-py

Basic Usage

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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mikro_sdk-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file mikro_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mikro_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mikro_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c92a3e8803da57a751935edead1894b3ff03847afc940dbc49606aa15f6b821
MD5 ba4e2d48afadfc016bf3f2bdecdbdf19
BLAKE2b-256 b85676a97933e0ba75e872520c7778f4b6caff634b667e5caf79a0b91ceb14cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page