llumo 0.2.17b1__py3-none-any.whl → 0.2.19__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/client.py CHANGED
@@ -632,20 +632,24 @@ class LlumoClient:
632
632
  dataframe = pd.DataFrame(data).astype(str)
633
633
  workspaceID = None
634
634
  email = None
635
- socketID = self.socket.connect(timeout=250)
635
+ try:
636
+ socketID = self.socket.connect(timeout=250)
637
+ except Exception as e:
638
+ socketID="DummySocketID"
639
+
636
640
  self.evalData=[]
637
641
  self.evals=evals
638
642
  self.allBatches = []
639
643
  rowIdMapping = {} # (rowID-columnID-columnID -> (index, evalName))
640
644
 
641
645
  # Wait for socket connection
642
- max_wait_secs = 20
643
- waited_secs = 0
644
- while not self.socket._connection_established.is_set():
645
- time.sleep(0.1)
646
- waited_secs += 0.1
647
- if waited_secs >= max_wait_secs:
648
- raise RuntimeError("Timeout waiting for server connection")
646
+ # max_wait_secs = 20
647
+ # waited_secs = 0
648
+ # while not self.socket._connection_established.is_set():
649
+ # time.sleep(0.1)
650
+ # waited_secs += 0.1
651
+ # if waited_secs >= max_wait_secs:
652
+ # raise RuntimeError("Timeout waiting for server connection")
649
653
 
650
654
  # Start listener thread
651
655
  expectedResults = len(dataframe) * len(evals)
@@ -1093,13 +1097,16 @@ class LlumoClient:
1093
1097
 
1094
1098
  # Connect to socket
1095
1099
  self.socket = LlumoSocketClient(socketUrl)
1096
- socketID = self.socket.connect(timeout=150)
1097
- waited_secs = 0
1098
- while not self.socket._connection_established.is_set():
1099
- time.sleep(0.1)
1100
- waited_secs += 0.1
1101
- if waited_secs >= 20:
1102
- raise RuntimeError("Timeout waiting for server 'connection-established' event.")
1100
+ try:
1101
+ socketID = self.socket.connect(timeout=150)
1102
+ except Exception as e:
1103
+ socketID="DummySocketID"
1104
+ # waited_secs = 0
1105
+ # while not self.socket._connection_established.is_set():
1106
+ # time.sleep(0.1)
1107
+ # waited_secs += 0.1
1108
+ # if waited_secs >= 20:
1109
+ # raise RuntimeError("Timeout waiting for server 'connection-established' event.")
1103
1110
 
1104
1111
  self.validateApiKey()
1105
1112
 
@@ -1348,13 +1355,16 @@ class LlumoClient:
1348
1355
 
1349
1356
  # Connect to socket
1350
1357
  self.socket = LlumoSocketClient(socketUrl)
1351
- socketID = self.socket.connect(timeout=150)
1352
- waited_secs = 0
1353
- while not self.socket._connection_established.is_set():
1354
- time.sleep(0.1)
1355
- waited_secs += 0.1
1356
- if waited_secs >= 20:
1357
- raise RuntimeError("Timeout waiting for server 'connection-established' event.")
1358
+ try:
1359
+ socketID = self.socket.connect(timeout=150)
1360
+ except Exception as e:
1361
+ socketID="DummySocketID"
1362
+ # waited_secs = 0
1363
+ # while not self.socket._connection_established.is_set():
1364
+ # time.sleep(0.1)
1365
+ # waited_secs += 0.1
1366
+ # if waited_secs >= 20:
1367
+ # raise RuntimeError("Timeout waiting for server 'connection-established' event.")
1358
1368
 
1359
1369
  self.validateApiKey()
1360
1370
 
@@ -1545,7 +1555,68 @@ class LlumoClient:
1545
1555
  return False
1546
1556
 
1547
1557
 
1558
+ def createExperimentWithEvals(
1559
+ self,
1560
+ data,
1561
+ evals: list, # list of eval metric names
1562
+ prompt_template="Give answer to the given query: {{query}} using the given context: {{context}}.",
1563
+ outputColName="output",
1564
+ createExperiment: bool = False,
1565
+ getDataFrame:bool =False,
1566
+ _tocheck=True,
1567
+ ):
1568
+ if isinstance(data, dict):
1569
+ data = [data]
1570
+ elif not isinstance(data, list):
1571
+ raise ValueError("Data should be a dict or a list of dicts.")
1572
+ dataframe = pd.DataFrame(data).astype(str)
1573
+ workspaceID = None
1574
+ email = None
1575
+ self.evalData=[]
1576
+ self.evals=evals
1577
+ self.allBatches = []
1578
+ rowIdMapping = {} # (rowID-columnID-columnID -> (index, evalName))
1579
+ self.validateApiKey(evalName=evals[0])
1580
+ if createExperiment:
1581
+ activePlayground = str(createEvalPlayground(email=self.email, workspaceID=self.workspaceID))
1582
+
1583
+ else:
1584
+ activePlayground = f"{int(time.time() * 1000)}{uuid.uuid4()}".replace(
1585
+ "-", ""
1586
+ )
1587
+ for evalName in evals:
1588
+ self.validateApiKey(evalName=evalName)
1589
+ self.evalData =dataframe.to_dict(orient="records")
1590
+ if createExperiment:
1591
+ print("heading to upload")
1592
+ pd.set_option("future.no_silent_downcasting", True)
1593
+ # df = dataframe.fillna("Some error occured").astype(object)
1594
+ with warnings.catch_warnings():
1595
+ warnings.simplefilter(action='ignore', category=FutureWarning)
1596
+ df = dataframe.fillna("Some error occurred").astype(str)
1548
1597
 
1598
+ df = dataframe.fillna("Some error occured").infer_objects(copy=False)
1599
+ if createPlayground(
1600
+ self.email,
1601
+ self.workspaceID,
1602
+ df,
1603
+ promptText=prompt_template,
1604
+ definationMapping=self.definationMapping,
1605
+ outputColName=outputColName,
1606
+ activePlayground= activePlayground
1607
+ ):
1608
+ print(
1609
+ "LLUMO’s intuitive UI is ready—start exploring and experimenting with your logs now. Visit https://llumo.ai/evallm to see the results."
1610
+ )
1611
+
1612
+ else:
1613
+ if getDataFrame:
1614
+ return LlumoDataFrameResults(dataframe,evals=self.evals,evalData=self.evalData,definationMapping=self.definationMapping)
1615
+ else:
1616
+ data=dataframe.to_dict(orient="records")
1617
+ return LlumoDictResults(data,evals=self.evals,evalData=self.evalData,definationMapping=self.definationMapping)
1618
+
1619
+
1549
1620
  class SafeDict(dict):
1550
1621
  def __missing__(self, key):
1551
1622
  return ""
llumo/sockets.py CHANGED
@@ -67,7 +67,8 @@ class LlumoSocketClient:
67
67
 
68
68
  @self.sio.on("connect_error")
69
69
  def on_connect_error(error):
70
- print(f"Socket connection error: {error}")
70
+ # print(f"Socket connection error: {error}")
71
+ pass
71
72
 
72
73
  @self.sio.on("error")
73
74
  def on_error(error):
@@ -109,7 +110,8 @@ class LlumoSocketClient:
109
110
  except Exception as e:
110
111
  # print(f"[DEBUG] Connection failed with error: {e}")
111
112
  self._connected = False
112
- raise RuntimeError(f"WebSocket connection failed: {e}")
113
+ # raise RuntimeError(f"WebSocket connection failed: {e}")
114
+ print("It seems your internet connection is a bit unstable. This might take a little longer than usual—thanks for your patience!")
113
115
 
114
116
  def listenForResults(
115
117
  self, min_wait=30, max_wait=300, inactivity_timeout=50, expected_results=None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llumo
3
- Version: 0.2.17b1
3
+ Version: 0.2.19
4
4
  Summary: Python SDK for interacting with the Llumo ai API.
5
5
  Home-page: https://www.llumo.ai/
6
6
  Author: Llumo
@@ -23,6 +23,7 @@ Requires-Dist: python-dotenv
23
23
  Requires-Dist: openai==1.75.0
24
24
  Requires-Dist: tqdm==4.67.1
25
25
  Requires-Dist: google-generativeai==0.8.5
26
+ Requires-Dist: websocket-client==1.8.0
26
27
  Dynamic: author
27
28
  Dynamic: author-email
28
29
  Dynamic: classifier
@@ -1,6 +1,6 @@
1
1
  llumo/__init__.py,sha256=YVBkF1fiXFBd_zzySi9BDWgX8MJuLBJ-oF8538MrnDU,256
2
2
  llumo/chains.py,sha256=6lCgLseh04RUgc6SahhmvQj82quay2Mi1j8gPUlx8Es,2923
3
- llumo/client.py,sha256=EQu9mbUzD0bkf-KAQz4shSFCIKH4QFgZn97jOPFIKPU,60281
3
+ llumo/client.py,sha256=oLFlVRUh6GIL9pcSuFE93P0uiUzpIvKEhXtYgGmzu24,63289
4
4
  llumo/exceptions.py,sha256=Vp_MnanHbnd1Yjuoi6WLrKiwwZbJL3znCox2URMmGU4,2032
5
5
  llumo/execution.py,sha256=nWbJ7AvWuUPcOb6i-JzKRna_PvF-ewZTiK8skS-5n3w,1380
6
6
  llumo/functionCalling.py,sha256=D5jYapu1rIvdIJNUYPYMTyhQ1H-6nkwoOLMi6eekfUE,7241
@@ -8,9 +8,9 @@ llumo/google.py,sha256=3S_aRtbtlctCXPGR0u4baLlkyFrsjd02vlUCkoRPA5U,2147
8
8
  llumo/helpingFuntions.py,sha256=ORBM5xPPMHc3ENnJOg4i3Enxtor4En5oDj1d0Zu1mLk,25284
9
9
  llumo/models.py,sha256=aVEZsOOoQx5LeNtwSyBxqvrINq0izH3QWu_YjsMPE6o,2910
10
10
  llumo/openai.py,sha256=DGhEwQIJIIycGpw3hYQnyxdj6RFVpZ-gay-fZGqtkhU,3013
11
- llumo/sockets.py,sha256=I2JO_eNEctRo_ikgvFVp5zDd-m0VDu04IEUhhsa1Tic,5950
12
- llumo-0.2.17b1.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
13
- llumo-0.2.17b1.dist-info/METADATA,sha256=pn1RBU-MVeVt5nfkTsVQOQX2ktLSCCVnSKvIctkeIq0,1521
14
- llumo-0.2.17b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- llumo-0.2.17b1.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
16
- llumo-0.2.17b1.dist-info/RECORD,,
11
+ llumo/sockets.py,sha256=pBDo-U65hMIMwKMwZQl3iBkEjISEt-9BkXxZTWfSHF4,6116
12
+ llumo-0.2.19.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
13
+ llumo-0.2.19.dist-info/METADATA,sha256=ef_ff3tb4BdWqBUvau2Y-E-zkG54RyqVx6m87-RETMo,1558
14
+ llumo-0.2.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ llumo-0.2.19.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
16
+ llumo-0.2.19.dist-info/RECORD,,