llumo 0.2.27__py3-none-any.whl → 0.2.29__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/google.py CHANGED
@@ -15,9 +15,9 @@ def evaluate_multiple(data, api_key=None, evals=["Response Correctness"]):
15
15
 
16
16
 
17
17
  class ChatCompletionWithEval:
18
- def __init__(self, response, evaluation):
18
+ def __init__(self, response, evaluation=None):
19
19
  self._response = response
20
- self.evaluation = evaluation
20
+ # self.evaluation = evaluation
21
21
 
22
22
  def __getattr__(self, name):
23
23
  return getattr(self._response, name)
@@ -46,21 +46,21 @@ class genai:
46
46
  response = self._model_instance.generate_content(contents=contents, **kwargs)
47
47
  output = response.text
48
48
 
49
- eval_input = [{
50
- "query": contents,
51
- "context": context or contents,
52
- "output": output,
53
- }]
49
+ # eval_input = [{
50
+ # "query": contents,
51
+ # "context": context or contents,
52
+ # "output": output,
53
+ # }]
54
54
 
55
- evaluation = None
56
- try:
57
- evaluation = evaluate_multiple(data=eval_input, evals=evals, api_key=llumo_key)
58
- except Exception as e:
59
- evaluation = None
55
+ # evaluation = None
56
+ # try:
57
+ # evaluation = evaluate_multiple(data=eval_input, evals=evals, api_key=llumo_key)
58
+ # except Exception as e:
59
+ # evaluation = None
60
60
 
61
- if evaluation is None:
62
- print("Cannot process your request for evaluation, please check your api and try again later.")
63
- return response
61
+ # if evaluation is None:
62
+ # print("Cannot process your request for evaluation, please check your api and try again later.")
63
+ # return response
64
64
 
65
65
 
66
- return ChatCompletionWithEval(response, evaluation)
66
+ return ChatCompletionWithEval(response, evaluation=None)
@@ -91,7 +91,7 @@ class LlumoSessionContext(LlumoClient):
91
91
  ]
92
92
  run["steps"] = clean_steps
93
93
 
94
- print(run["runName"]) # optional debug log
94
+ # print(run["runName"]) # optional debug log
95
95
 
96
96
  # STEP 3: Send the payload
97
97
  url = "https://app.llumo.ai/api/create-debug-log"
@@ -107,7 +107,7 @@ class LlumoSessionContext(LlumoClient):
107
107
  except requests.exceptions.Timeout:
108
108
  print("Request timed out.")
109
109
  except requests.exceptions.RequestException as e:
110
- print(f"Request failed: {e}")
110
+ pass
111
111
 
112
112
  # Cleanup
113
113
  if self.threadLlumoRun:
@@ -120,7 +120,7 @@ class LlumoSessionContext(LlumoClient):
120
120
  stepName: str,
121
121
  metadata: Optional[dict] = None,
122
122
  ):
123
- print(f"logged: {stepType}")
123
+ # print(f"logged: {stepType}")
124
124
  run = getLlumoRun()
125
125
  if run is None:
126
126
  raise RuntimeError("No active run to log steps.")
llumo/openai.py CHANGED
@@ -25,9 +25,13 @@ def performEvaluation(data, api_key=None, evals=["Response Correctness"], **kwar
25
25
 
26
26
  # Wrapper around ChatCompletion to allow custom fields like `.evaluation`
27
27
  class ChatCompletionWithEval:
28
- def __init__(self, response, evaluation):
28
+ def __init__(
29
+ self,
30
+ response,
31
+ # , evaluation
32
+ ):
29
33
  self._response = response
30
- self.evaluation = evaluation
34
+ # self.evaluation = evaluation
31
35
 
32
36
  def __getattr__(self, name):
33
37
  return getattr(self._response, name)
@@ -70,65 +74,65 @@ class OpenAI(OpenAIClient):
70
74
  workspace_id = self.session.logger.getWorkspaceID()
71
75
 
72
76
  # Input Bias Evaluation
73
- eval_input_bias = [
74
- {
75
- "query": user_message,
76
- "context": context,
77
- "output": "", # No output yet
78
- }
79
- ]
80
- try:
81
- start_time = time.time()
82
- bias_evaluation_result = performEvaluation(
83
- eval_input_bias,
84
- api_key=self.llumo_key,
85
- evals=["Input Bias"],
86
- playgroundID=playground_id,
87
- workspaceID=workspace_id,
88
- createExperiment=create_experiment,
89
- )
90
- latency = int((time.time() - start_time) * 1000)
91
- # Access the first result object
92
- bias_evaluation = bias_evaluation_result[0]
93
- message = "-".join(
94
- getattr(bias_evaluation, "edgeCases", {}).get("value", [])
95
- )
96
- self.session.logEvalStep(
97
- stepName=f"EVAL-Input Bias",
98
- output="",
99
- context=context,
100
- query=user_message,
101
- messageHistory="",
102
- tools="",
103
- intermediateSteps="",
104
- groundTruth="",
105
- analyticsScore=getattr(bias_evaluation, "analyticsScore", {}),
106
- reasoning=getattr(bias_evaluation, "reasoning", {}),
107
- classification=getattr(bias_evaluation, "classification", {}),
108
- evalLabel=getattr(bias_evaluation, "evalLabel", {}),
109
- latencyMs=latency,
110
- status="SUCCESS",
111
- message=message,
112
- )
113
- except Exception as e:
114
- print(f"Input Bias evaluation failed: {e}")
115
- self.session.logEvalStep(
116
- stepName=f"EVAL-FAILURE",
117
- output="",
118
- context=context,
119
- query=user_message,
120
- messageHistory="",
121
- tools="",
122
- intermediateSteps="",
123
- groundTruth="",
124
- analyticsScore={},
125
- reasoning={},
126
- classification={},
127
- evalLabel={},
128
- latencyMs=0,
129
- status="FAILURE",
130
- message="EVAL_ERROR",
131
- )
77
+ # eval_input_bias = [
78
+ # {
79
+ # "query": user_message,
80
+ # "context": context,
81
+ # "output": "", # No output yet
82
+ # }
83
+ # ]
84
+ # try:
85
+ # start_time = time.time()
86
+ # bias_evaluation_result = performEvaluation(
87
+ # eval_input_bias,
88
+ # api_key=self.llumo_key,
89
+ # evals=["Input Bias"],
90
+ # playgroundID=playground_id,
91
+ # workspaceID=workspace_id,
92
+ # createExperiment=create_experiment,
93
+ # )
94
+ # latency = int((time.time() - start_time) * 1000)
95
+ # # Access the first result object
96
+ # bias_evaluation = bias_evaluation_result[0]
97
+ # message = "-".join(
98
+ # getattr(bias_evaluation, "edgeCases", {}).get("value", [])
99
+ # )
100
+ # self.session.logEvalStep(
101
+ # stepName=f"EVAL-Input Bias",
102
+ # output="",
103
+ # context=context,
104
+ # query=user_message,
105
+ # messageHistory="",
106
+ # tools="",
107
+ # intermediateSteps="",
108
+ # groundTruth="",
109
+ # analyticsScore=getattr(bias_evaluation, "analyticsScore", {}),
110
+ # reasoning=getattr(bias_evaluation, "reasoning", {}),
111
+ # classification=getattr(bias_evaluation, "classification", {}),
112
+ # evalLabel=getattr(bias_evaluation, "evalLabel", {}),
113
+ # latencyMs=latency,
114
+ # status="SUCCESS",
115
+ # message=message,
116
+ # )
117
+ # except Exception as e:
118
+ # print(f"Input Bias evaluation failed: {e}")
119
+ # self.session.logEvalStep(
120
+ # stepName=f"EVAL-FAILURE",
121
+ # output="",
122
+ # context=context,
123
+ # query=user_message,
124
+ # messageHistory="",
125
+ # tools="",
126
+ # intermediateSteps="",
127
+ # groundTruth="",
128
+ # analyticsScore={},
129
+ # reasoning={},
130
+ # classification={},
131
+ # evalLabel={},
132
+ # latencyMs=0,
133
+ # status="FAILURE",
134
+ # message="EVAL_ERROR",
135
+ # )
132
136
 
133
137
  start_time = time.time()
134
138
  response = original_create(*args, **kwargs)
@@ -151,74 +155,77 @@ class OpenAI(OpenAIClient):
151
155
  )
152
156
 
153
157
  # Response Correctness Evaluation
154
- eval_input_correctness = [
155
- {
156
- "query": user_message,
157
- "context": context,
158
- "output": output_text,
159
- }
160
- ]
161
- try:
162
- start_time = time.time()
163
- correctness_evaluation_result = performEvaluation(
164
- eval_input_correctness,
165
- api_key=self.llumo_key,
166
- evals=["Response Correctness"],
167
- playgroundID=playground_id,
168
- workspaceID=workspace_id,
169
- createExperiment=create_experiment,
170
- )
171
- latency = int((time.time() - start_time) * 1000)
172
- # Access the first result object
173
- correctness_evaluation = correctness_evaluation_result[0]
174
- message = "-".join(
175
- getattr(correctness_evaluation, "edgeCases", {}).get("value", [])
176
- )
177
- self.session.logEvalStep(
178
- stepName=f"EVAL-Response Correctness",
179
- output=output_text,
180
- context=context,
181
- query=user_message,
182
- messageHistory="",
183
- tools="",
184
- intermediateSteps="",
185
- groundTruth="",
186
- analyticsScore=getattr(
187
- correctness_evaluation, "analyticsScore", {}
188
- ),
189
- reasoning=getattr(correctness_evaluation, "reasoning", {}),
190
- classification=getattr(
191
- correctness_evaluation, "classification", {}
192
- ),
193
- evalLabel=getattr(correctness_evaluation, "evalLabel", {}),
194
- latencyMs=latency,
195
- status="SUCCESS",
196
- message=message,
197
- )
198
- except Exception as e:
199
- print(f"Response Correctness evaluation failed: {e}")
200
- correctness_evaluation = None
201
- self.session.logEvalStep(
202
- stepName=f"EVAL-FAILURE",
203
- output=output_text,
204
- context=context,
205
- query=user_message,
206
- messageHistory="",
207
- tools="",
208
- intermediateSteps="",
209
- groundTruth="",
210
- analyticsScore={},
211
- reasoning={},
212
- classification={},
213
- evalLabel={},
214
- latencyMs=0,
215
- status="FAILURE",
216
- message="EVAL_ERROR",
217
- )
218
-
219
- if correctness_evaluation is None:
220
- return response
221
-
222
- return ChatCompletionWithEval(response, correctness_evaluation)
158
+ # eval_input_correctness = [
159
+ # {
160
+ # "query": user_message,
161
+ # "context": context,
162
+ # "output": output_text,
163
+ # }
164
+ # ]
165
+ # try:
166
+ # start_time = time.time()
167
+ # correctness_evaluation_result = performEvaluation(
168
+ # eval_input_correctness,
169
+ # api_key=self.llumo_key,
170
+ # evals=["Response Correctness"],
171
+ # playgroundID=playground_id,
172
+ # workspaceID=workspace_id,
173
+ # createExperiment=create_experiment,
174
+ # )
175
+ # latency = int((time.time() - start_time) * 1000)
176
+ # # Access the first result object
177
+ # correctness_evaluation = correctness_evaluation_result[0]
178
+ # message = "-".join(
179
+ # getattr(correctness_evaluation, "edgeCases", {}).get("value", [])
180
+ # )
181
+ # self.session.logEvalStep(
182
+ # stepName=f"EVAL-Response Correctness",
183
+ # output=output_text,
184
+ # context=context,
185
+ # query=user_message,
186
+ # messageHistory="",
187
+ # tools="",
188
+ # intermediateSteps="",
189
+ # groundTruth="",
190
+ # analyticsScore=getattr(
191
+ # correctness_evaluation, "analyticsScore", {}
192
+ # ),
193
+ # reasoning=getattr(correctness_evaluation, "reasoning", {}),
194
+ # classification=getattr(
195
+ # correctness_evaluation, "classification", {}
196
+ # ),
197
+ # evalLabel=getattr(correctness_evaluation, "evalLabel", {}),
198
+ # latencyMs=latency,
199
+ # status="SUCCESS",
200
+ # message=message,
201
+ # )
202
+ # except Exception as e:
203
+ # print(f"Response Correctness evaluation failed: {e}")
204
+ # correctness_evaluation = None
205
+ # self.session.logEvalStep(
206
+ # stepName=f"EVAL-FAILURE",
207
+ # output=output_text,
208
+ # context=context,
209
+ # query=user_message,
210
+ # messageHistory="",
211
+ # tools="",
212
+ # intermediateSteps="",
213
+ # groundTruth="",
214
+ # analyticsScore={},
215
+ # reasoning={},
216
+ # classification={},
217
+ # evalLabel={},
218
+ # latencyMs=0,
219
+ # status="FAILURE",
220
+ # message="EVAL_ERROR",
221
+ # )
222
+
223
+ # if correctness_evaluation is None:
224
+ # return response
225
+
226
+ return ChatCompletionWithEval(
227
+ response
228
+ # , correctness_evaluation
229
+ )
223
230
 
224
231
  self.chat.completions.create = create_wrapper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llumo
3
- Version: 0.2.27
3
+ Version: 0.2.29
4
4
  Summary: Python SDK for interacting with the Llumo ai API.
5
5
  Home-page: https://www.llumo.ai/
6
6
  Author: Llumo
@@ -6,15 +6,15 @@ llumo/client.py,sha256=keYx0GToNB-FXmGncXd0MOwwCGjxsIoDbOhTx2rCcMQ,71582
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
- llumo/google.py,sha256=3S_aRtbtlctCXPGR0u4baLlkyFrsjd02vlUCkoRPA5U,2147
9
+ llumo/google.py,sha256=6y9YnDFDRHv6-sQNT5LIsV9p31BCN0B9eow5KTRBWfM,2185
10
10
  llumo/helpingFuntions.py,sha256=B6FwUQ5f1v4FKrWCbYoGWMFdscOV_liuuhTgNQ3cdrk,27275
11
11
  llumo/llumoLogger.py,sha256=grdjhu6Ngxg7nhnrMOP5Pd5ALR7U2ROws48yhf_N7y0,1912
12
- llumo/llumoSessionContext.py,sha256=v1OPJFYWe5-mLLUohX5qY7dlzgwmxpuRZ0rDsXEv6f4,10506
12
+ llumo/llumoSessionContext.py,sha256=iJDeC3FG6dID9jdaDK5d6hIlXWuhWx4KQy-Nnty4wYg,10485
13
13
  llumo/models.py,sha256=aVEZsOOoQx5LeNtwSyBxqvrINq0izH3QWu_YjsMPE6o,2910
14
- llumo/openai.py,sha256=c0pZ-yzm6LfUAbfVmOiVpY9pS5sAWZRb8_jAj0ir910,8450
14
+ llumo/openai.py,sha256=PtcQhEEE5q5J7im9hd16FRP7h51VkNhFNX0txS2t7JY,8786
15
15
  llumo/sockets.py,sha256=pBDo-U65hMIMwKMwZQl3iBkEjISEt-9BkXxZTWfSHF4,6116
16
- llumo-0.2.27.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
17
- llumo-0.2.27.dist-info/METADATA,sha256=1zlTWFpTBkmDtAYsP9HbGfN2OQ7Xuy3t9Z7FM73k8W0,1558
18
- llumo-0.2.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- llumo-0.2.27.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
20
- llumo-0.2.27.dist-info/RECORD,,
16
+ llumo-0.2.29.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
17
+ llumo-0.2.29.dist-info/METADATA,sha256=4h3zWbgU4QfCGBGtAlHvKom8hKOJrZwWnq44H8pic0I,1558
18
+ llumo-0.2.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ llumo-0.2.29.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
20
+ llumo-0.2.29.dist-info/RECORD,,
File without changes