Skip to main content

Python SDK for the Ambertrace neurosymbolic AI platform API

Project description

AmbertraceAI Python SDK

Python client for the Ambertrace neurosymbolic AI platform API.

Install

pip install ambertraceai

Quick Start

from ambertraceai import AmbertraceAPI

api = AmbertraceAPI(
    base_url="https://app.ambertrace.ai",
    api_key="at_...",
)

# Create a domain
domain = api.domains.create(
    name="Legal Contracts",
    description="Contract analysis for risk and compliance",
)

# Upload data
dataset = api.datasets.upload(
    domain_id=domain["id"],
    file_path="contracts.csv",
)

# Build a platform (async — returns a job)
result = api.platforms.create(
    domain_id=domain["id"],
    dataset_id=dataset["id"],
)

# Wait for the build to finish
job = api.wait_for_job(result["job_id"], timeout=600)

# Query the platform
answer = api.platforms.query(
    platform_id=result["platform_id"],
    query="What are the highest-risk clauses?",
)
print(answer["answer"])
print(answer["explanation"])

Resources

Resource Methods
api.domains list, create, get, update, delete, build_ontology
api.datasets list, get, upload, fetch, quality, clean, preview, delete
api.platforms list, create, get, status, query, suggest_rules, list_suggestions, graph
api.predictions predict, list_configs, create_config, train, list_predictions
api.jobs get

Job Polling

Long-running operations (platform builds, data cleaning, training) return a job_id. Use wait_for_job to poll:

job = api.wait_for_job(job_id, timeout=300, poll_interval=5)
if job["status"] == "error":
    print(f"Failed: {job.get('error_message')}")

Error Handling

from ambertraceai import AmbertraceAPI, AmbertraceError

try:
    api.domains.get(999)
except AmbertraceError as e:
    print(e.status_code)  # 404
    print(e.code)         # "not_found"
    print(str(e))         # "Domain not found."

API Documentation

Full API reference: app.ambertrace.ai/openapi/redoc

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

ambertraceai-0.1.0.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

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

ambertraceai-0.1.0-py3-none-any.whl (107.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ambertraceai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f7df8456319c583e43c8b6b2b962bc3954de7d34e51e21943b48f2c3b49d0a1
MD5 20b411a207a422044d7aefed2ba197d2
BLAKE2b-256 c41fbe58f9f046d218f29076f0e379be2b9c95fea8e4452d908dcbb0abd91d12

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ambertraceai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b332c3a034bc156c306762ba1dfa22968d84aa5ceb038ac6ea55df0e92842db4
MD5 f5e7402f27df53fe97752407629004f7
BLAKE2b-256 33b09dbafbfee08192de975da91d6fa6fbe6b02e12cb0e3a2373550515aaefb5

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