llumo 0.1.8__py3-none-any.whl → 0.1.9__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/models.py CHANGED
@@ -1,43 +1,43 @@
1
- from enum import Enum
2
-
3
- class Provider(str, Enum):
4
- OPENAI = "OPENAI"
5
- GOOGLE = "GOOGLE"
6
-
7
- # Maps model aliases → (provider, actual model name for API)
8
- _MODEL_METADATA = {
9
- "GPT_4": (Provider.OPENAI, "gpt-4"),
10
- "GPT_4_32K": (Provider.OPENAI, "gpt-4-32k"),
11
- "GPT_35T": (Provider.OPENAI, "gpt-3.5-turbo"),
12
- "GPT_35T_INS": (Provider.OPENAI, "gpt-3.5-turbo-instruct"),
13
- "GPT_35T_16K": (Provider.OPENAI, "gpt-3.5-turbo-16k"),
14
- "GPT_35_TURBO": (Provider.OPENAI, "gpt-3.5-turbo"),
15
-
16
- "GOOGLE_15_FLASH": (Provider.GOOGLE, "gemini-1.5-flash-latest"),
17
- "GEMINI_PRO": (Provider.GOOGLE, "gemini-pro"),
18
- "TEXT_BISON": (Provider.GOOGLE, "text-bison-001"),
19
- "CHAT_BISON": (Provider.GOOGLE, "chat-bison-001"),
20
- "TEXT_BISON_32K": (Provider.GOOGLE, "text-bison-32k"),
21
- "TEXT_UNICORN": (Provider.GOOGLE, "text-unicorn-experimental"),
22
- }
23
-
24
- class AVAILABLEMODELS(str, Enum):
25
- GPT_4 = "gpt-4"
26
- GPT_4_32K = "gpt-4-32k"
27
- GPT_35T = "gpt-3.5-turbo"
28
- GPT_35T_INS = "gpt-3.5-turbo-instruct"
29
- GPT_35T_16K = "gpt-3.5-turbo-16k"
30
- GPT_35_TURBO = "gpt-3.5-turbo"
31
-
32
- GOOGLE_15_FLASH = "gemini-1.5-flash-latest"
33
- GEMINI_PRO = ""
34
- TEXT_BISON = "text-bison-001"
35
- CHAT_BISON = "chat-bison-001"
36
- TEXT_BISON_32K = "text-bison-32k"
37
- TEXT_UNICORN = "text-unicorn-experimental"
38
-
39
- def getProviderFromModel(model: AVAILABLEMODELS) -> Provider:
40
- for alias, (provider, apiName) in _MODEL_METADATA.items():
41
- if model.value == apiName:
42
- return provider
1
+ from enum import Enum
2
+
3
+ class Provider(str, Enum):
4
+ OPENAI = "OPENAI"
5
+ GOOGLE = "GOOGLE"
6
+
7
+ # Maps model aliases → (provider, actual model name for API)
8
+ _MODEL_METADATA = {
9
+ "GPT_4": (Provider.OPENAI, "gpt-4"),
10
+ "GPT_4_32K": (Provider.OPENAI, "gpt-4-32k"),
11
+ "GPT_35T": (Provider.OPENAI, "gpt-3.5-turbo"),
12
+ "GPT_35T_INS": (Provider.OPENAI, "gpt-3.5-turbo-instruct"),
13
+ "GPT_35T_16K": (Provider.OPENAI, "gpt-3.5-turbo-16k"),
14
+ "GPT_35_TURBO": (Provider.OPENAI, "gpt-3.5-turbo"),
15
+
16
+ "GOOGLE_15_FLASH": (Provider.GOOGLE, "gemini-1.5-flash-latest"),
17
+ "GEMINI_PRO": (Provider.GOOGLE, "gemini-pro"),
18
+ "TEXT_BISON": (Provider.GOOGLE, "text-bison-001"),
19
+ "CHAT_BISON": (Provider.GOOGLE, "chat-bison-001"),
20
+ "TEXT_BISON_32K": (Provider.GOOGLE, "text-bison-32k"),
21
+ "TEXT_UNICORN": (Provider.GOOGLE, "text-unicorn-experimental"),
22
+ }
23
+
24
+ class AVAILABLEMODELS(str, Enum):
25
+ GPT_4 = "gpt-4"
26
+ GPT_4_32K = "gpt-4-32k"
27
+ GPT_35T = "gpt-3.5-turbo"
28
+ GPT_35T_INS = "gpt-3.5-turbo-instruct"
29
+ GPT_35T_16K = "gpt-3.5-turbo-16k"
30
+ GPT_35_TURBO = "gpt-3.5-turbo"
31
+
32
+ GOOGLE_15_FLASH = "gemini-1.5-flash-latest"
33
+ GEMINI_PRO = ""
34
+ TEXT_BISON = "text-bison-001"
35
+ CHAT_BISON = "chat-bison-001"
36
+ TEXT_BISON_32K = "text-bison-32k"
37
+ TEXT_UNICORN = "text-unicorn-experimental"
38
+
39
+ def getProviderFromModel(model: AVAILABLEMODELS) -> Provider:
40
+ for alias, (provider, apiName) in _MODEL_METADATA.items():
41
+ if model.value == apiName:
42
+ return provider
43
43
  raise ValueError(f"Provider not found for model: {model}")
llumo/sockets.py CHANGED
@@ -1,148 +1,148 @@
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
- self._expected_results = None # NEW
17
-
18
- # Initialize client
19
- self.sio = socketio.Client(
20
- # logger=True,
21
- # engineio_logger=True,
22
- reconnection=True,
23
- reconnection_attempts=10,
24
- reconnection_delay=1,
25
- )
26
-
27
- @self.sio.on("connect")
28
- def on_connect():
29
- # print("Socket connection established")
30
- self._connected = True
31
- # Don't set connection_established yet - wait for server confirmation
32
-
33
- # Listen for the connection-established event from the server
34
- @self.sio.on("connection-established")
35
- def on_connection_established(data):
36
- # print(
37
- # f"Server acknowledged connection with 'connection-established' event: {data}"
38
- # )
39
- if isinstance(data, dict) and "socketId" in data:
40
- self.server_socket_id = data["socketId"]
41
- # print(f"Received server socket ID: {self.server_socket_id}")
42
- self._connection_established.set()
43
-
44
- @self.sio.on("result-update")
45
- def on_result_update(data):
46
- with self._lock:
47
- # print(f"Received result-update event: {data}")
48
- self._received_data.append(data)
49
- self._last_update_time = time.time()
50
-
51
- # ✅ Stop if all expected results are received
52
- if self._expected_results and len(self._received_data) >= self._expected_results:
53
- # print("✅ All expected results received.")
54
- self._listening_done.set()
55
-
56
- @self.sio.on("disconnect")
57
- def on_disconnect():
58
- # print("Socket disconnected")
59
- self._connected = False
60
-
61
- @self.sio.on("connect_error")
62
- def on_connect_error(error):
63
- print(f"Socket connection error: {error}")
64
-
65
- @self.sio.on("error")
66
- def on_error(error):
67
- print(f"Socket error event: {error}")
68
-
69
- def connect(self, timeout=20):
70
- self._received_data = []
71
- self._connection_established.clear()
72
- self._listening_done.clear()
73
- self.server_socket_id = None
74
- self._connected = False
75
-
76
- try:
77
- # print("[DEBUG] Connecting to socket...")
78
- self.sio.connect(self.socket_url, transports=["websocket"], wait=True)
79
-
80
- # Wait for socket connection
81
- start = time.time()
82
- while not self.sio.connected:
83
- if time.time() - start > timeout:
84
- raise RuntimeError("Timed out waiting for low-level socket connection.")
85
- time.sleep(0.1)
86
- # print("[DEBUG] SocketIO low-level connection established.")
87
-
88
- # Wait for server "connection-established" event
89
- if not self._connection_established.wait(timeout):
90
- raise RuntimeError("Timed out waiting for connection-established event.")
91
-
92
- self._connected = True
93
- self._last_update_time = time.time()
94
- # print(f"[DEBUG] Full connection established. Connected: {self._connected}")
95
-
96
- return self.server_socket_id or self.sio.sid
97
-
98
- except Exception as e:
99
- # print(f"[DEBUG] Connection failed with error: {e}")
100
- self._connected = False
101
- raise RuntimeError(f"WebSocket connection failed: {e}")
102
-
103
- def listenForResults(self, min_wait=30, max_wait=300, inactivity_timeout=50, expected_results=None):
104
- if not self._connected:
105
- raise RuntimeError("WebSocket is not connected. Call connect() first.")
106
-
107
- self._expected_results = expected_results # NEW
108
- start_time = time.time()
109
- self._last_update_time = time.time()
110
-
111
- def timeout_watcher():
112
- while not self._listening_done.is_set():
113
- current_time = time.time()
114
- time_since_last_update = current_time - self._last_update_time
115
- total_elapsed = current_time - start_time
116
-
117
- if total_elapsed < min_wait:
118
- time.sleep(0.5)
119
- continue
120
-
121
- if total_elapsed > max_wait:
122
- # print(f"⚠️ Max wait time {max_wait}s exceeded.")
123
- self._listening_done.set()
124
- break
125
-
126
- if time_since_last_update > inactivity_timeout:
127
- # print(f"⚠️ Inactivity timeout {inactivity_timeout}s exceeded.")
128
- self._listening_done.set()
129
- break
130
-
131
- time.sleep(1)
132
-
133
- timeout_thread = threading.Thread(target=timeout_watcher, daemon=True)
134
- timeout_thread.start()
135
- self._listening_done.wait()
136
-
137
- def getReceivedData(self):
138
- with self._lock:
139
- return self._received_data.copy()
140
-
141
- def disconnect(self):
142
- try:
143
- if self._connected:
144
- self.sio.disconnect()
145
- self._connected = False
146
- # print("WebSocket client disconnected")
147
- except Exception as e:
148
- 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
+ self._expected_results = None # NEW
17
+
18
+ # Initialize client
19
+ self.sio = socketio.Client(
20
+ # logger=True,
21
+ # engineio_logger=True,
22
+ reconnection=True,
23
+ reconnection_attempts=10,
24
+ reconnection_delay=1,
25
+ )
26
+
27
+ @self.sio.on("connect")
28
+ def on_connect():
29
+ # print("Socket connection established")
30
+ self._connected = True
31
+ # Don't set connection_established yet - wait for server confirmation
32
+
33
+ # Listen for the connection-established event from the server
34
+ @self.sio.on("connection-established")
35
+ def on_connection_established(data):
36
+ # print(
37
+ # f"Server acknowledged connection with 'connection-established' event: {data}"
38
+ # )
39
+ if isinstance(data, dict) and "socketId" in data:
40
+ self.server_socket_id = data["socketId"]
41
+ # print(f"Received server socket ID: {self.server_socket_id}")
42
+ self._connection_established.set()
43
+
44
+ @self.sio.on("result-update")
45
+ def on_result_update(data):
46
+ with self._lock:
47
+ # print(f"Received result-update event: {data}")
48
+ self._received_data.append(data)
49
+ self._last_update_time = time.time()
50
+
51
+ # ✅ Stop if all expected results are received
52
+ if self._expected_results and len(self._received_data) >= self._expected_results:
53
+ # print("✅ All expected results received.")
54
+ self._listening_done.set()
55
+
56
+ @self.sio.on("disconnect")
57
+ def on_disconnect():
58
+ # print("Socket disconnected")
59
+ self._connected = False
60
+
61
+ @self.sio.on("connect_error")
62
+ def on_connect_error(error):
63
+ print(f"Socket connection error: {error}")
64
+
65
+ @self.sio.on("error")
66
+ def on_error(error):
67
+ print(f"Socket error event: {error}")
68
+
69
+ def connect(self, timeout=20):
70
+ self._received_data = []
71
+ self._connection_established.clear()
72
+ self._listening_done.clear()
73
+ self.server_socket_id = None
74
+ self._connected = False
75
+
76
+ try:
77
+ # print("[DEBUG] Connecting to socket...")
78
+ self.sio.connect(self.socket_url, transports=["websocket"], wait=True)
79
+
80
+ # Wait for socket connection
81
+ start = time.time()
82
+ while not self.sio.connected:
83
+ if time.time() - start > timeout:
84
+ raise RuntimeError("Timed out waiting for low-level socket connection.")
85
+ time.sleep(0.1)
86
+ # print("[DEBUG] SocketIO low-level connection established.")
87
+
88
+ # Wait for server "connection-established" event
89
+ if not self._connection_established.wait(timeout):
90
+ raise RuntimeError("Timed out waiting for connection-established event.")
91
+
92
+ self._connected = True
93
+ self._last_update_time = time.time()
94
+ # print(f"[DEBUG] Full connection established. Connected: {self._connected}")
95
+
96
+ return self.server_socket_id or self.sio.sid
97
+
98
+ except Exception as e:
99
+ # print(f"[DEBUG] Connection failed with error: {e}")
100
+ self._connected = False
101
+ raise RuntimeError(f"WebSocket connection failed: {e}")
102
+
103
+ def listenForResults(self, min_wait=30, max_wait=300, inactivity_timeout=50, expected_results=None):
104
+ if not self._connected:
105
+ raise RuntimeError("WebSocket is not connected. Call connect() first.")
106
+
107
+ self._expected_results = expected_results # NEW
108
+ start_time = time.time()
109
+ self._last_update_time = time.time()
110
+
111
+ def timeout_watcher():
112
+ while not self._listening_done.is_set():
113
+ current_time = time.time()
114
+ time_since_last_update = current_time - self._last_update_time
115
+ total_elapsed = current_time - start_time
116
+
117
+ if total_elapsed < min_wait:
118
+ time.sleep(0.5)
119
+ continue
120
+
121
+ if total_elapsed > max_wait:
122
+ # print(f"⚠️ Max wait time {max_wait}s exceeded.")
123
+ self._listening_done.set()
124
+ break
125
+
126
+ if time_since_last_update > inactivity_timeout:
127
+ # print(f"⚠️ Inactivity timeout {inactivity_timeout}s exceeded.")
128
+ self._listening_done.set()
129
+ break
130
+
131
+ time.sleep(1)
132
+
133
+ timeout_thread = threading.Thread(target=timeout_watcher, daemon=True)
134
+ timeout_thread.start()
135
+ self._listening_done.wait()
136
+
137
+ def getReceivedData(self):
138
+ with self._lock:
139
+ return self._received_data.copy()
140
+
141
+ def disconnect(self):
142
+ try:
143
+ if self._connected:
144
+ self.sio.disconnect()
145
+ self._connected = False
146
+ # print("WebSocket client disconnected")
147
+ except Exception as e:
148
+ print(f"Error during WebSocket disconnect: {e}")
@@ -1,26 +1,26 @@
1
- Metadata-Version: 2.4
2
- Name: llumo
3
- Version: 0.1.8
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.9
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,14 @@
1
+ llumo/.env,sha256=Vx5FkuywpYHXH2N8epJ7PlNOPiwx9UP9DUz4vWd0urs,373
2
+ llumo/__init__.py,sha256=Ro08YEqv03qSyn54Gj8x2LUSLSZeXBQjvuODmMpqjHA,212
3
+ llumo/client.py,sha256=9QtL8xLH0doqkJIQqhNIaR3Mlma2hkiQsylFLfaboKs,22998
4
+ llumo/exceptions.py,sha256=bmYQYdTz2ooM0CYs3M4iHYxQrVmc46dNey_fCkiaUxo,1700
5
+ llumo/execution.py,sha256=jSkyI2l6bowum82RDI60Tkmoe2bVnrvkJnqr8mNWjBE,1451
6
+ llumo/functionCalling.py,sha256=_qVC987oR7nWIFmRSKDkysMgXC7tJycN6nUUniBusAc,7380
7
+ llumo/helpingFuntions.py,sha256=_eGra7Ci79eI2e37hSIq3CMN2bgdQUTv55PydITs5NI,1468
8
+ llumo/models.py,sha256=WBtnu7ckOy9TGRiwswz04xOGYF6EslTUOxHUz4QWzUA,1602
9
+ llumo/sockets.py,sha256=uehnOHKqZYKek4XN5ya348OmdED-hGTXRcO8onL1XUM,5727
10
+ llumo-0.1.9.dist-info/licenses/LICENSE,sha256=vMiqSi3KpDHq3RFxKiqdh10ZUF3PjE3nnntANU-HEu4,186
11
+ llumo-0.1.9.dist-info/METADATA,sha256=NpdYEwl-E-gmFVSLtfEyxafcZF8ykErKEvVha2VDIdY,721
12
+ llumo-0.1.9.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
13
+ llumo-0.1.9.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
14
+ llumo-0.1.9.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.
@@ -1,13 +0,0 @@
1
- llumo/__init__.py,sha256=O04b4yW1BnOvcHzxWFddAKhtdBEhBNhLdb6xgnpHH_Q,205
2
- llumo/client.py,sha256=Qc-LTgAiW4D8Q18oZlkNTDP8Csd_fPDI41zYaXkFD1M,22437
3
- llumo/exceptions.py,sha256=KGmztP61dkkzCTBEiRv5Xe9HrLNv1s_fYioRCG64GUU,1656
4
- llumo/execution.py,sha256=x88wQV8eL99wNN5YtjFaAMCIfN1PdfQVlAZQb4vzgQ0,1413
5
- llumo/functionCalling.py,sha256=QtuTtyoz5rnfNUrNT1kzegNPOrMFjrlgxZfwTqRMdiA,7190
6
- llumo/helpingFuntions.py,sha256=BWRoAAXG3Dsovc9bk-pDD2feQM_3ERXz_MwNgux0e7Q,1418
7
- llumo/models.py,sha256=YH-qAMnShmUpmKE2LQAzQdpRsaXkFSlOqMxHwU4zBUI,1560
8
- llumo/sockets.py,sha256=Qxxqtx3Hg07HLhA4QfcipK1ChiOYhHZBu02iA6MfYlQ,5579
9
- llumo-0.1.8.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
10
- llumo-0.1.8.dist-info/METADATA,sha256=nRQD4QA9Bf5OPisfsG4tjJwXN4fg5eADW1YuDxvZ-dg,695
11
- llumo-0.1.8.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
12
- llumo-0.1.8.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
13
- llumo-0.1.8.dist-info/RECORD,,
File without changes