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 +16 -16
- llumo/llumoSessionContext.py +3 -3
- llumo/openai.py +137 -130
- {llumo-0.2.27.dist-info → llumo-0.2.29.dist-info}/METADATA +1 -1
- {llumo-0.2.27.dist-info → llumo-0.2.29.dist-info}/RECORD +8 -8
- {llumo-0.2.27.dist-info → llumo-0.2.29.dist-info}/WHEEL +0 -0
- {llumo-0.2.27.dist-info → llumo-0.2.29.dist-info}/licenses/LICENSE +0 -0
- {llumo-0.2.27.dist-info → llumo-0.2.29.dist-info}/top_level.txt +0 -0
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}]
|
|
49
|
+
# eval_input = [{
|
|
50
|
+
# "query": contents,
|
|
51
|
+
# "context": context or contents,
|
|
52
|
+
# "output": output,
|
|
53
|
+
# }]
|
|
54
54
|
|
|
55
|
-
evaluation = None
|
|
56
|
-
try:
|
|
57
|
-
|
|
58
|
-
except Exception as e:
|
|
59
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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)
|
llumo/llumoSessionContext.py
CHANGED
|
@@ -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
|
-
|
|
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__(
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
]
|
|
80
|
-
try:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
except Exception as e:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
]
|
|
161
|
-
try:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
except Exception as e:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if correctness_evaluation is None:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return ChatCompletionWithEval(
|
|
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
|
|
@@ -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=
|
|
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=
|
|
12
|
+
llumo/llumoSessionContext.py,sha256=iJDeC3FG6dID9jdaDK5d6hIlXWuhWx4KQy-Nnty4wYg,10485
|
|
13
13
|
llumo/models.py,sha256=aVEZsOOoQx5LeNtwSyBxqvrINq0izH3QWu_YjsMPE6o,2910
|
|
14
|
-
llumo/openai.py,sha256=
|
|
14
|
+
llumo/openai.py,sha256=PtcQhEEE5q5J7im9hd16FRP7h51VkNhFNX0txS2t7JY,8786
|
|
15
15
|
llumo/sockets.py,sha256=pBDo-U65hMIMwKMwZQl3iBkEjISEt-9BkXxZTWfSHF4,6116
|
|
16
|
-
llumo-0.2.
|
|
17
|
-
llumo-0.2.
|
|
18
|
-
llumo-0.2.
|
|
19
|
-
llumo-0.2.
|
|
20
|
-
llumo-0.2.
|
|
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
|
|
File without changes
|
|
File without changes
|