llumo 0.1.3__py3-none-any.whl → 0.1.5__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.
- llumo/__init__.py +7 -7
- llumo/client.py +565 -551
- llumo/exceptions.py +45 -31
- llumo/execution.py +38 -38
- llumo/functionCalling.py +189 -0
- llumo/helpingFuntions.py +50 -60
- llumo/models.py +42 -42
- llumo/sockets.py +146 -154
- {llumo-0.1.3.dist-info → llumo-0.1.5.dist-info}/METADATA +26 -26
- llumo-0.1.5.dist-info/RECORD +13 -0
- {llumo-0.1.3.dist-info → llumo-0.1.5.dist-info}/WHEEL +1 -1
- {llumo-0.1.3.dist-info → llumo-0.1.5.dist-info}/licenses/LICENSE +4 -4
- llumo/.env +0 -6
- llumo-0.1.3.dist-info/RECORD +0 -13
- {llumo-0.1.3.dist-info → llumo-0.1.5.dist-info}/top_level.txt +0 -0
llumo/sockets.py
CHANGED
@@ -1,154 +1,146 @@
|
|
1
|
-
import socketio
|
2
|
-
import threading
|
3
|
-
import time
|
4
|
-
|
5
|
-
|
6
|
-
class LlumoSocketClient:
|
7
|
-
def __init__(self, socket_url):
|
8
|
-
self.socket_url = socket_url
|
9
|
-
self._received_data = []
|
10
|
-
self._last_update_time = None
|
11
|
-
self._listening_done = threading.Event()
|
12
|
-
self._connection_established = threading.Event()
|
13
|
-
self._lock = threading.Lock()
|
14
|
-
self._connected = False
|
15
|
-
self.server_socket_id = None # Store the server-assigned socket ID
|
16
|
-
|
17
|
-
# Initialize client
|
18
|
-
self.sio = socketio.Client(
|
19
|
-
# logger=True,
|
20
|
-
# engineio_logger=True,
|
21
|
-
reconnection=True,
|
22
|
-
reconnection_attempts=5,
|
23
|
-
reconnection_delay=1,
|
24
|
-
)
|
25
|
-
|
26
|
-
@self.sio.on("connect")
|
27
|
-
def on_connect():
|
28
|
-
print("Socket connection established")
|
29
|
-
self._connected = True
|
30
|
-
# Don't set connection_established yet - wait for server confirmation
|
31
|
-
|
32
|
-
# Listen for the connection-established event from the server
|
33
|
-
@self.sio.on("connection-established")
|
34
|
-
def on_connection_established(data):
|
35
|
-
print(
|
36
|
-
|
37
|
-
)
|
38
|
-
if isinstance(data, dict) and "socketId" in data:
|
39
|
-
self.server_socket_id = data["socketId"]
|
40
|
-
print(f"Received server socket ID: {self.server_socket_id}")
|
41
|
-
self._connection_established.set()
|
42
|
-
|
43
|
-
@self.sio.on("result-update")
|
44
|
-
def on_result_update(data):
|
45
|
-
with self._lock:
|
46
|
-
print(f"Received result-update event: {data}")
|
47
|
-
self._received_data.append(data)
|
48
|
-
self._last_update_time = time.time()
|
49
|
-
|
50
|
-
@self.sio.on("disconnect")
|
51
|
-
def on_disconnect():
|
52
|
-
print("Socket disconnected")
|
53
|
-
self._connected = False
|
54
|
-
|
55
|
-
@self.sio.on("connect_error")
|
56
|
-
def on_connect_error(error):
|
57
|
-
print(f"Socket connection error: {error}")
|
58
|
-
|
59
|
-
@self.sio.on("error")
|
60
|
-
def on_error(error):
|
61
|
-
print(f"Socket error event: {error}")
|
62
|
-
|
63
|
-
def connect(self, timeout=20):
|
64
|
-
self._received_data = []
|
65
|
-
self._connection_established.clear()
|
66
|
-
self._listening_done.clear()
|
67
|
-
self.server_socket_id = None
|
68
|
-
|
69
|
-
try:
|
70
|
-
print("Attempting direct WebSocket connection...")
|
71
|
-
# Connect with websocket transport
|
72
|
-
self.sio.connect(self.socket_url, transports=["websocket"], wait=True)
|
73
|
-
|
74
|
-
print(f"Engine.IO connection established with SID: {self.sio.sid}")
|
75
|
-
print(
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
if
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
)
|
123
|
-
self._listening_done.set()
|
124
|
-
break
|
125
|
-
|
126
|
-
#
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
def disconnect(self):
|
148
|
-
try:
|
149
|
-
if self._connected:
|
150
|
-
self.sio.disconnect()
|
151
|
-
self._connected = False
|
152
|
-
print("WebSocket client disconnected")
|
153
|
-
except Exception as e:
|
154
|
-
print(f"Error during WebSocket disconnect: {e}")
|
1
|
+
import socketio
|
2
|
+
import threading
|
3
|
+
import time
|
4
|
+
|
5
|
+
|
6
|
+
class LlumoSocketClient:
|
7
|
+
def __init__(self, socket_url):
|
8
|
+
self.socket_url = socket_url
|
9
|
+
self._received_data = []
|
10
|
+
self._last_update_time = None
|
11
|
+
self._listening_done = threading.Event()
|
12
|
+
self._connection_established = threading.Event()
|
13
|
+
self._lock = threading.Lock()
|
14
|
+
self._connected = False
|
15
|
+
self.server_socket_id = None # Store the server-assigned socket ID
|
16
|
+
|
17
|
+
# Initialize client
|
18
|
+
self.sio = socketio.Client(
|
19
|
+
# logger=True,
|
20
|
+
# engineio_logger=True,
|
21
|
+
reconnection=True,
|
22
|
+
reconnection_attempts=5,
|
23
|
+
reconnection_delay=1,
|
24
|
+
)
|
25
|
+
|
26
|
+
@self.sio.on("connect")
|
27
|
+
def on_connect():
|
28
|
+
# print("Socket connection established")
|
29
|
+
self._connected = True
|
30
|
+
# Don't set connection_established yet - wait for server confirmation
|
31
|
+
|
32
|
+
# Listen for the connection-established event from the server
|
33
|
+
@self.sio.on("connection-established")
|
34
|
+
def on_connection_established(data):
|
35
|
+
# print(
|
36
|
+
# f"Server acknowledged connection with 'connection-established' event: {data}"
|
37
|
+
# )
|
38
|
+
if isinstance(data, dict) and "socketId" in data:
|
39
|
+
self.server_socket_id = data["socketId"]
|
40
|
+
# print(f"Received server socket ID: {self.server_socket_id}")
|
41
|
+
self._connection_established.set()
|
42
|
+
|
43
|
+
@self.sio.on("result-update")
|
44
|
+
def on_result_update(data):
|
45
|
+
with self._lock:
|
46
|
+
# print(f"Received result-update event: {data}")
|
47
|
+
self._received_data.append(data)
|
48
|
+
self._last_update_time = time.time()
|
49
|
+
|
50
|
+
@self.sio.on("disconnect")
|
51
|
+
def on_disconnect():
|
52
|
+
# print("Socket disconnected")
|
53
|
+
self._connected = False
|
54
|
+
|
55
|
+
@self.sio.on("connect_error")
|
56
|
+
def on_connect_error(error):
|
57
|
+
print(f"Socket connection error: {error}")
|
58
|
+
|
59
|
+
@self.sio.on("error")
|
60
|
+
def on_error(error):
|
61
|
+
print(f"Socket error event: {error}")
|
62
|
+
|
63
|
+
def connect(self, timeout=20):
|
64
|
+
self._received_data = []
|
65
|
+
self._connection_established.clear()
|
66
|
+
self._listening_done.clear()
|
67
|
+
self.server_socket_id = None
|
68
|
+
|
69
|
+
try:
|
70
|
+
# print("Attempting direct WebSocket connection...")
|
71
|
+
# Connect with websocket transport
|
72
|
+
self.sio.connect(self.socket_url, transports=["websocket"], wait=True)
|
73
|
+
|
74
|
+
# print(f"Engine.IO connection established with SID: {self.sio.sid}")
|
75
|
+
# print( "Waiting for server to acknowledge connection with connection-established event...")
|
76
|
+
|
77
|
+
# Wait for the connection-established event
|
78
|
+
if not self._connection_established.wait(timeout):
|
79
|
+
raise RuntimeError("Timed out waiting for connection-established event")
|
80
|
+
|
81
|
+
self._last_update_time = time.time()
|
82
|
+
# print(f"Connection fully established. Server socket ID: {self.server_socket_id}")
|
83
|
+
|
84
|
+
# Return the server-assigned socket ID if available, otherwise fall back to the client's SID
|
85
|
+
return self.server_socket_id or self.sio.sid
|
86
|
+
except Exception as e:
|
87
|
+
self._connected = False
|
88
|
+
raise RuntimeError(f"WebSocket connection failed: {e}")
|
89
|
+
|
90
|
+
def listenForResults(self, min_wait=30, max_wait=300, inactivity_timeout=50):
|
91
|
+
"""
|
92
|
+
Listen for results with improved timeout handling:
|
93
|
+
- min_wait: Minimum time to wait even if no data is received
|
94
|
+
- max_wait: Maximum total time to wait for results
|
95
|
+
- inactivity_timeout: Time to wait after last data received
|
96
|
+
"""
|
97
|
+
if not self._connected:
|
98
|
+
raise RuntimeError("WebSocket is not connected. Call connect() first.")
|
99
|
+
|
100
|
+
start_time = time.time()
|
101
|
+
self._last_update_time = time.time()
|
102
|
+
|
103
|
+
def timeout_watcher():
|
104
|
+
while not self._listening_done.is_set():
|
105
|
+
current_time = time.time()
|
106
|
+
time_since_last_update = current_time - self._last_update_time
|
107
|
+
total_elapsed = current_time - start_time
|
108
|
+
|
109
|
+
# Always wait for minimum time
|
110
|
+
if total_elapsed < min_wait:
|
111
|
+
time.sleep(0.5)
|
112
|
+
continue
|
113
|
+
|
114
|
+
# Stop if maximum time exceeded
|
115
|
+
if total_elapsed > max_wait:
|
116
|
+
# print(f"⚠️ Maximum wait time of {max_wait}s reached, stopping listener.")
|
117
|
+
self._listening_done.set()
|
118
|
+
break
|
119
|
+
|
120
|
+
# Stop if no activity for inactivity_timeout
|
121
|
+
if time_since_last_update > inactivity_timeout:
|
122
|
+
# print(f"⚠️ No data received for {inactivity_timeout}s, stopping listener.")
|
123
|
+
self._listening_done.set()
|
124
|
+
break
|
125
|
+
|
126
|
+
# Check every second
|
127
|
+
time.sleep(1)
|
128
|
+
|
129
|
+
timeout_thread = threading.Thread(target=timeout_watcher, daemon=True)
|
130
|
+
timeout_thread.start()
|
131
|
+
# print("Started listening for WebSocket events...")
|
132
|
+
self._listening_done.wait()
|
133
|
+
# print(f"Finished listening. Received {len(self._received_data)} data updates.")
|
134
|
+
|
135
|
+
def getReceivedData(self):
|
136
|
+
with self._lock:
|
137
|
+
return self._received_data.copy()
|
138
|
+
|
139
|
+
def disconnect(self):
|
140
|
+
try:
|
141
|
+
if self._connected:
|
142
|
+
self.sio.disconnect()
|
143
|
+
self._connected = False
|
144
|
+
# print("WebSocket client disconnected")
|
145
|
+
except Exception as e:
|
146
|
+
print(f"Error during WebSocket disconnect: {e}")
|
@@ -1,26 +1,26 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: llumo
|
3
|
-
Version: 0.1.
|
4
|
-
Summary: Python SDK for interacting with the Llumo ai API.
|
5
|
-
Home-page: https://www.llumo.ai/
|
6
|
-
Author: Llumo
|
7
|
-
Author-email: product@llumo.ai
|
8
|
-
License: Proprietary
|
9
|
-
Requires-Python: >=3.7
|
10
|
-
License-File: LICENSE
|
11
|
-
Requires-Dist: requests>=2.0.0
|
12
|
-
Requires-Dist: websocket-client>=1.0.0
|
13
|
-
Requires-Dist: pandas>=1.0.0
|
14
|
-
Requires-Dist: numpy>=1.0.0
|
15
|
-
Requires-Dist: python-socketio[client]==5.13.0
|
16
|
-
Requires-Dist: python-dotenv==1.1.0
|
17
|
-
Requires-Dist: openai==1.75.0
|
18
|
-
Requires-Dist: google-generativeai==0.8.5
|
19
|
-
Dynamic: author
|
20
|
-
Dynamic: author-email
|
21
|
-
Dynamic: home-page
|
22
|
-
Dynamic: license
|
23
|
-
Dynamic: license-file
|
24
|
-
Dynamic: requires-dist
|
25
|
-
Dynamic: requires-python
|
26
|
-
Dynamic: summary
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: llumo
|
3
|
+
Version: 0.1.5
|
4
|
+
Summary: Python SDK for interacting with the Llumo ai API.
|
5
|
+
Home-page: https://www.llumo.ai/
|
6
|
+
Author: Llumo
|
7
|
+
Author-email: product@llumo.ai
|
8
|
+
License: Proprietary
|
9
|
+
Requires-Python: >=3.7
|
10
|
+
License-File: LICENSE
|
11
|
+
Requires-Dist: requests>=2.0.0
|
12
|
+
Requires-Dist: websocket-client>=1.0.0
|
13
|
+
Requires-Dist: pandas>=1.0.0
|
14
|
+
Requires-Dist: numpy>=1.0.0
|
15
|
+
Requires-Dist: python-socketio[client]==5.13.0
|
16
|
+
Requires-Dist: python-dotenv==1.1.0
|
17
|
+
Requires-Dist: openai==1.75.0
|
18
|
+
Requires-Dist: google-generativeai==0.8.5
|
19
|
+
Dynamic: author
|
20
|
+
Dynamic: author-email
|
21
|
+
Dynamic: home-page
|
22
|
+
Dynamic: license
|
23
|
+
Dynamic: license-file
|
24
|
+
Dynamic: requires-dist
|
25
|
+
Dynamic: requires-python
|
26
|
+
Dynamic: summary
|
@@ -0,0 +1,13 @@
|
|
1
|
+
llumo/__init__.py,sha256=O04b4yW1BnOvcHzxWFddAKhtdBEhBNhLdb6xgnpHH_Q,205
|
2
|
+
llumo/client.py,sha256=v5hLJHn7XxW5-UL2qtyosGj9AcRyO8tZR4pTo7bdI-4,23421
|
3
|
+
llumo/exceptions.py,sha256=KGmztP61dkkzCTBEiRv5Xe9HrLNv1s_fYioRCG64GUU,1656
|
4
|
+
llumo/execution.py,sha256=x88wQV8eL99wNN5YtjFaAMCIfN1PdfQVlAZQb4vzgQ0,1413
|
5
|
+
llumo/functionCalling.py,sha256=tojobCqY2jaBiGXp0BA5ZlEm7DF-fD--TRlUho3fNc4,7126
|
6
|
+
llumo/helpingFuntions.py,sha256=BWRoAAXG3Dsovc9bk-pDD2feQM_3ERXz_MwNgux0e7Q,1418
|
7
|
+
llumo/models.py,sha256=YH-qAMnShmUpmKE2LQAzQdpRsaXkFSlOqMxHwU4zBUI,1560
|
8
|
+
llumo/sockets.py,sha256=PnGdffEjI5dK5oNoLWPZdJFoLw6NwH_mRQFYNiXBVF4,5689
|
9
|
+
llumo-0.1.5.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
|
10
|
+
llumo-0.1.5.dist-info/METADATA,sha256=fpIuMnLV-3OSNmLurPKl4F8uN4NFa-t52LKdfVZ95wQ,695
|
11
|
+
llumo-0.1.5.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
12
|
+
llumo-0.1.5.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
|
13
|
+
llumo-0.1.5.dist-info/RECORD,,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2025 Llumo AI
|
2
|
-
|
3
|
-
All rights reserved. This software is proprietary and confidential.
|
4
|
-
Unauthorized copying, distribution, or use of this software is strictly prohibited.
|
1
|
+
Copyright (c) 2025 Llumo AI
|
2
|
+
|
3
|
+
All rights reserved. This software is proprietary and confidential.
|
4
|
+
Unauthorized copying, distribution, or use of this software is strictly prohibited.
|
llumo/.env
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
|
2
|
-
BASE_URL="https://app.llumo.ai/api"
|
3
|
-
postUrl = "https://red-skull-service-392377961931.us-central1.run.app/api/process-playground"
|
4
|
-
fetchUrl = "https://red-skull-service-392377961931.us-central1.run.app/api/get-cells-data"
|
5
|
-
validateUrl = "https://backend-api.llumo.ai/api/v1/workspace-key-details"
|
6
|
-
SOCKET_URL="https://red-skull-service-392377961931.us-central1.run.app/"
|
llumo-0.1.3.dist-info/RECORD
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
llumo/.env,sha256=Vx5FkuywpYHXH2N8epJ7PlNOPiwx9UP9DUz4vWd0urs,373
|
2
|
-
llumo/__init__.py,sha256=8ZgAtxJNNgHorEXoxaLQ2YWrVXGgamoayyLMD1L4FbE,183
|
3
|
-
llumo/client.py,sha256=DggiOLmBG21lEpg1vqjV5SC-PfR2LuVnpsY6HMTyF9I,23086
|
4
|
-
llumo/exceptions.py,sha256=l3_5d9cBMm-hwpuFrg3nvI9cEP2GTKXcCyWiWHwnYDM,1041
|
5
|
-
llumo/execution.py,sha256=ZvbZDSAvwj1XwSlgPNiy4r9fZG_vtfSlaWGwNI9xCa8,1453
|
6
|
-
llumo/helpingFuntions.py,sha256=HPy2w3IaYfH_hDBgXdoAmNZmAbDUO01bgW7gHBGNw8A,1765
|
7
|
-
llumo/models.py,sha256=WBtnu7ckOy9TGRiwswz04xOGYF6EslTUOxHUz4QWzUA,1602
|
8
|
-
llumo/sockets.py,sha256=M6piy6bNt342GmTQCdUJJDUgMYGxk0Acjgj11uI4Vdg,5965
|
9
|
-
llumo-0.1.3.dist-info/licenses/LICENSE,sha256=vMiqSi3KpDHq3RFxKiqdh10ZUF3PjE3nnntANU-HEu4,186
|
10
|
-
llumo-0.1.3.dist-info/METADATA,sha256=DyqkkQAIg95hiKyFdYrHj_CazvTb8ocSUZLi13cslLc,721
|
11
|
-
llumo-0.1.3.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
12
|
-
llumo-0.1.3.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
|
13
|
-
llumo-0.1.3.dist-info/RECORD,,
|
File without changes
|