judgeval 0.0.16__py3-none-any.whl → 0.0.17__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.
judgeval/common/tracer.py CHANGED
@@ -37,7 +37,7 @@ from http import HTTPStatus
37
37
  import pika
38
38
  import os
39
39
 
40
- from judgeval.constants import JUDGMENT_TRACES_SAVE_API_URL, JUDGMENT_TRACES_FETCH_API_URL, RABBITMQ_HOST, RABBITMQ_PORT, RABBITMQ_QUEUE, JUDGMENT_TRACES_DELETE_API_URL
40
+ from judgeval.constants import JUDGMENT_TRACES_SAVE_API_URL, JUDGMENT_TRACES_FETCH_API_URL, RABBITMQ_HOST, RABBITMQ_PORT, RABBITMQ_QUEUE, JUDGMENT_TRACES_DELETE_API_URL,JUDGMENT_TRACES_ADD_TO_EVAL_QUEUE_API_URL
41
41
  from judgeval.judgment_client import JudgmentClient
42
42
  from judgeval.data import Example
43
43
  from judgeval.scorers import APIJudgmentScorer, JudgevalScorer, ScorerWrapper
@@ -207,7 +207,8 @@ class TraceManagerClient:
207
207
  "Content-Type": "application/json",
208
208
  "Authorization": f"Bearer {self.judgment_api_key}",
209
209
  "X-Organization-Id": self.organization_id
210
- }
210
+ },
211
+ verify=True
211
212
  )
212
213
 
213
214
  if response.status_code != HTTPStatus.OK:
@@ -231,7 +232,8 @@ class TraceManagerClient:
231
232
  "Content-Type": "application/json",
232
233
  "Authorization": f"Bearer {self.judgment_api_key}",
233
234
  "X-Organization-Id": self.organization_id
234
- }
235
+ },
236
+ verify=True
235
237
  )
236
238
 
237
239
  if response.status_code == HTTPStatus.BAD_REQUEST:
@@ -617,25 +619,23 @@ class TraceClient:
617
619
  }
618
620
  # Execute asynchrous evaluation in the background
619
621
  if not empty_save: # Only send to RabbitMQ if the trace is not empty
620
- connection = pika.BlockingConnection(
621
- pika.ConnectionParameters(host=RABBITMQ_HOST, port=RABBITMQ_PORT))
622
- channel = connection.channel()
623
-
624
- channel.queue_declare(queue=RABBITMQ_QUEUE, durable=True)
625
- trace_data["judgment_api_key"] = self.tracer.api_key
626
- trace_data["organization_id"] = self.tracer.organization_id
627
- channel.basic_publish(
628
- exchange='',
629
- routing_key=RABBITMQ_QUEUE,
630
- body=json.dumps(trace_data),
631
- properties=pika.BasicProperties(
632
- delivery_mode=pika.DeliveryMode.Transient, # Changed from Persistent to Transient
622
+ # Send trace data to evaluation queue via API
623
+ try:
624
+ response = requests.post(
625
+ JUDGMENT_TRACES_ADD_TO_EVAL_QUEUE_API_URL,
626
+ json=trace_data,
633
627
  headers={
634
- 'api_key': self.tracer.api_key,
635
- 'organization_id': self.tracer.organization_id
636
- }
637
- ))
638
- connection.close()
628
+ "Content-Type": "application/json",
629
+ "Authorization": f"Bearer {self.tracer.api_key}",
630
+ "X-Organization-Id": self.tracer.organization_id
631
+ },
632
+ verify=True
633
+ )
634
+
635
+ if response.status_code != HTTPStatus.OK:
636
+ warnings.warn(f"Failed to add trace to evaluation queue: {response.text}")
637
+ except Exception as e:
638
+ warnings.warn(f"Error sending trace to evaluation queue: {str(e)}")
639
639
 
640
640
  self.trace_manager_client.save_trace(trace_data, empty_save)
641
641
 
judgeval/constants.py CHANGED
@@ -46,7 +46,7 @@ JUDGMENT_EVAL_DELETE_PROJECT_API_URL = f"{ROOT_API}/delete_eval_results_by_proje
46
46
  JUDGMENT_TRACES_FETCH_API_URL = f"{ROOT_API}/traces/fetch/"
47
47
  JUDGMENT_TRACES_SAVE_API_URL = f"{ROOT_API}/traces/save/"
48
48
  JUDGMENT_TRACES_DELETE_API_URL = f"{ROOT_API}/traces/delete/"
49
-
49
+ JUDGMENT_TRACES_ADD_TO_EVAL_QUEUE_API_URL = f"{ROOT_API}/traces/add_to_eval_queue/"
50
50
  # RabbitMQ
51
51
  RABBITMQ_HOST = os.getenv("RABBITMQ_HOST", "rabbitmq-networklb-faa155df16ec9085.elb.us-west-1.amazonaws.com")
52
52
  RABBITMQ_PORT = os.getenv("RABBITMQ_PORT", 5672)
@@ -68,7 +68,8 @@ class EvalDatasetClient:
68
68
  "Content-Type": "application/json",
69
69
  "Authorization": f"Bearer {self.judgment_api_key}",
70
70
  "X-Organization-Id": self.organization_id
71
- }
71
+ },
72
+ verify=True
72
73
  )
73
74
  if response.status_code == 500:
74
75
  error(f"Server error during push: {content.get('message')}")
@@ -132,7 +133,8 @@ class EvalDatasetClient:
132
133
  "Content-Type": "application/json",
133
134
  "Authorization": f"Bearer {self.judgment_api_key}",
134
135
  "X-Organization-Id": self.organization_id
135
- }
136
+ },
137
+ verify=True
136
138
  )
137
139
  response.raise_for_status()
138
140
  except requests.exceptions.RequestException as e:
@@ -190,7 +192,8 @@ class EvalDatasetClient:
190
192
  "Content-Type": "application/json",
191
193
  "Authorization": f"Bearer {self.judgment_api_key}",
192
194
  "X-Organization-Id": self.organization_id
193
- }
195
+ },
196
+ verify=True
194
197
  )
195
198
  response.raise_for_status()
196
199
  except requests.exceptions.RequestException as e:
@@ -243,7 +246,8 @@ class EvalDatasetClient:
243
246
  "Content-Type": "application/json",
244
247
  "Authorization": f"Bearer {self.judgment_api_key}",
245
248
  "X-Organization-Id": self.organization_id
246
- }
249
+ },
250
+ verify=True
247
251
  )
248
252
  response.raise_for_status()
249
253
  except requests.exceptions.RequestException as e:
@@ -274,7 +278,8 @@ class EvalDatasetClient:
274
278
  "Authorization": f"Bearer {self.judgment_api_key}",
275
279
  "X-Organization-Id": self.organization_id
276
280
  },
277
- stream=True
281
+ stream=True,
282
+ verify=True
278
283
  )
279
284
  response.raise_for_status()
280
285
  except requests.exceptions.HTTPError as err:
@@ -306,7 +306,8 @@ class JudgmentClient:
306
306
  "Authorization": f"Bearer {self.judgment_api_key}",
307
307
  "X-Organization-Id": self.organization_id
308
308
  },
309
- json=eval_run_request_body.model_dump())
309
+ json=eval_run_request_body.model_dump(),
310
+ verify=True)
310
311
  if eval_run.status_code != requests.codes.ok:
311
312
  raise ValueError(f"Error fetching eval results: {eval_run.json()}")
312
313
 
@@ -378,7 +379,8 @@ class JudgmentClient:
378
379
  "Content-Type": "application/json",
379
380
  "Authorization": f"Bearer {self.judgment_api_key}",
380
381
  },
381
- json={} # Empty body now
382
+ json={}, # Empty body now
383
+ verify=True
382
384
  )
383
385
  if response.status_code == 200:
384
386
  return True, response.json()
@@ -409,7 +411,8 @@ class JudgmentClient:
409
411
  "Content-Type": "application/json",
410
412
  "Authorization": f"Bearer {self.judgment_api_key}",
411
413
  "X-Organization-Id": self.organization_id
412
- }
414
+ },
415
+ verify=True
413
416
  )
414
417
 
415
418
  if response.status_code == 500:
@@ -452,7 +455,8 @@ class JudgmentClient:
452
455
  "Content-Type": "application/json",
453
456
  "Authorization": f"Bearer {self.judgment_api_key}",
454
457
  "X-Organization-Id": self.organization_id
455
- }
458
+ },
459
+ verify=True
456
460
  )
457
461
 
458
462
  if response.status_code == 500:
@@ -55,7 +55,8 @@ def execute_api_eval(evaluation_run: EvaluationRun) -> List[Dict]:
55
55
  "Authorization": f"Bearer {evaluation_run.judgment_api_key}",
56
56
  "X-Organization-Id": evaluation_run.organization_id
57
57
  },
58
- json=payload)
58
+ json=payload,
59
+ verify=True)
59
60
  response_data = response.json()
60
61
  except Exception as e:
61
62
  error(f"Error: {e}")
@@ -168,7 +169,8 @@ def check_eval_run_name_exists(eval_name: str, project_name: str, judgment_api_k
168
169
  "eval_name": eval_name,
169
170
  "project_name": project_name,
170
171
  "judgment_api_key": judgment_api_key,
171
- }
172
+ },
173
+ verify=True
172
174
  )
173
175
 
174
176
  if response.status_code == 409:
@@ -210,7 +212,8 @@ def log_evaluation_results(merged_results: List[ScoringResult], evaluation_run:
210
212
  "results": [result.to_dict() for result in merged_results],
211
213
  "project_name": evaluation_run.project_name,
212
214
  "eval_name": evaluation_run.eval_name,
213
- }
215
+ },
216
+ verify=True
214
217
  )
215
218
 
216
219
  if not res.ok:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: judgeval
3
- Version: 0.0.16
3
+ Version: 0.0.17
4
4
  Summary: Judgeval Package
5
5
  Project-URL: Homepage, https://github.com/JudgmentLabs/judgeval
6
6
  Project-URL: Issues, https://github.com/JudgmentLabs/judgeval/issues
@@ -1,14 +1,14 @@
1
1
  judgeval/__init__.py,sha256=xiiG4CkeaOtey4fusCd9CBz0BVqzTIbV-K2EFIU0rUM,283
2
2
  judgeval/clients.py,sha256=Ns5ljrgPPXUMo7fSPJxO12H64lcPyKeQPIVG_RMi2cM,1162
3
- judgeval/constants.py,sha256=9ndMvpjXEUPF3RlZZXyTXGDVWE3roH9MH6CZ9h38lrc,4700
3
+ judgeval/constants.py,sha256=hbKAToxC9RZqIu40ohRdb-DLrRLnXmYwqWiAJT3ebwk,4783
4
4
  judgeval/evaluation_run.py,sha256=qGNafAPLW9tq6KV3eDolIASodLxcSBWQO0mQ0Aq9Cig,6285
5
- judgeval/judgment_client.py,sha256=fg45YySB-WbusPw3JmsQEvMIiqBzKcZiXl5I8ewRft0,23252
5
+ judgeval/judgment_client.py,sha256=E55AZkx5FBiX6yM0ILanqx2m87ppBXcM8nza6iWYEBc,23373
6
6
  judgeval/rules.py,sha256=6RT3DdMvu-LpjqiSDMAd4d2T8S8pOfc_IBEvTgf3GS4,15665
7
- judgeval/run_evaluation.py,sha256=1BRIaDnu622lzgEgbNzD5T4_hbNfMaJZqiicBbEBGQg,21416
7
+ judgeval/run_evaluation.py,sha256=cJzVBD_P-2JkKHIPAwXQupiypbWjfOtH7x8g5eQIo_4,21487
8
8
  judgeval/common/__init__.py,sha256=7d24BRxtncpMj3AAJCj8RS7TqgjXmW777HVZH6-3sBs,289
9
9
  judgeval/common/exceptions.py,sha256=U-TxHLn7oVMezsMuoYouNDb2XuS8RCggfntYf5_6u4E,565
10
10
  judgeval/common/logger.py,sha256=QXN3UMymmKu2iMEMEgATLBnMDjGr_pE2iOSEFoICgg8,6092
11
- judgeval/common/tracer.py,sha256=pggEJTAH690jg7LPTfVBdGG3IMjkqpbsUBIoSnGtWes,36477
11
+ judgeval/common/tracer.py,sha256=Q2jbowOFPjOmlonofahDrYzkm8O_XZ5LtOVRWHNA3bA,36455
12
12
  judgeval/common/utils.py,sha256=T1lpObopcH868NIgOTzNViTB33OGadcVWxWcfh2pm3E,33439
13
13
  judgeval/data/__init__.py,sha256=YferxwmUqoBi18hrdgro0BD0h4pt20LAqISeUzGMcVU,474
14
14
  judgeval/data/api_example.py,sha256=vwWFbI6eJr5VgURCRbuSiMtEXLUbTCih_BcaqEBy-pg,4108
@@ -17,7 +17,7 @@ judgeval/data/result.py,sha256=8FIO-bFKPegZuByKRjA2_sumjb8oGWQ5ZeQ1RVz5z2w,4393
17
17
  judgeval/data/scorer_data.py,sha256=pYljblCPZrlMIv5Eg7R-clnmsqzUBAwokKjZpwa0DXE,3280
18
18
  judgeval/data/datasets/__init__.py,sha256=eO6ayeM_bTGwIt0eDSlTBIIBvXvIWRWWSfYZrZROPiQ,265
19
19
  judgeval/data/datasets/dataset.py,sha256=FRl2efBQZEpyK_ZTM7FMQQ7wjmtvcHCMFBq8L7O2Wus,12080
20
- judgeval/data/datasets/eval_dataset_client.py,sha256=UDzWOYlJqMDEYLyp9IyNBXWrXG2TyZ2L2JJnzly2mgc,11353
20
+ judgeval/data/datasets/eval_dataset_client.py,sha256=iaUwlzed3JrWV0P4vu8s2hd5q0BKzF_vAbCv36gx6us,11526
21
21
  judgeval/data/datasets/ground_truth.py,sha256=OTBs3VZe-Wp0vEXEsq14GPZHYtpWT16bhGQTycIvkKc,2057
22
22
  judgeval/data/datasets/utils.py,sha256=lQxyl7mevct7JcDSyIrU_8QOzT-EYPWEvoUiAeOdeek,2502
23
23
  judgeval/judges/__init__.py,sha256=tyQ5KY88Kp1Ctfw2IJxnVEpy8DnFCtmy04JdPOpp-As,339
@@ -80,7 +80,7 @@ judgeval/scorers/judgeval_scorers/local_implementations/tool_correctness/__init_
80
80
  judgeval/scorers/judgeval_scorers/local_implementations/tool_correctness/tool_correctness_scorer.py,sha256=CYGRJY5EuyICYzHrmFdLykwXakX8AC7G3Bhj7p6szfY,5493
81
81
  judgeval/tracer/__init__.py,sha256=wy3DYpH8U_z0GO_K_gOSkK0tTTD-u5eLDo0T5xIBoAc,147
82
82
  judgeval/utils/alerts.py,sha256=RgW5R9Dn3Jtim0OyAYDbNzjoX2s6SA4Mw16GyyaikjI,1424
83
- judgeval-0.0.16.dist-info/METADATA,sha256=EQHgzBDEctzLCN0SpLC1m53Z8xVlKZvE0sVMPYkK7yc,1283
84
- judgeval-0.0.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
85
- judgeval-0.0.16.dist-info/licenses/LICENSE.md,sha256=tKmCg7k5QOmxPK19XMfzim04QiQJPmgIm0pAn55IJwk,11352
86
- judgeval-0.0.16.dist-info/RECORD,,
83
+ judgeval-0.0.17.dist-info/METADATA,sha256=5T7WfHQNVQmdsmOaDcS6pNKSk4O7DMvxfQPaoYf_4X0,1283
84
+ judgeval-0.0.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
85
+ judgeval-0.0.17.dist-info/licenses/LICENSE.md,sha256=tKmCg7k5QOmxPK19XMfzim04QiQJPmgIm0pAn55IJwk,11352
86
+ judgeval-0.0.17.dist-info/RECORD,,