@@ -40,36 +40,6 @@ Object completion(
4040 return response .getContent ();
4141 }
4242
43- @ GetMapping ("/image" )
44- @ Nonnull
45- ResponseEntity <String > imageInput (
46- @ RequestHeader (value = "accept" , required = false ) final String accept )
47- throws JsonProcessingException {
48- final var response =
49- service .imageInput (
50- "https://upload.wikimedia.org/wikipedia/commons/thumb/5/59/SAP_2011_logo.svg/440px-SAP_2011_logo.svg.png" );
51- if ("application/json" .equals (accept )) {
52- return ResponseEntity .ok ().body (MAPPER .writeValueAsString (response ));
53- }
54- return ResponseEntity .ok (response .getContent ());
55- }
56-
57- @ GetMapping ("/multiString" )
58- @ Nonnull
59- ResponseEntity <String > multiStringInput (
60- @ RequestHeader (value = "accept" , required = false ) final String accept )
61- throws JsonProcessingException {
62- final var response =
63- service .multiStringInput (
64- List .of ("What is the capital of France?" , "What is Chess about?" , "What is 2+2?" ));
65- if ("application/json" .equals (accept )) {
66- return ResponseEntity .ok ()
67- .contentType (MediaType .APPLICATION_JSON )
68- .body (MAPPER .writeValueAsString (response ));
69- }
70- return ResponseEntity .ok (response .getContent ());
71- }
72-
7343 @ GetMapping ("/streamChatCompletion" )
7444 ResponseEntity <ResponseBodyEmitter > streamChatCompletion () {
7545 final var stream = service .streamChatCompletion ("developing a software project" );
@@ -220,4 +190,30 @@ Object grounding(
220190 }
221191 return response .getContent ();
222192 }
193+
194+ @ GetMapping ("/image" )
195+ @ Nonnull
196+ Object imageInput (
197+ @ RequestParam (value = "format" , required = false ) final String format ) {
198+ final var response =
199+ service .imageInput (
200+ "https://upload.wikimedia.org/wikipedia/commons/thumb/5/59/SAP_2011_logo.svg/440px-SAP_2011_logo.svg.png" );
201+ if ("json" .equals (format )) {
202+ return response ;
203+ }
204+ return response .getContent ();
205+ }
206+
207+ @ GetMapping ("/multiString" )
208+ @ Nonnull
209+ Object multiStringInput (
210+ @ RequestParam (value = "format" , required = false ) final String format ) {
211+ final var response =
212+ service .multiStringInput (
213+ List .of ("What is the capital of France?" , "What is Chess about?" , "What is 2+2?" ));
214+ if ("json" .equals (format )) {
215+ return response ;
216+ }
217+ return response .getContent ();
218+ }
223219}
0 commit comments