struai 0.0.1__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- struai/__init__.py +112 -2
- struai/_base.py +360 -0
- struai/_client.py +112 -0
- struai/_exceptions.py +103 -0
- struai/_version.py +2 -0
- struai/models/__init__.py +62 -0
- struai/models/common.py +36 -0
- struai/models/drawings.py +81 -0
- struai/models/entities.py +62 -0
- struai/models/projects.py +83 -0
- struai/models/search.py +70 -0
- struai/py.typed +0 -0
- struai/resources/__init__.py +5 -0
- struai/resources/drawings.py +122 -0
- struai/resources/projects.py +628 -0
- struai-0.2.0.dist-info/METADATA +151 -0
- struai-0.2.0.dist-info/RECORD +18 -0
- struai-0.0.1.dist-info/METADATA +0 -17
- struai-0.0.1.dist-info/RECORD +0 -4
- {struai-0.0.1.dist-info → struai-0.2.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: struai
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: StruAI Drawing Analysis SDK - AI-powered construction drawing analysis
|
|
5
|
+
Project-URL: Homepage, https://struai.com
|
|
6
|
+
Project-URL: Documentation, https://docs.struai.com/python
|
|
7
|
+
Project-URL: Repository, https://github.com/struai/struai-python
|
|
8
|
+
Project-URL: Issues, https://github.com/struai/struai-python/issues
|
|
9
|
+
Author-email: StruAI <support@struai.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
Keywords: ai,cad,construction drawings,drawing analysis,knowledge graph,pdf,struai,structural engineering
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Requires-Dist: httpx>=0.25.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# StruAI Python SDK
|
|
34
|
+
|
|
35
|
+
Official Python SDK for the StruAI Drawing Analysis API.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install struai
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from struai import StruAI
|
|
47
|
+
|
|
48
|
+
client = StruAI(api_key="sk-xxx") # or set STRUAI_API_KEY env var
|
|
49
|
+
|
|
50
|
+
# Optional: override base URL (http://localhost:8000 or http://localhost:8000/v1)
|
|
51
|
+
client = StruAI(api_key="sk-xxx", base_url="http://localhost:8000")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Tier 1: Raw Detection ($0.02/page)
|
|
55
|
+
|
|
56
|
+
Fast geometric detection. Returns annotations in ~1-2 seconds.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
# Analyze a PDF page
|
|
60
|
+
result = client.drawings.analyze("structural.pdf", page=4)
|
|
61
|
+
|
|
62
|
+
print(f"Processed in {result.processing_ms}ms")
|
|
63
|
+
print(f"Page size: {result.dimensions.width}x{result.dimensions.height}")
|
|
64
|
+
|
|
65
|
+
# Access detected annotations
|
|
66
|
+
for leader in result.annotations.leaders:
|
|
67
|
+
texts = [t.text for t in leader.texts_inside]
|
|
68
|
+
print(f"Leader at {leader.arrow_tip}: {', '.join(texts)}")
|
|
69
|
+
|
|
70
|
+
for tag in result.annotations.section_tags:
|
|
71
|
+
label = tag.texts_inside[0].text
|
|
72
|
+
print(f"Section {label}, direction: {tag.direction}")
|
|
73
|
+
|
|
74
|
+
# Retrieve/delete previous results
|
|
75
|
+
drawing = client.drawings.get("drw_7f8a9b2c")
|
|
76
|
+
client.drawings.delete("drw_7f8a9b2c")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Tier 2: Graph + Search ($0.15/page)
|
|
80
|
+
|
|
81
|
+
Full pipeline: detection → LLM enrichment → knowledge graph → semantic search.
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
# Create a project
|
|
85
|
+
project = client.projects.create(
|
|
86
|
+
name="Building A Structural",
|
|
87
|
+
description="96-page structural drawing set"
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Add sheets (async processing)
|
|
91
|
+
job = project.sheets.add("structural.pdf", page=4)
|
|
92
|
+
result = job.wait(timeout=120) # Blocks until complete
|
|
93
|
+
print(f"Created {result.entities_created} entities")
|
|
94
|
+
|
|
95
|
+
# Semantic search
|
|
96
|
+
results = project.search(
|
|
97
|
+
query="W12x26 beam connections at grid A",
|
|
98
|
+
limit=10,
|
|
99
|
+
include_graph_context=True
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
for hit in results.results:
|
|
103
|
+
print(f"{hit.entity.label}: {hit.score:.2f}")
|
|
104
|
+
if hit.graph_context:
|
|
105
|
+
for rel in hit.graph_context.relationships:
|
|
106
|
+
print(f" - {rel.type}: {rel.fact}")
|
|
107
|
+
|
|
108
|
+
# Natural language query
|
|
109
|
+
answer = project.query("What beams connect to column C3?")
|
|
110
|
+
print(answer.answer)
|
|
111
|
+
print(f"Confidence: {answer.confidence:.0%}")
|
|
112
|
+
|
|
113
|
+
# Browse entities
|
|
114
|
+
entities = project.entities.list(type="Component", limit=50)
|
|
115
|
+
entity = project.entities.get("ent_abc123")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Async Support
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from struai import AsyncStruAI
|
|
122
|
+
|
|
123
|
+
async with AsyncStruAI(api_key="sk-xxx") as client:
|
|
124
|
+
# Tier 1
|
|
125
|
+
result = await client.drawings.analyze("structural.pdf", page=4)
|
|
126
|
+
|
|
127
|
+
# Tier 2
|
|
128
|
+
project = await client.projects.create(name="Building A")
|
|
129
|
+
job = await project.sheets.add("structural.pdf", page=4)
|
|
130
|
+
result = await job.wait(timeout=120)
|
|
131
|
+
results = await project.search("W12x26 beam connections")
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Error Handling
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from struai import StruAI, AuthenticationError, RateLimitError, NotFoundError
|
|
138
|
+
|
|
139
|
+
try:
|
|
140
|
+
result = client.drawings.analyze("plans.pdf", page=99)
|
|
141
|
+
except AuthenticationError:
|
|
142
|
+
print("Invalid API key")
|
|
143
|
+
except RateLimitError as e:
|
|
144
|
+
print(f"Rate limited. Retry after {e.retry_after}s")
|
|
145
|
+
except NotFoundError:
|
|
146
|
+
print("Resource not found")
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
struai/__init__.py,sha256=SmHeLcTTzSUNIYXmiDmE2_LRxZl8fUYQwhHHCvJwoGY,2274
|
|
2
|
+
struai/_base.py,sha256=JiAxWI1PMmIFVr9v_hBABra8m2fRkEvBp7d2Vc-5IAk,11208
|
|
3
|
+
struai/_client.py,sha256=jTRb8UbAwgFyfGoSHfO5_3QMgiHbew-s7n3bbabIZ18,3541
|
|
4
|
+
struai/_exceptions.py,sha256=GK0aVnOdkmcFaO16e0lzj9S2NmnTjQiy5H6nH6yDV24,2021
|
|
5
|
+
struai/_version.py,sha256=b49QzOi1rklaJqTPnxwmLbtWwDKXokP9JbtqeJykzp8,49
|
|
6
|
+
struai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
struai/models/__init__.py,sha256=qA_e6ZGG7Uhq9aLX2LeXlnUuV8VE6ur3OCFOPcj1oco,1220
|
|
8
|
+
struai/models/common.py,sha256=qRehKPxDWPG34_LHhxu7T93Wqz1uRRQzIErQhraYAt4,598
|
|
9
|
+
struai/models/drawings.py,sha256=oTvN0ZID1TdUsR1BkJ-6M87nFbQwsYyePd0xoxKns9I,1634
|
|
10
|
+
struai/models/entities.py,sha256=4MHfhCn4g0n6d-6asASklbcmbJcIPg91rMBc5f56Zm8,1348
|
|
11
|
+
struai/models/projects.py,sha256=_VYinZrwWCmv3SQy7iZFPBtHcGsZe3XxI1i9SCk0EfY,1654
|
|
12
|
+
struai/models/search.py,sha256=UL3RYsAidS1zdV4lKiwNcHcAIjzyi8dgAQodowjzh58,1324
|
|
13
|
+
struai/resources/__init__.py,sha256=_JT_8OrvVcJ4yHmvZnsqYj4ej8pVg5lKSPKIcgQTCZk,183
|
|
14
|
+
struai/resources/drawings.py,sha256=b3C7CHS-p8CpGBtKl_dvLeUFDJ3g8HjlLBA4II0HsT4,3957
|
|
15
|
+
struai/resources/projects.py,sha256=_KRHO6ByBN_W-STlaAhVljLt9F3Yh9xzV5Piahc50FQ,19501
|
|
16
|
+
struai-0.2.0.dist-info/METADATA,sha256=aILI4YDk7L0ZjyjOuA_8mmG0gAXSDV6DO5WEKz0S2iU,4460
|
|
17
|
+
struai-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
18
|
+
struai-0.2.0.dist-info/RECORD,,
|
struai-0.0.1.dist-info/METADATA
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: struai
|
|
3
|
-
Version: 0.0.1
|
|
4
|
-
Summary: StruAI - AI-powered tools
|
|
5
|
-
Project-URL: Homepage, https://github.com/bhoshaga/struai
|
|
6
|
-
Author-email: bhoshaga <bhoshaga@gmail.com>
|
|
7
|
-
License-Expression: MIT
|
|
8
|
-
Keywords: ai,struai
|
|
9
|
-
Classifier: Development Status :: 1 - Planning
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Requires-Python: >=3.8
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
|
|
15
|
-
# struai
|
|
16
|
-
|
|
17
|
-
Coming soon.
|
struai-0.0.1.dist-info/RECORD
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
struai/__init__.py,sha256=1VV3qcV5ZM35mMYdb-FwQIXwmF9iTiB7dguaAQdNpEc,35
|
|
2
|
-
struai-0.0.1.dist-info/METADATA,sha256=Bk8MaGENVHMEt6MaRa2hVDcuUTQoc3FUCSMy3zc15as,464
|
|
3
|
-
struai-0.0.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
4
|
-
struai-0.0.1.dist-info/RECORD,,
|
|
File without changes
|