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, injs/)
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/drawingsGET /v1/drawings/{id}DELETE /v1/drawings/{id}GET /v1/drawings/cache/{file_hash}
Tier 2:
POST /v1/projectsGET /v1/projectsGET /v1/projects/{id}DELETE /v1/projects/{id}POST /v1/projects/{project_id}/sheetsGET /v1/projects/{project_id}/jobs/{job_id}GET /v1/projects/{project_id}/sheetsGET /v1/projects/{project_id}/sheets/{sheet_id}GET /v1/projects/{project_id}/sheets/{sheet_id}/annotationsDELETE /v1/projects/{project_id}/sheets/{sheet_id}POST /v1/projects/{project_id}/searchGET /v1/projects/{project_id}/entitiesGET /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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
668df7843daad0977d4417635050b7d590a8503a924962daa907b298c7346e1c
|
|
| MD5 |
26ecb527a992db88635354875fc469f1
|
|
| BLAKE2b-256 |
be284cc664768b1643f70896236673d7e83e105c1e90b34a95e483bc0a6a72b2
|
Provenance
The following attestation bundles were made for struai-1.3.0.tar.gz:
Publisher:
release.yml on bhoshaga/struai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
struai-1.3.0.tar.gz -
Subject digest:
668df7843daad0977d4417635050b7d590a8503a924962daa907b298c7346e1c - Sigstore transparency entry: 928200436
- Sigstore integration time:
-
Permalink:
bhoshaga/struai@0f14f2abbec841949a45369e33c6a2dbb55b7a22 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bhoshaga
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0f14f2abbec841949a45369e33c6a2dbb55b7a22 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5390b60219bd7a2642992741e2277e2b3d7c1b6b343494f4cb10e14cf24f8f4
|
|
| MD5 |
1ba5237802ae76bba68c61236bd5379f
|
|
| BLAKE2b-256 |
f450c41f83de4da6094ecadf96d857b678bc79a284e60494ce376768b9cb919b
|
Provenance
The following attestation bundles were made for struai-1.3.0-py3-none-any.whl:
Publisher:
release.yml on bhoshaga/struai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
struai-1.3.0-py3-none-any.whl -
Subject digest:
e5390b60219bd7a2642992741e2277e2b3d7c1b6b343494f4cb10e14cf24f8f4 - Sigstore transparency entry: 928200437
- Sigstore integration time:
-
Permalink:
bhoshaga/struai@0f14f2abbec841949a45369e33c6a2dbb55b7a22 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bhoshaga
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0f14f2abbec841949a45369e33c6a2dbb55b7a22 -
Trigger Event:
push
-
Statement type: