@@ -131,13 +131,13 @@ Object inputFiltering(
131131 } catch (OrchestrationInputFilterException e ) {
132132 final var msg =
133133 new StringBuilder (
134- "Failed to obtain a response as the content was flagged by input filter. Error %d "
134+ "[Http %d] Failed to obtain a response as the content was flagged by input filter. "
135135 .formatted (e .getStatusCode ()));
136136
137137 Optional .ofNullable (e .getAzureContentSafetyInput ())
138- .map (AzureContentSafetyInput ::getHate )
138+ .map (AzureContentSafetyInput ::getViolence )
139139 .filter (rating -> rating .compareTo (policy .getAzureThreshold ()) > 0 )
140- .ifPresent (rating -> msg .append ("Hate score %d" .formatted (rating .getValue ())));
140+ .ifPresent (rating -> msg .append ("Violence score %d" .formatted (rating .getValue ())));
141141
142142 log .debug (msg .toString (), e );
143143 return ResponseEntity .internalServerError ().body (msg .toString ());
@@ -163,12 +163,12 @@ Object outputFiltering(
163163 } catch (OrchestrationOutputFilterException e ) {
164164 final var msg =
165165 new StringBuilder (
166- "Failed to obtain a response as the content was flagged by output filter." );
166+ "Failed to obtain a response as the content was flagged by output filter. " );
167167
168168 Optional .ofNullable (e .getAzureContentSafetyOutput ())
169- .map (AzureContentSafetyOutput ::getHate )
169+ .map (AzureContentSafetyOutput ::getViolence )
170170 .filter (rating -> rating .compareTo (policy .getAzureThreshold ()) > 0 )
171- .ifPresent (rating -> msg .append ("Hate score %d " .formatted (rating .getValue ())));
171+ .ifPresent (rating -> msg .append ("Violence score %d " .formatted (rating .getValue ())));
172172
173173 log .debug (msg .toString (), e );
174174 return ResponseEntity .internalServerError ().body (msg .toString ());
@@ -190,9 +190,12 @@ Object llamaGuardInputFiltering(
190190 try {
191191 response = service .llamaGuardInputFilter (enabled );
192192 } catch (OrchestrationInputFilterException e ) {
193- final var msg =
194- "Failed to obtain a response as the content was flagged by input filter. Error %d "
193+ var msg =
194+ "[Http %d] Failed to obtain a response as the content was flagged by input filter. "
195195 .formatted (e .getStatusCode ());
196+ if (e .getLlamaGuard38b () != null ){
197+ msg += " Violent crimes are %s" .formatted (e .getLlamaGuard38b ().isViolentCrimes ());
198+ }
196199 log .debug (msg , e );
197200 return ResponseEntity .internalServerError ().body (msg );
198201 }
0 commit comments