Skip to main content

percidian

The Python client for Percept One, Percidian's extraction API: send a document's text, get back a typed knowledge graph, every node, property and edge cited to the text it comes from.

pip install percidian

Python 3.10 or later.

Quickstart

Make an API key in the console (console.percidian.ai) and keep it in your server's environment as PERCIDIAN_API_KEY; the client reads it from there (or pass api_key=).

from percidian import Percidian

client = Percidian()
result = client.extract(model="percept-1", text="Maya Chen is the CEO of Northstar Labs, based in Boston.")
for node in result.graph.nodes:
    print(node.type, node.label)

AsyncPercidian has the same methods, awaited.

Waiting for results

extract and fill return the job's result however long the job runs. The API holds the request up to 280 seconds and answers with the job if it is still running; the client then polls jobs.get_result until the job ends. A failed job raises ConflictError with the code job_failed. Their requests time out after 330 seconds at the least.

  • prefer="respond-async" returns the job (JobAccepted) at once: fetch its result later with client.jobs.get_result(job.id), or take its webhook.
  • format="neo4j" returns a Neo4JGraph, format="jsonld" the JSON-LD as a dict, and format="csv" (with table) the CSV text.

Batches

A batch is JSON Lines, one request a line, sent as bytes:

import json

lines = [
    {"custom_id": "memo-1", "method": "POST", "url": "/v1/extract", "body": {"model": "percept-1", "text": "..."}},
    {"custom_id": "memo-2", "method": "POST", "url": "/v1/extract", "body": {"model": "percept-1", "text": "..."}},
]
batch = client.batches.create(request="\n".join(json.dumps(line) for line in lines).encode())
# Later: one BatchResult a line, matched to your requests by custom_id.
for line in client.batches.get_results(batch.id).splitlines():
    print(json.loads(line)["custom_id"])

Errors and retries

Each error status has its class (BadRequestError, UnauthorizedError, PaymentRequiredError, TooManyRequestsError, ConflictError, ...), and its body.error.code says what went wrong:

from percidian import TooManyRequestsError

try:
    client.extract(model="percept-1", text=text)
except TooManyRequestsError as error:
    print(error.body.error.code, error.body.error.limit, error.headers.get("retry-after"))

The client retries 408, 409, 429 and 5xx answers twice, waiting as Retry-After says (60 seconds at most); set max_retries on the client or in request_options. Every extract, fill, match and batches.create carries an Idempotency-Key (a new UUID unless you pass idempotency_key), the same on each retry, so a retry never runs or bills twice. A dropped connection during extract or fill is retried the same way.

Webhooks

Percept signs each webhook as Standard Webhooks does. Check one with the raw body, exactly as received:

from percidian import WebhookVerificationError, verify_webhook

try:
    event = verify_webhook(secret, request.headers, request.get_data())
except WebhookVerificationError:
    ...  # answer 400

secret is the endpoint's whsec_ secret (client.webhooks.endpoints.create or get_secret), or for a request's webhook_url the organization's (client.webhooks.get_secret()). A timestamp more than 5 minutes off is refused.

Reference

Every method is in reference.md.

Metadata

Release files for percidian 0.1.1

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

Source distribution (sdist)

Source distribution for percidian 0.1.1
File Size Uploaded Provenance Actions
percidian-0.1.1.tar.gz 119.6 kB With provenance Details for percidian-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for percidian 0.1.1
File Interpreter ABI Platform Actions
percidian-0.1.1-py3-none-any.whl Python 3 none any Details for percidian-0.1.1-py3-none-any.whl

Total release size: 366.2 kB

Release files / percidian-0.1.1.tar.gz

Download URL percidian-0.1.1.tar.gz
Size 119.6 kB
Tags Source
SHA-256 checksum
How to use checksums
91010a93d64f9753150d7f100c56bdb0bf8e3aa0797cb130400873cbc75f7e81
BLAKE2b-256 checksum
How to use checksums
0fdd805ee748b70d3b5dbea0fa6c0039d233de2a6f79d16d89366c0ca65e0005
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / percidian-0.1.1-py3-none-any.whl

Download URL percidian-0.1.1-py3-none-any.whl
Size 246.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
881359be56ea04cd9aaa40bdd76a320f44dbd252821e2ad6d7315ffba99c4414
BLAKE2b-256 checksum
How to use checksums
62efdfa43b2a8483d8bb7fd01c4026893ea3cca2bd22e499715b0ce13bedb84d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for percidian 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for percidian-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

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.1 This release

2 release files Full 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