Skip to main content

StruAI Drawing Analysis SDK - AI-powered construction drawing analysis

Project description

StruAI SDK (Python + JavaScript)

Official SDKs for the StruAI Drawing Analysis API.

  • Python package: struai (PyPI)
  • JavaScript package: struai (npm, in js/)

Python Install

pip install struai

JavaScript Install

npm install struai

Quick Start (Python)

import os
from struai import StruAI

client = StruAI(api_key=os.environ["STRUAI_API_KEY"])
# Optional: StruAI(api_key=..., base_url="http://localhost:8000")

Tier 1: Drawings

# Upload PDF + detect one page
result = client.drawings.analyze("structural.pdf", page=12)
print(result.id, result.processing_ms)

# Reuse cache by hash
file_hash = client.drawings.compute_file_hash("structural.pdf")
result = client.drawings.analyze(page=12, file_hash=file_hash)

# Cache probe / retrieval / deletion
cache = client.drawings.check_cache(file_hash)
again = client.drawings.get(result.id)
deleted = client.drawings.delete(result.id)

Tier 2: Projects

project = client.projects.create(name="Building A", description="Structural set")

# Ingest one page (returns Job)
job = project.sheets.add(page=12, file_hash=file_hash)
sheet_result = job.wait(timeout=180)

# Ingest many pages (returns JobBatch)
batch = project.sheets.add(page="1,3,5-7", file_hash=file_hash)
all_results = batch.wait_all(timeout_per_job=300)

# Sheet data
sheets = project.sheets.list()
sheet = project.sheets.get(sheet_result.sheet_id)
raw_annotations = project.sheets.get_annotations(sheet_result.sheet_id)

Search

search = project.search(
    query="beam connection at grid A",
    limit=10,
    channels=["entities", "facts", "communities"],
    include_graph_context=True,
)

print(len(search.entities), len(search.facts), len(search.communities))

Entities + Relationships

entities = project.entities.list(limit=20, type="component_instance")
entity = project.entities.get(entities[0].id, expand_target=True)

rels = project.relationships.list(limit=20, include_invalid=False)

Async Python

import os
from struai import AsyncStruAI

async with AsyncStruAI(api_key=os.environ["STRUAI_API_KEY"]) as client:
    file_hash = client.drawings.compute_file_hash("structural.pdf")
    result = await client.drawings.analyze(page=12, file_hash=file_hash)
    project = await client.projects.create(name="Async Project")
    job = await project.sheets.add(page=12, file_hash=file_hash)
    await job.wait(timeout=180)

HTTP Endpoints Covered

Tier 1:

  • POST /v1/drawings
  • GET /v1/drawings/{id}
  • DELETE /v1/drawings/{id}
  • GET /v1/drawings/cache/{file_hash}

Tier 2:

  • POST /v1/projects
  • GET /v1/projects
  • GET /v1/projects/{id}
  • DELETE /v1/projects/{id}
  • POST /v1/projects/{project_id}/sheets
  • GET /v1/projects/{project_id}/jobs/{job_id}
  • GET /v1/projects/{project_id}/sheets
  • GET /v1/projects/{project_id}/sheets/{sheet_id}
  • GET /v1/projects/{project_id}/sheets/{sheet_id}/annotations
  • DELETE /v1/projects/{project_id}/sheets/{sheet_id}
  • POST /v1/projects/{project_id}/search
  • GET /v1/projects/{project_id}/entities
  • GET /v1/projects/{project_id}/entities/{entity_id}
  • GET /v1/projects/{project_id}/relationships

Local Smoke Tests

  • Python: scripts/smoke_local.py
  • JavaScript: js/scripts/smoke_local.mjs

License

MIT

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

struai-1.3.0.tar.gz (47.3 kB view details)

Uploaded Source

Built Distribution

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

struai-1.3.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file struai-1.3.0.tar.gz.

File metadata

  • Download URL: struai-1.3.0.tar.gz
  • Upload date:
  • Size: 47.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for struai-1.3.0.tar.gz
Algorithm Hash digest
SHA256 668df7843daad0977d4417635050b7d590a8503a924962daa907b298c7346e1c
MD5 26ecb527a992db88635354875fc469f1
BLAKE2b-256 be284cc664768b1643f70896236673d7e83e105c1e90b34a95e483bc0a6a72b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for struai-1.3.0.tar.gz:

Publisher: release.yml on bhoshaga/struai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file struai-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: struai-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for struai-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5390b60219bd7a2642992741e2277e2b3d7c1b6b343494f4cb10e14cf24f8f4
MD5 1ba5237802ae76bba68c61236bd5379f
BLAKE2b-256 f450c41f83de4da6094ecadf96d857b678bc79a284e60494ce376768b9cb919b

See more details on using hashes here.

Provenance

The following attestation bundles were made for struai-1.3.0-py3-none-any.whl:

Publisher: release.yml on bhoshaga/struai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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