File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed
orchestration/src/main/java/com/sap/ai/sdk/orchestration Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -50,11 +50,7 @@ public enum DetailLevel {
5050 */
5151 @ Nonnull
5252 static DetailLevel fromString (@ Nonnull final String str ) {
53- try {
54- return DetailLevel .valueOf (str .toLowerCase (Locale .ENGLISH ));
55- } catch (IllegalArgumentException e ) {
56- return DetailLevel .auto ;
57- }
53+ return DetailLevel .valueOf (str .toLowerCase (Locale .ENGLISH ));
5854 }
5955 }
6056}
Original file line number Diff line number Diff line change 55import com .sap .ai .sdk .orchestration .model .TextContent ;
66import java .util .Arrays ;
77import java .util .List ;
8+ import java .util .function .Function ;
89import java .util .stream .Stream ;
910import javax .annotation .Nonnull ;
1011import javax .annotation .Nullable ;
@@ -79,13 +80,10 @@ private static List<ContentItem> convertIntoMultiMessageList(
7980 content -> {
8081 if (content instanceof TextContent text ) {
8182 return new TextItem (text .getText ());
82- } else if ( content instanceof ImageContent image ) {
83- val imageUrl = image .getImageUrl ();
83+ } else {
84+ final var imageUrl = (( ImageContent ) content ) .getImageUrl ();
8485 return new ImageItem (
8586 imageUrl .getUrl (), ImageItem .DetailLevel .fromString (imageUrl .getDetail ()));
86- } else {
87- throw new IllegalArgumentException (
88- "Unknown subtype of MultiChatMessageContent: " + content .getClass ());
8987 }
9088 };
9189 return Arrays .stream (multiChatContents ).map (convertMultiChatContent ).toList ();
You can’t perform that action at this time.
0 commit comments