Skip to main content

bizSupply Plugin SDK

The official SDK for developing plugins and benchmarks for the bizSupply document processing platform.

This SDK is designed exclusively for the bizSupply platform. It provides base classes, testing utilities, and CLI tools for building plugins that run inside the bizSupply engine. The SDK has no standalone functionality — a bizSupply account is required. Sign up at bizsupply.ai to get started.

Quick Start

# Install the SDK
pip install bizsupply-sdk

# Create a new plugin project
bizsupply init classification --name my-classifier
cd my-classifier

# Create a new benchmark
bizsupply init benchmark --name energy-price

# Validate your code
bizsupply validate src/plugin.py

# Run tests
pytest tests/

Plugin Types

Type Purpose Base Class Required Method
Source Ingest documents from external sources SourcePlugin fetch(), has_new_data()
Classification Categorize documents with labels ClassificationPlugin classify()
Extraction Extract structured data from documents ExtractionPlugin extract()
Benchmark Score and compare documents BaseBenchmark score(), compute(), compare()

Example: Classification Plugin

from typing import Any
from bizsupply_sdk import ClassificationPlugin, Document


class MyClassificationPlugin(ClassificationPlugin):
    """Classify documents using LLM analysis."""

    async def classify(
        self,
        document: Document,
        file_data: bytes | None,
        mime_type: str | None,
        available_labels: list[str],
        current_path: list[str],
        configs: dict[str, Any],
    ) -> str | None:
        """Classify a document by selecting from available_labels.

        The engine handles ontology tree traversal - just pick one label.
        Return None if no label matches.
        """
        # Use LLM to classify
        path_str = " > ".join(current_path) if current_path else "Root"
        prompt = f"Path: {path_str}\nOptions: {available_labels}\nSelect the best match."

        response = await self.prompt_llm(
            prompt=prompt,
            file_data=file_data,  # Gemini reads PDFs directly
            mime_type=mime_type,
        )

        # prompt_llm() returns dict | list | None
        category = response.get("category") if isinstance(response, dict) else None
        if category in available_labels:
            return category
        return None

Example: Benchmark

from bizsupply_sdk import BaseBenchmark, BaseKpi, stats


class EnergyPricePerKwh(BaseKpi):
    """What is measured, read off the contract's own fields."""

    unit = "EUR/kWh"

    def compute(self, document) -> float | None:
        # price_per_kwh is derived from the contract's invoices by the platform's
        # enrichment step before the benchmark runs; the KPI never sees the invoices.
        return document.get("price_per_kwh")


class EnergyPriceBenchmark(BaseBenchmark):
    """Flag energy contracts priced above the market."""

    name = "energy_contract_price"
    target_labels = ["contract", "utilities_contract", "energy"]
    kpi = EnergyPricePerKwh()
    min_sample_size = 10
    dimensions = ["country"]

    def compute(self, results) -> float:
        return stats.robust_median(results)  # the market price

    def compare(self, document_value: float, benchmark_value: float) -> bool:
        return document_value > benchmark_value  # paying more than market

Testing Your Plugin

import pytest
from bizsupply_sdk.testing import MockPluginServices, create_test_document


@pytest.fixture
def mock_services():
    return MockPluginServices(
        llm_responses={"default": "Contract"}
    )


async def test_classification(mock_services):
    plugin = MyClassificationPlugin()
    mock_services.configure_plugin(plugin)

    document = create_test_document(content="Contract agreement...")

    result = await plugin.classify(
        document=document,
        file_data=b"test content",
        mime_type="application/pdf",
        available_labels=["Contract", "Invoice", "Report"],
        current_path=[],
        configs={},
    )

    assert result == "Contract"
    assert mock_services.llm_call_count == 1

CLI Commands

Command Description
bizsupply init <type> Scaffold a new plugin or benchmark (source, classification, extraction, benchmark, ontology)
bizsupply validate <file> Validate plugin or benchmark code structure
bizsupply tutorial Interactive development workflow tutorial

Documentation

License

MIT License - see LICENSE file for details.

Metadata

Release files for bizsupply-sdk 0.17.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bizsupply-sdk 0.17.0
File Size Uploaded Provenance Actions
bizsupply_sdk-0.17.0.tar.gz 72.9 kB Without provenance Details for bizsupply_sdk-0.17.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bizsupply-sdk 0.17.0
File Interpreter ABI Platform Actions
bizsupply_sdk-0.17.0-py3-none-any.whl Python 3 none any Details for bizsupply_sdk-0.17.0-py3-none-any.whl

Total release size: 157.6 kB

Release files / bizsupply_sdk-0.17.0.tar.gz

Download URL bizsupply_sdk-0.17.0.tar.gz
Size 72.9 kB
Tags Source
SHA-256 checksum
How to use checksums
15a7552f2ff6c65d6bd0cbf87123638ba5e2b5bc58b83c4570f85a91d520bba7
BLAKE2b-256 checksum
How to use checksums
a2b5e97b30543f8659c9cba14012e3cac95cc410ba86c796bb4edc03d54fccb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / bizsupply_sdk-0.17.0-py3-none-any.whl

Download URL bizsupply_sdk-0.17.0-py3-none-any.whl
Size 84.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24dcbe09bc827938c412e858e64da5c46c79d06ae520e46ee93684b8b7aa3318
BLAKE2b-256 checksum
How to use checksums
93da580968beabb49f02581a54457bba7c058626d8ce23cc07be73be10a5209e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for bizsupply-sdk 0.17.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page