struai 0.2.0__py3-none-any.whl → 1.0.2__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 CHANGED
@@ -1,9 +1,10 @@
1
1
  """StruAI Python SDK - Drawing Analysis API client.
2
2
 
3
3
  Example:
4
+ >>> import os
4
5
  >>> from struai import StruAI
5
6
  >>>
6
- >>> client = StruAI(api_key="sk-xxx")
7
+ >>> client = StruAI(api_key=os.environ["STRUAI_API_KEY"])
7
8
  >>>
8
9
  >>> # Tier 1: Raw detection ($0.02/page)
9
10
  >>> result = client.drawings.analyze("plans.pdf", page=4)
@@ -17,52 +18,52 @@ Example:
17
18
  >>> results = project.search("W12x26 beam connections")
18
19
  """
19
20
 
20
- from ._version import __version__
21
- from ._client import StruAI, AsyncStruAI
21
+ from ._client import AsyncStruAI, StruAI
22
22
  from ._exceptions import (
23
- StruAIError,
24
23
  APIError,
25
24
  AuthenticationError,
26
- PermissionDeniedError,
25
+ ConnectionError,
26
+ InternalServerError,
27
+ JobFailedError,
27
28
  NotFoundError,
28
- ValidationError,
29
+ PermissionDeniedError,
29
30
  RateLimitError,
30
- InternalServerError,
31
+ StruAIError,
31
32
  TimeoutError,
32
- ConnectionError,
33
- JobFailedError,
33
+ ValidationError,
34
34
  )
35
+ from ._version import __version__
35
36
 
36
37
  # Re-export commonly used models
37
38
  from .models import (
38
- # Common
39
- Point,
39
+ Annotations,
40
40
  BBox,
41
- TextSpan,
41
+ DetailTag,
42
42
  Dimensions,
43
43
  # Tier 1 - Drawings
44
44
  DrawingResult,
45
- Annotations,
46
- Leader,
47
- SectionTag,
48
- DetailTag,
49
- RevisionTriangle,
50
- RevisionCloud,
51
- TitleBlock,
52
- # Tier 2 - Projects
53
- Project,
54
- Sheet,
55
- JobStatus,
56
- SheetResult,
57
- # Search
58
- SearchResponse,
59
- SearchHit,
60
- QueryResponse,
61
45
  # Entities
62
46
  Entity,
63
47
  EntityListItem,
64
48
  EntityRelation,
65
49
  Fact,
50
+ JobStatus,
51
+ Leader,
52
+ # Common
53
+ Point,
54
+ # Tier 2 - Projects
55
+ Project,
56
+ QueryResponse,
57
+ RevisionCloud,
58
+ RevisionTriangle,
59
+ SearchHit,
60
+ # Search
61
+ SearchResponse,
62
+ SectionTag,
63
+ Sheet,
64
+ SheetResult,
65
+ TextSpan,
66
+ TitleBlock,
66
67
  )
67
68
 
68
69
  __all__ = [
struai/_client.py CHANGED
@@ -1,9 +1,10 @@
1
1
  """Main StruAI client classes."""
2
+
2
3
  import os
3
4
  from functools import cached_property
4
5
  from typing import Optional
5
6
 
6
- from ._base import AsyncBaseClient, BaseClient, DEFAULT_BASE_URL, DEFAULT_TIMEOUT
7
+ from ._base import DEFAULT_BASE_URL, DEFAULT_TIMEOUT, AsyncBaseClient, BaseClient
7
8
  from ._exceptions import StruAIError
8
9
  from .resources.drawings import AsyncDrawings, Drawings
9
10
  from .resources.projects import AsyncProjects, Projects
@@ -20,7 +21,8 @@ class StruAI(BaseClient):
20
21
  max_retries: Max retry attempts for failed requests. Default 2.
21
22
 
22
23
  Example:
23
- >>> client = StruAI(api_key="sk-xxx")
24
+ >>> import os
25
+ >>> client = StruAI(api_key=os.environ["STRUAI_API_KEY"])
24
26
  >>>
25
27
  >>> # Tier 1: Raw detection
26
28
  >>> result = client.drawings.analyze("structural.pdf", page=4)
@@ -71,7 +73,8 @@ class AsyncStruAI(AsyncBaseClient):
71
73
  """Async StruAI client for drawing analysis API.
72
74
 
73
75
  Example:
74
- >>> async with AsyncStruAI(api_key="sk-xxx") as client:
76
+ >>> import os
77
+ >>> async with AsyncStruAI(api_key=os.environ["STRUAI_API_KEY"]) as client:
75
78
  ... result = await client.drawings.analyze("structural.pdf", page=4)
76
79
  ...
77
80
  ... project = await client.projects.create("Building A")
struai/_version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  """Version information."""
2
- __version__ = "0.2.0"
2
+ __version__ = "1.0.2"
struai/models/common.py CHANGED
@@ -1,5 +1,5 @@
1
1
  """Common types shared across models."""
2
- from typing import List, Tuple
2
+ from typing import Tuple
3
3
 
4
4
  from pydantic import BaseModel
5
5
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: struai
3
- Version: 0.2.0
3
+ Version: 1.0.2
4
4
  Summary: StruAI Drawing Analysis SDK - AI-powered construction drawing analysis
5
5
  Project-URL: Homepage, https://struai.com
6
6
  Project-URL: Documentation, https://docs.struai.com/python
@@ -42,13 +42,20 @@ pip install struai
42
42
 
43
43
  ## Quick Start
44
44
 
45
+ Get an API key from `stru.ai` and set it as an environment variable:
46
+
47
+ ```bash
48
+ export STRUAI_API_KEY="YOUR_API_KEY"
49
+ ```
50
+
45
51
  ```python
52
+ import os
46
53
  from struai import StruAI
47
54
 
48
- client = StruAI(api_key="sk-xxx") # or set STRUAI_API_KEY env var
55
+ client = StruAI(api_key=os.environ["STRUAI_API_KEY"])
49
56
 
50
57
  # Optional: override base URL (http://localhost:8000 or http://localhost:8000/v1)
51
- client = StruAI(api_key="sk-xxx", base_url="http://localhost:8000")
58
+ client = StruAI(api_key=os.environ["STRUAI_API_KEY"], base_url="http://localhost:8000")
52
59
  ```
53
60
 
54
61
  ## Tier 1: Raw Detection ($0.02/page)
@@ -76,6 +83,49 @@ drawing = client.drawings.get("drw_7f8a9b2c")
76
83
  client.drawings.delete("drw_7f8a9b2c")
77
84
  ```
78
85
 
86
+ ## HTTP Endpoints (Reference)
87
+
88
+ All endpoints are under `/v1`. Use `Authorization: Bearer <API_KEY>`.
89
+
90
+ Tier 1 (raw detection):
91
+ - `POST /v1/drawings` — multipart form with `file` (PDF) and `page` (1-indexed)
92
+ - `GET /v1/drawings/{id}`
93
+ - `DELETE /v1/drawings/{id}`
94
+
95
+ Tier 2 (graph + search):
96
+ - `POST /v1/projects`
97
+ - `GET /v1/projects`
98
+ - `GET /v1/projects/{id}`
99
+ - `DELETE /v1/projects/{id}`
100
+ - `POST /v1/projects/{project_id}/sheets` — multipart form with `file` + `page`
101
+ - `GET /v1/projects/{project_id}/jobs/{job_id}`
102
+ - `GET /v1/projects/{project_id}/sheets`
103
+ - `GET /v1/projects/{project_id}/sheets/{sheet_id}`
104
+ - `DELETE /v1/projects/{project_id}/sheets/{sheet_id}`
105
+ - `POST /v1/projects/{project_id}/search`
106
+ - `POST /v1/projects/{project_id}/query`
107
+ - `GET /v1/projects/{project_id}/entities`
108
+ - `GET /v1/projects/{project_id}/entities/{entity_id}`
109
+ - `GET /v1/projects/{project_id}/relationships`
110
+
111
+ Example (raw detection):
112
+
113
+ ```bash
114
+ curl -X POST "https://api.stru.ai/v1/drawings" \
115
+ -H "Authorization: Bearer YOUR_API_KEY" \
116
+ -F "file=@structural.pdf" \
117
+ -F "page=4"
118
+ ```
119
+
120
+ Example (project sheet ingestion):
121
+
122
+ ```bash
123
+ curl -X POST "https://api.stru.ai/v1/projects/{project_id}/sheets" \
124
+ -H "Authorization: Bearer YOUR_API_KEY" \
125
+ -F "file=@structural.pdf" \
126
+ -F "page=4"
127
+ ```
128
+
79
129
  ## Tier 2: Graph + Search ($0.15/page)
80
130
 
81
131
  Full pipeline: detection → LLM enrichment → knowledge graph → semantic search.
@@ -118,9 +168,10 @@ entity = project.entities.get("ent_abc123")
118
168
  ## Async Support
119
169
 
120
170
  ```python
171
+ import os
121
172
  from struai import AsyncStruAI
122
173
 
123
- async with AsyncStruAI(api_key="sk-xxx") as client:
174
+ async with AsyncStruAI(api_key=os.environ["STRUAI_API_KEY"]) as client:
124
175
  # Tier 1
125
176
  result = await client.drawings.analyze("structural.pdf", page=4)
126
177
 
@@ -1,11 +1,11 @@
1
- struai/__init__.py,sha256=SmHeLcTTzSUNIYXmiDmE2_LRxZl8fUYQwhHHCvJwoGY,2274
1
+ struai/__init__.py,sha256=PDKqtP7iT2Gibhm-CR08pjFXwkBnC5LhjvjbISmk-rs,2312
2
2
  struai/_base.py,sha256=JiAxWI1PMmIFVr9v_hBABra8m2fRkEvBp7d2Vc-5IAk,11208
3
- struai/_client.py,sha256=jTRb8UbAwgFyfGoSHfO5_3QMgiHbew-s7n3bbabIZ18,3541
3
+ struai/_client.py,sha256=jc1WBRQIB4qjxC4IgA4CtIjFQ--tORJhTPlIcsV56yc,3626
4
4
  struai/_exceptions.py,sha256=GK0aVnOdkmcFaO16e0lzj9S2NmnTjQiy5H6nH6yDV24,2021
5
- struai/_version.py,sha256=b49QzOi1rklaJqTPnxwmLbtWwDKXokP9JbtqeJykzp8,49
5
+ struai/_version.py,sha256=vO6OYruC7WUn0d2gyxEwUnT-rvPnMZ9JtPv1h8Fu25w,49
6
6
  struai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  struai/models/__init__.py,sha256=qA_e6ZGG7Uhq9aLX2LeXlnUuV8VE6ur3OCFOPcj1oco,1220
8
- struai/models/common.py,sha256=qRehKPxDWPG34_LHhxu7T93Wqz1uRRQzIErQhraYAt4,598
8
+ struai/models/common.py,sha256=0Ox9PiuyRoyWH5vbSTfjm2nCWt_pblWH7kJso8nMVuE,592
9
9
  struai/models/drawings.py,sha256=oTvN0ZID1TdUsR1BkJ-6M87nFbQwsYyePd0xoxKns9I,1634
10
10
  struai/models/entities.py,sha256=4MHfhCn4g0n6d-6asASklbcmbJcIPg91rMBc5f56Zm8,1348
11
11
  struai/models/projects.py,sha256=_VYinZrwWCmv3SQy7iZFPBtHcGsZe3XxI1i9SCk0EfY,1654
@@ -13,6 +13,6 @@ struai/models/search.py,sha256=UL3RYsAidS1zdV4lKiwNcHcAIjzyi8dgAQodowjzh58,1324
13
13
  struai/resources/__init__.py,sha256=_JT_8OrvVcJ4yHmvZnsqYj4ej8pVg5lKSPKIcgQTCZk,183
14
14
  struai/resources/drawings.py,sha256=b3C7CHS-p8CpGBtKl_dvLeUFDJ3g8HjlLBA4II0HsT4,3957
15
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,,
16
+ struai-1.0.2.dist-info/METADATA,sha256=TXK36DlWMFkafqOY5jlYdnQrKm5ATimV1bNakz_otpo,5904
17
+ struai-1.0.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
18
+ struai-1.0.2.dist-info/RECORD,,
File without changes