File tree Expand file tree Collapse file tree 1 file changed +1
-11
lines changed
sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers Expand file tree Collapse file tree 1 file changed +1
-11
lines changed Original file line number Diff line number Diff line change 1010import com .sap .ai .sdk .orchestration .Message ;
1111import com .sap .ai .sdk .orchestration .OrchestrationChatResponse ;
1212import com .sap .ai .sdk .orchestration .OrchestrationClient ;
13- import com .sap .ai .sdk .orchestration .OrchestrationClientException ;
1413import com .sap .ai .sdk .orchestration .OrchestrationModuleConfig ;
1514import com .sap .ai .sdk .orchestration .OrchestrationPrompt ;
1615import com .sap .ai .sdk .orchestration .SystemMessage ;
@@ -113,16 +112,7 @@ public OrchestrationChatResponse filter(
113112 final var configWithFilter =
114113 config .withInputFiltering (filterConfig ).withOutputFiltering (filterConfig );
115114
116- final OrchestrationChatResponse result = client .chatCompletion (prompt , configWithFilter );
117- try {
118- // in case the output was filtered, calling .getContent() will throw
119- log .info ("The following AI response passed the output filter: {}" , result .getContent ());
120- } catch (OrchestrationClientException e ) {
121- log .info ("The content filter blocked the output." );
122- // alternatively to calling .getContent(), you can also check the finish reason manually
123- log .info ("Finish reason: {}" , result .getCurrentChoice ().getFinishReason ());
124- }
125- return result ;
115+ return client .chatCompletion (prompt , configWithFilter );
126116 }
127117
128118 /**
You can’t perform that action at this time.
0 commit comments