Skip to main content

Official Python SDK for the InterpretAI public API.

Project description

interpretai

Official Python SDK for the InterpretAI public API.

This package wraps three feature surfaces — Public Reviewer, SSC SRS Review, and RCA — behind a resource-oriented client modelled on the OpenAI and Anthropic Python SDKs. Every long-running surface follows the same submit → get → wait shape.

Install

pip install interpretai

Quickstart

import os
from interpretai import Client
from interpretai.types.public_reviewer import ReviewRequest, Subject

client = Client(api_key=os.environ["INTERPRETAI_API_KEY"])

job = client.public_reviewer.submit(ReviewRequest(
    subjects=[
        Subject(text="Loves trail running and surfing.", label="a"),
        Subject(text="Mostly reads indoors.", label="b"),
    ],
    prompt="Which subject is more outdoorsy?",
    model_tier="tlarge",
))

result = client.public_reviewer.wait(job.job_id, timeout_s=120)
print(result.score, result.reasoning)

Async

import asyncio
from interpretai import AsyncClient
from interpretai.types.public_reviewer import ReviewRequest, Subject

async def main() -> None:
    async with AsyncClient() as client:
        job = await client.public_reviewer.submit(ReviewRequest(
            subjects=[Subject(text="..."), Subject(text="...")],
            prompt="...",
            model_tier="tlarge",
        ))
        result = await client.public_reviewer.wait(job.job_id)
        print(result.score)

asyncio.run(main())

Per-request overrides

fast = client.with_options(timeout=10.0, max_retries=0)
fast.public_reviewer.submit(...)

Configuration

The SDK reads two environment variables when the constructor parameters are not supplied:

  • INTERPRETAI_API_KEY — your API key (must start with iai_).
  • INTERPRETAI_BASE_URL — base URL (defaults to https://stage-app.interpretai.tech).

Resources

Resource Methods
client.auth me()
client.public_reviewer submit(), get(job_id), wait(job_id, ...)
client.ssc submit(), get(job_id), wait(job_id, ...)
client.rca submit(), get(job_id), wait(job_id, ...)

See the top-level SDK README for design notes and roadmap.

License

Apache-2.0

Project details


Download files

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

Source Distribution

interpretai-0.1.0.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

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

interpretai-0.1.0-py3-none-any.whl (36.7 kB view details)

Uploaded Python 3

File details

Details for the file interpretai-0.1.0.tar.gz.

File metadata

  • Download URL: interpretai-0.1.0.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for interpretai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aba0fdd9b3b4c8c11354f01ff918d80a9c98c47bcb0ec8e53f35a0d9e25e45e1
MD5 300ba80b67a469641b9c484602d9c317
BLAKE2b-256 4f2cc69ff5e09ab34a067eca68c28d2c650638d43dc1eb870f8292daadcbfa30

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for interpretai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 defc68440fa3a91a8c1032cc5a673c35bf14ee94910d7694a07710be438979a2
MD5 0ec09c6403adac31b5c1d6fa5625e37c
BLAKE2b-256 bc47f198a7a7dc902dbb7be20f9ef2388ee9fc3f9dbc0573c55e0a541713dc05

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