llumo 0.2.40__py3-none-any.whl → 0.2.41__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
@@ -43,9 +43,9 @@ createEvalUrl = "https://backend-api.llumo.ai/api/v1/create-debug-log-for-sdk"
43
43
 
44
44
  class LlumoClient:
45
45
 
46
- def __init__(self, api_key, playground_id=None):
46
+ def __init__(self, api_key, playgroundID=None):
47
47
  self.apiKey = api_key
48
- self.playgroundID = playground_id
48
+ self.playgroundID = playgroundID
49
49
  self.evalData = []
50
50
  self.evals = []
51
51
  self.processMapping = {}
@@ -2082,6 +2082,115 @@ class LlumoClient:
2082
2082
  definationMapping=self.definationMapping,
2083
2083
  )
2084
2084
 
2085
+ def get_evaluate_multiple(
2086
+ self,
2087
+ data,
2088
+ evals
2089
+ ) -> List:
2090
+
2091
+ print("Evaluating multiple data with evals:", data, evals)
2092
+
2093
+ dataID = uuid.uuid4().hex[:36]
2094
+
2095
+ self.validateApiKey()
2096
+
2097
+ if not self.workspaceID:
2098
+ raise LlumoAIError("Workspace ID not found after validation.")
2099
+
2100
+ payload = {
2101
+ "dataID": dataID,
2102
+ "data": data,
2103
+ "evals": evals,
2104
+ "workspaceID": self.workspaceID,
2105
+ "playgroundID": self.playgroundID,
2106
+ }
2107
+
2108
+ print("payload", payload)
2109
+
2110
+ # Create evaluation
2111
+ requests.post(
2112
+ "https://backend-api.llumo.ai/api/v1/sdk/create-evaluation-Multiple",
2113
+ json=payload,
2114
+ headers={
2115
+ "Content-Type": "application/json",
2116
+ "Authorization": f"Bearer {self.apiKey}",
2117
+ },
2118
+ )
2119
+
2120
+ final_result_data = []
2121
+
2122
+ cursor = "0-0"
2123
+ limit = 10
2124
+ all_data_fetched = False
2125
+
2126
+ while not all_data_fetched:
2127
+ try:
2128
+ response = requests.get(
2129
+ "https://backend-api.llumo.ai/api/v1/sdk/poll",
2130
+ params={
2131
+ "cursor": cursor,
2132
+ "dataID": dataID,
2133
+ "limit": limit,
2134
+ },
2135
+ )
2136
+
2137
+ response_data = response.json()
2138
+ result_data = response_data.get("debugLog", {})
2139
+ print("resultData", result_data)
2140
+
2141
+ results = result_data.get("results", [])
2142
+ final_result_data.extend(results)
2143
+
2144
+ cursor = result_data.get("nextCursor")
2145
+
2146
+ if len(final_result_data) == len(data):
2147
+ all_data_fetched = True
2148
+
2149
+ time.sleep(10)
2150
+
2151
+ except Exception as error:
2152
+ print("error", error)
2153
+ all_data_fetched = True
2154
+
2155
+ # Shape results
2156
+ formatted_results = []
2157
+
2158
+ for row in final_result_data:
2159
+ score: Dict[str, float | None] = {}
2160
+ reasoning: Dict[str, str] = {}
2161
+
2162
+ for eval_name in evals:
2163
+ details = row.get(eval_name)
2164
+
2165
+ if isinstance(details, dict):
2166
+ if isinstance(details.get("value"), (int, float)):
2167
+ score[eval_name] = details.get("value")
2168
+ else:
2169
+ score[eval_name] = details.get("score")
2170
+ reasoning[eval_name] = details.get("reasoning", "")
2171
+
2172
+ elif "score" in row:
2173
+ score[eval_name] = (
2174
+ row["score"] if isinstance(row["score"], (int, float)) else None
2175
+ )
2176
+ reasoning[eval_name] = row.get("reasoning", "")
2177
+ else:
2178
+ score[eval_name] = None
2179
+ reasoning[eval_name] = ""
2180
+
2181
+ formatted_row = {
2182
+ "context": row.get("context", ""),
2183
+ "query": row.get("query", ""),
2184
+ "output": row.get("output", ""),
2185
+ "score": score,
2186
+ "reasoning": reasoning,
2187
+ }
2188
+
2189
+ print(formatted_row)
2190
+ formatted_results.append(formatted_row)
2191
+
2192
+ return formatted_results
2193
+
2085
2194
 
2086
2195
  class SafeDict(dict):
2087
2196
  def __missing__(self, key):
@@ -30,7 +30,7 @@ def getLlumoRun():
30
30
 
31
31
  class LlumoSessionContext(LlumoClient):
32
32
  def __init__(self, logger, sessionID: Optional[str] = None):
33
- super().__init__(api_key=logger.apiKey, playground_id=logger.getPlaygroundID())
33
+ super().__init__(api_key=logger.apiKey, playgroundID=logger.getPlaygroundID())
34
34
  self.sessionID = sessionID or str(uuid.uuid4().hex[:14])
35
35
  self.logger = logger
36
36
  self.apiKey = logger.apiKey
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llumo
3
- Version: 0.2.40
3
+ Version: 0.2.41
4
4
  Summary: Python SDK for interacting with the Llumo ai API.
5
5
  Home-page: https://www.llumo.ai/
6
6
  Author: Llumo
@@ -2,19 +2,19 @@ llumo/__init__.py,sha256=kkuppu7ZPiVZFdnYzJ9BM3syMbYHOSZLpwKwAvGHsnY,311
2
2
  llumo/callback.py,sha256=XQbImLnd64_B2Iir-FCaJcL5Kmpm3RlXJH2zDRXk_yk,25135
3
3
  llumo/callbacks-0.py,sha256=TEIOCWRvk2UYsTmBMBsnlgpqWvr-2y3a6d0w_e96NRM,8958
4
4
  llumo/chains.py,sha256=6lCgLseh04RUgc6SahhmvQj82quay2Mi1j8gPUlx8Es,2923
5
- llumo/client.py,sha256=W0_i5M5mN0B_YfDWaT6qDUGY93PeqzcK6JxZdIFXibk,79903
5
+ llumo/client.py,sha256=YTNdvtv03BVDNHeLypHQadDN2PpXsyOk0dM8hc7P-Ts,83205
6
6
  llumo/exceptions.py,sha256=1OyhN9YL9LcyUPUsqYHq6Rret0udATZAwMVJaio2_Ec,2123
7
7
  llumo/execution.py,sha256=nWbJ7AvWuUPcOb6i-JzKRna_PvF-ewZTiK8skS-5n3w,1380
8
8
  llumo/functionCalling.py,sha256=D5jYapu1rIvdIJNUYPYMTyhQ1H-6nkwoOLMi6eekfUE,7241
9
9
  llumo/google.py,sha256=6y9YnDFDRHv6-sQNT5LIsV9p31BCN0B9eow5KTRBWfM,2185
10
10
  llumo/helpingFuntions.py,sha256=eMR2Rq8vw4X5sIESOvjOBrEvyYE00Eq7XlQjV66eVcg,29977
11
11
  llumo/llumoLogger.py,sha256=ALM4461jItWcvYL9HzTGmB-X-M77YF_9PTeTPxtmP_E,2223
12
- llumo/llumoSessionContext.py,sha256=f4C6w5H7Fym6lC6KK8wY8kW5VPb0hNrBEvh6zkCSkfk,14881
12
+ llumo/llumoSessionContext.py,sha256=XA2SIXKh62NRz1qxkvhpo7ziOhushG2CkJgjUWlmvFw,14880
13
13
  llumo/models.py,sha256=aVEZsOOoQx5LeNtwSyBxqvrINq0izH3QWu_YjsMPE6o,2910
14
14
  llumo/openai.py,sha256=VstBzaORe8Tq0feUIIEszzcN1oq6TJfkPviaCr5d3Bw,8950
15
15
  llumo/sockets.py,sha256=pfWz1zTEiwqJhdbSy3i3_Y4WlIdJ3cuac11wMePeBS0,6130
16
- llumo-0.2.40.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
17
- llumo-0.2.40.dist-info/METADATA,sha256=qzr5dj9AT4vbOpU_IgwHpFcqojjupUusLIoBqYR-qXo,1662
18
- llumo-0.2.40.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- llumo-0.2.40.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
20
- llumo-0.2.40.dist-info/RECORD,,
16
+ llumo-0.2.41.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
17
+ llumo-0.2.41.dist-info/METADATA,sha256=pamF6aPT4DF9NO1361IN4dcJ63O2YUCxdeMPPut2bd0,1662
18
+ llumo-0.2.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ llumo-0.2.41.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
20
+ llumo-0.2.41.dist-info/RECORD,,
File without changes