lumera 0.6.0__tar.gz → 0.7.3__tar.gz
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.
- {lumera-0.6.0 → lumera-0.7.3}/PKG-INFO +1 -1
- {lumera-0.6.0 → lumera-0.7.3}/lumera/__init__.py +9 -6
- {lumera-0.6.0 → lumera-0.7.3}/lumera/_utils.py +13 -13
- lumera-0.7.3/lumera/automations.py +835 -0
- {lumera-0.6.0 → lumera-0.7.3}/lumera/sdk.py +39 -39
- {lumera-0.6.0 → lumera-0.7.3}/lumera/storage.py +3 -3
- {lumera-0.6.0 → lumera-0.7.3}/lumera.egg-info/PKG-INFO +1 -1
- {lumera-0.6.0 → lumera-0.7.3}/lumera.egg-info/SOURCES.txt +1 -0
- {lumera-0.6.0 → lumera-0.7.3}/pyproject.toml +1 -1
- {lumera-0.6.0 → lumera-0.7.3}/tests/test_sdk.py +27 -27
- {lumera-0.6.0 → lumera-0.7.3}/lumera/exceptions.py +0 -0
- {lumera-0.6.0 → lumera-0.7.3}/lumera/google.py +0 -0
- {lumera-0.6.0 → lumera-0.7.3}/lumera/llm.py +0 -0
- {lumera-0.6.0 → lumera-0.7.3}/lumera/locks.py +0 -0
- {lumera-0.6.0 → lumera-0.7.3}/lumera/pb.py +12 -12
- {lumera-0.6.0 → lumera-0.7.3}/lumera.egg-info/dependency_links.txt +0 -0
- {lumera-0.6.0 → lumera-0.7.3}/lumera.egg-info/requires.txt +0 -0
- {lumera-0.6.0 → lumera-0.7.3}/lumera.egg-info/top_level.txt +0 -0
- {lumera-0.6.0 → lumera-0.7.3}/setup.cfg +0 -0
|
@@ -5,10 +5,10 @@ This SDK provides helpers for agents running within the Lumera Notebook environm
|
|
|
5
5
|
to interact with the Lumera API and define dynamic user interfaces.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
__version__ = "0.
|
|
8
|
+
__version__ = "0.7.0"
|
|
9
9
|
|
|
10
10
|
# Import new modules (as modules, not individual functions)
|
|
11
|
-
from . import exceptions, llm, locks, pb, storage
|
|
11
|
+
from . import automations, exceptions, llm, locks, pb, storage
|
|
12
12
|
from ._utils import (
|
|
13
13
|
LumeraAPIError,
|
|
14
14
|
RecordNotUniqueError,
|
|
@@ -34,7 +34,7 @@ from .sdk import (
|
|
|
34
34
|
create_record,
|
|
35
35
|
delete_collection,
|
|
36
36
|
delete_record,
|
|
37
|
-
|
|
37
|
+
get_automation_run,
|
|
38
38
|
get_collection,
|
|
39
39
|
get_record,
|
|
40
40
|
get_record_by_external_id,
|
|
@@ -42,8 +42,9 @@ from .sdk import (
|
|
|
42
42
|
list_records,
|
|
43
43
|
query_sql,
|
|
44
44
|
replay_hook,
|
|
45
|
-
|
|
45
|
+
run_automation,
|
|
46
46
|
save_to_lumera,
|
|
47
|
+
update_automation_run,
|
|
47
48
|
update_collection,
|
|
48
49
|
update_record,
|
|
49
50
|
upload_lumera_file,
|
|
@@ -73,8 +74,9 @@ __all__ = [
|
|
|
73
74
|
# Other operations
|
|
74
75
|
"replay_hook",
|
|
75
76
|
"query_sql",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
77
|
+
"run_automation",
|
|
78
|
+
"get_automation_run",
|
|
79
|
+
"update_automation_run",
|
|
78
80
|
"upload_lumera_file",
|
|
79
81
|
"save_to_lumera",
|
|
80
82
|
# Type definitions
|
|
@@ -89,6 +91,7 @@ __all__ = [
|
|
|
89
91
|
"RecordNotFoundError",
|
|
90
92
|
"LockHeldError",
|
|
91
93
|
# New modules (use as lumera.pb, lumera.storage, etc.)
|
|
94
|
+
"automations",
|
|
92
95
|
"pb",
|
|
93
96
|
"storage",
|
|
94
97
|
"llm",
|
|
@@ -117,10 +117,10 @@ def _utcnow_iso() -> str:
|
|
|
117
117
|
)
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
def _default_provenance(
|
|
120
|
+
def _default_provenance(automation_id: str, run_id: str | None) -> dict[str, Any]:
|
|
121
121
|
recorded_at = _utcnow_iso()
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
env_automation_id = os.getenv("LUMERA_AUTOMATION_ID", "").strip()
|
|
123
|
+
automation_id = (automation_id or "").strip() or env_automation_id
|
|
124
124
|
|
|
125
125
|
run_id = (run_id or "").strip() or os.getenv("LUMERA_RUN_ID", "").strip()
|
|
126
126
|
|
|
@@ -132,8 +132,8 @@ def _default_provenance(agent_id: str, run_id: str | None) -> dict[str, Any]:
|
|
|
132
132
|
"recorded_at": recorded_at,
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
if
|
|
136
|
-
payload["agent"] = {"id":
|
|
135
|
+
if automation_id:
|
|
136
|
+
payload["agent"] = {"id": automation_id} # Backend still expects "agent" key
|
|
137
137
|
|
|
138
138
|
if run_id:
|
|
139
139
|
payload["agent_run"] = {"id": run_id}
|
|
@@ -284,7 +284,7 @@ def _ensure_mapping(payload: Mapping[str, Any] | None, *, name: str) -> dict[str
|
|
|
284
284
|
return dict(payload)
|
|
285
285
|
|
|
286
286
|
|
|
287
|
-
def
|
|
287
|
+
def _prepare_automation_inputs(
|
|
288
288
|
inputs: Mapping[str, Any] | str | None,
|
|
289
289
|
) -> dict[str, Any] | None:
|
|
290
290
|
if inputs is None:
|
|
@@ -345,7 +345,7 @@ def _upload_file_to_presigned(upload_url: str, path: pathlib.Path, content_type:
|
|
|
345
345
|
resp.raise_for_status()
|
|
346
346
|
|
|
347
347
|
|
|
348
|
-
def
|
|
348
|
+
def _upload_automation_files(
|
|
349
349
|
run_id: str | None,
|
|
350
350
|
files: Mapping[str, str | os.PathLike[str] | Sequence[str | os.PathLike[str]]],
|
|
351
351
|
*,
|
|
@@ -370,7 +370,7 @@ def _upload_agent_files(
|
|
|
370
370
|
size = file_path.stat().st_size
|
|
371
371
|
|
|
372
372
|
body: dict[str, Any] = {
|
|
373
|
-
"scope": "
|
|
373
|
+
"scope": "automation_run",
|
|
374
374
|
"filename": filename,
|
|
375
375
|
"content_type": content_type,
|
|
376
376
|
"size": size,
|
|
@@ -631,7 +631,7 @@ def _upload_session_file(file_path: str, session_id: str) -> dict:
|
|
|
631
631
|
return {"name": filename, "notebook_path": notebook_path}
|
|
632
632
|
|
|
633
633
|
|
|
634
|
-
def
|
|
634
|
+
def _upload_automation_run_file(file_path: str, run_id: str) -> dict:
|
|
635
635
|
token = get_lumera_token()
|
|
636
636
|
path = pathlib.Path(file_path).expanduser().resolve()
|
|
637
637
|
if not path.is_file():
|
|
@@ -644,7 +644,7 @@ def _upload_agent_run_file(file_path: str, run_id: str) -> dict:
|
|
|
644
644
|
headers = {"Authorization": f"token {token}", "Content-Type": "application/json"}
|
|
645
645
|
|
|
646
646
|
resp = requests.post(
|
|
647
|
-
f"{API_BASE}/
|
|
647
|
+
f"{API_BASE}/automation-runs/{run_id}/files/upload-url",
|
|
648
648
|
json={"filename": filename, "content_type": mimetype, "size": size},
|
|
649
649
|
headers=headers,
|
|
650
650
|
timeout=30,
|
|
@@ -742,10 +742,10 @@ __all__ = [
|
|
|
742
742
|
"_is_sequence",
|
|
743
743
|
"_normalize_mount_path",
|
|
744
744
|
"_pretty_size",
|
|
745
|
-
"
|
|
745
|
+
"_prepare_automation_inputs",
|
|
746
746
|
"_record_mutation",
|
|
747
|
-
"
|
|
748
|
-
"
|
|
747
|
+
"_upload_automation_files",
|
|
748
|
+
"_upload_automation_run_file",
|
|
749
749
|
"_upload_file_to_presigned",
|
|
750
750
|
"_upload_document",
|
|
751
751
|
"_upload_session_file",
|