File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,9 @@ def predict_jailbreak(
241
241
prompts : List [str ],
242
242
reduction_function : Optional [Callable ] = max ,
243
243
) -> Union [List [float ], List [dict ]]:
244
+ """predict_jailbreak will return an array of floats by default, one per prompt.
245
+ If reduction_function is set to 'none' it will return a dict with the different
246
+ sub-validators and their scores. Useful for debugging and tuning."""
244
247
if isinstance (prompts , str ):
245
248
print ("WARN: predict_jailbreak should be called with a list of strings." )
246
249
prompts = [prompts , ]
@@ -308,16 +311,7 @@ def _inference_local(self, model_input: List[str]) -> Any:
308
311
309
312
def _inference_remote (self , model_input : List [str ]) -> Any :
310
313
# This needs to be kept in-sync with app_inference_spec.
311
- request_body = {
312
- "inputs" : [ # Required for legacy reasons.
313
- {
314
- "name" : "prompts" ,
315
- "shape" : [len (model_input )],
316
- "data" : model_input ,
317
- "datatype" : "BYTES"
318
- }
319
- ]
320
- }
314
+ request_body = {"prompts" : model_input }
321
315
response = self ._hub_inference_request (
322
316
json .dumps (request_body ),
323
317
self .validation_endpoint
You can’t perform that action at this time.
0 commit comments