Skip to main content

Moose

Moose annotates personal data and privacy roles in text and tables with the W3C Data Privacy Vocabulary (DPV), or with your own schema.

  • An LLM finds and describes the mentions or columns.
  • A local System 1 model, Laya, gives every probability. LLMs are over-confident, so Moose never asks them for a number.

As a library, Moose runs on your machine. LLM calls go straight from your process to your provider with your key, and Laya runs locally. Nothing passes through a Moose server.

Install

pip install "moose-annotate[laya]"

The package is imported as moose.

  • laya: installs the System 1 model, which pulls in PyTorch. Its checkpoint, about 800 MB, downloads from Hugging Face on first use. Without laya, results have no probability ("confidence": null).
  • api: installs the REST API server (moose_api), as in the Docker image.

Python 3.12 or later is required.

Quick start

import os
from moose import Annotator, OpenRouterClient

moose = Annotator(OpenRouterClient(api_key=os.environ["OPENROUTER_API_KEY"], model="openai/gpt-oss-120b"))

result = moose.annotate_text("Agent: Thanks, Luca Bianchi. Your customer ID is USR 661 204.")
for e in result["entities"]:
    print(e["text"], e["type_id"], e["confidence"], e["decided_by"])
# Luca Bianchi  dpv-pd:Identifier  0.49  system1+llm
# USR 661 204   dpv-pd:Identifier  0.81  system1

print(moose.last_usage.calls, moose.last_usage.cost_usd)  # LLM calls and cost of that call

The key can also be a callable, called on every request, that reads a keychain or secrets manager:

import keyring
llm = OpenRouterClient(api_key=lambda: keyring.get_password("moose", "openrouter"), model="openai/gpt-oss-120b")

Other LLM clients:

  • OllamaClient(host="http://localhost:11434", token=None, model="qwen3:8b") for a local model;
  • OpenAICompatibleClient(base_url=..., model=..., api_key=...) for any OpenAI-compatible endpoint;
  • your own subclass of moose.LLMClient (one async generate(prompt) -> str method).

What it does

Method Input Output
annotate_text(text, schema="dpv_privacy") a text entities: span, type_id, confidence
annotate_texts(texts, ...) several texts one result per text
annotate_table(rows, schema="dpv_privacy") sample rows (dicts of column → value) a type per column
column_relationships(rows, subject_column, schema="cpa") sample rows the relation from the subject column to each other column
analyze_privacy(text=... or rows=...) a text or a table findings and recommended actions (GDPR policy pack)
schemas() available schemas
add_schema(payload), remove_schema(name) your own vocabulary bring your own schema

Each method has an async twin with an a prefix, for example await moose.aannotate_text(...). The sync methods also work inside a running event loop, such as a Jupyter notebook. Use either the sync or the async methods with one LLM client: its connections belong to one event loop.

Results have the same shape as the REST API's job results.

Schemas

  • dpv_privacy (the default): about 260 DPV personal-data categories and privacy roles.
  • dpv_pd: DPV's personal-data categories only, about 400.
  • dpv: all of DPV, 8,000+ concepts.
  • coarse, fine: general named-entity types.
  • cpa, schemaorg_cpa_v1: column relationships.
  • Your own schemas: see add_schema. They are stored under MOOSE_USER_DATA_DIR, by default ~/.moose.

Probabilities

Every confidence comes from Laya, never from the LLM:

  • Laya decided (decided_by is system1 or system1+llm): the chosen type's probability, exactly as in ranking.
  • The LLM decided (decided_by is llm): Laya's probability of "yes" to a plain question, such as "Is the mention Name?". It sees only that type's definition and is not told the LLM chose it.

The linker argument picks who decides:

  • system1+llm: Laya decides, and consults the LLM when unsure. It is the default for dpv_privacy.
  • system1: Laya alone.
  • llm: the LLM decides. It is the default for dpv.

calibrated says whether those probabilities matched accuracy on labelled data (DPVCallBench, expected calibration error of 0.10 or less):

Schema system1 system1+llm llm
dpv_privacy text 0.075 ✓ 0.052 ✓ 0.133
dpv_pd text 0.067 ✓ 0.067 ✓ 0.219
dpv text 0.254 0.238 0.176

Tables, column relationships and other schemas have no labelled data yet, so their results show "calibrated": false.

Configuration

Variable Default Purpose
MOOSE_USER_DATA_DIR ~/.moose where your own schemas are stored
MOOSE_LAYA_MODEL convaiinnovations/laya another Laya checkpoint (a Hugging Face id or a folder)
MOOSE_LAYA_DEVICE automatic cpu, cuda or mps

Metadata

Release files for moose-annotate 0.1.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 moose-annotate 0.1.0
File Size Uploaded Provenance Actions
moose_annotate-0.1.0.tar.gz 6.7 MB Without provenance Details for moose_annotate-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for moose-annotate 0.1.0
File Interpreter ABI Platform Actions
moose_annotate-0.1.0-py3-none-any.whl Python 3 none any Details for moose_annotate-0.1.0-py3-none-any.whl

Total release size: 13.4 MB

Release files / moose_annotate-0.1.0.tar.gz

Download URL moose_annotate-0.1.0.tar.gz
Size 6.7 MB
Tags Source
SHA-256 checksum
How to use checksums
01762bd782efaa7e75950f1d26bfd38d7a06a27a8ce84520a55f2f592dde96e7
BLAKE2b-256 checksum
How to use checksums
ac2434b1265a617c0bac4624ccc5f2d50c3ca6273088a3dbc4afc1d4c44a5246
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / moose_annotate-0.1.0-py3-none-any.whl

Download URL moose_annotate-0.1.0-py3-none-any.whl
Size 6.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
cb159d77180bf65658f91cd7f8ca158531a998d8c2a174e2056f210dfced3372
BLAKE2b-256 checksum
How to use checksums
f5b2e981528b4dc39126ffb9bdc4f947070792c44e8ec8ced33c8474b0281fb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for moose-annotate 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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