llumo 0.1.6b2__py3-none-any.whl → 0.1.7__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,146 +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
- # 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
+ 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.6b2
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.7
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=hrKH97PZ6i3KMfT7a6g3KzN_pzvpN8W5oMWMn2gO4tI,23986
4
+ llumo/exceptions.py,sha256=bmYQYdTz2ooM0CYs3M4iHYxQrVmc46dNey_fCkiaUxo,1700
5
+ llumo/execution.py,sha256=jSkyI2l6bowum82RDI60Tkmoe2bVnrvkJnqr8mNWjBE,1451
6
+ llumo/functionCalling.py,sha256=JwCxK_TJcFZMPP7ujqsoYfrX45XLxQfGqmyOdlwAtcM,7315
7
+ llumo/helpingFuntions.py,sha256=_eGra7Ci79eI2e37hSIq3CMN2bgdQUTv55PydITs5NI,1468
8
+ llumo/models.py,sha256=WBtnu7ckOy9TGRiwswz04xOGYF6EslTUOxHUz4QWzUA,1602
9
+ llumo/sockets.py,sha256=rxeUHaxwqg1vSlplohS-aLycbW125ocqk04RiV20Ldg,5835
10
+ llumo-0.1.7.dist-info/licenses/LICENSE,sha256=vMiqSi3KpDHq3RFxKiqdh10ZUF3PjE3nnntANU-HEu4,186
11
+ llumo-0.1.7.dist-info/METADATA,sha256=jwC_sLeRrvmw-uJv_xbVbn3AbeUBYWB7RaPzQdE3850,721
12
+ llumo-0.1.7.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
13
+ llumo-0.1.7.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
14
+ llumo-0.1.7.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=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.6b2.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
10
- llumo-0.1.6b2.dist-info/METADATA,sha256=1wIo9mvN3sRYuzmr3ssUfmF9LQIQDW7axJXQ6iAC7Hg,697
11
- llumo-0.1.6b2.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
12
- llumo-0.1.6b2.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
13
- llumo-0.1.6b2.dist-info/RECORD,,
File without changes