File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 22
33import com .google .common .annotations .Beta ;
44import com .sap .ai .sdk .orchestration .OrchestrationChatResponse ;
5+ import com .sap .ai .sdk .orchestration .OrchestrationClientException ;
56import com .sap .ai .sdk .orchestration .model .LLMChoice ;
67import com .sap .ai .sdk .orchestration .model .LLMModuleResultSynchronous ;
78import com .sap .ai .sdk .orchestration .model .TokenUsage ;
@@ -48,7 +49,12 @@ static List<Generation> toGenerations(@Nonnull final LLMModuleResultSynchronous
4849 }
4950
5051 @ Nonnull
51- static Generation toGeneration (@ Nonnull final LLMChoice choice ) {
52+ static Generation toGeneration (@ Nonnull final LLMChoice choice )
53+ throws OrchestrationClientException {
54+ if ("content_filter" .equals (choice .getFinishReason ())) {
55+ throw new OrchestrationClientException ("Content filter filtered the output." );
56+ }
57+
5258 val metadata = ChatGenerationMetadata .builder ().finishReason (choice .getFinishReason ());
5359 metadata .metadata ("index" , choice .getIndex ());
5460 if (!choice .getLogprobs ().isEmpty ()) {
You can’t perform that action at this time.
0 commit comments