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.1.tar.gz (33.3 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.1-py3-none-any.whl (47.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: interpretai-0.1.1.tar.gz
  • Upload date:
  • Size: 33.3 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.1.tar.gz
Algorithm Hash digest
SHA256 c48e0d2e8ba1930842315cbfdf3529a60ee51077bb8ca918b66e6213c3d6ea63
MD5 a32e9d5d4fbd7e02124a76c11f6bced3
BLAKE2b-256 9c4fa13db5c7375f14513e5d499696317fd127346c37c35a22d83773e9c887f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: interpretai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 47.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9bfc817c17094033f3111c4a2972a259564203d20c47f2e76aef0f03c7d3aa59
MD5 6b815ccc93deb20d06f8678c8bd4252d
BLAKE2b-256 f01bc97153f1a40a62dc801f49d48b5f94f8cdba9d79c7266ce0780d9cb6d13e

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