@@ -126,7 +126,7 @@ public void testFromMap() {
126126                    QueryParameters .QUERY_PARAMETERS ,
127127                    queryParameters ,
128128                    CustomServiceSettings .REQUEST ,
129-                     new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
129+                     requestContentString ,
130130                    CustomServiceSettings .RESPONSE ,
131131                    new  HashMap <>(
132132                        Map .of (
@@ -179,7 +179,7 @@ public void testFromMap_WithOptionalsNotSpecified() {
179179                    CustomServiceSettings .URL ,
180180                    url ,
181181                    CustomServiceSettings .REQUEST ,
182-                     new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
182+                     requestContentString ,
183183                    CustomServiceSettings .RESPONSE ,
184184                    new  HashMap <>(
185185                        Map .of (
@@ -243,7 +243,7 @@ public void testFromMap_RemovesNullValues_FromMaps() {
243243                    CustomServiceSettings .HEADERS ,
244244                    headersWithNulls ,
245245                    CustomServiceSettings .REQUEST ,
246-                     new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
246+                     requestContentString ,
247247                    CustomServiceSettings .RESPONSE ,
248248                    new  HashMap <>(
249249                        Map .of (
@@ -304,7 +304,7 @@ public void testFromMap_ReturnsError_IfHeadersContainsNonStringValues() {
304304                CustomServiceSettings .HEADERS ,
305305                new  HashMap <>(Map .of ("key" , 1 )),
306306                CustomServiceSettings .REQUEST ,
307-                 new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
307+                 requestContentString ,
308308                CustomServiceSettings .RESPONSE ,
309309                new  HashMap <>(
310310                    Map .of (
@@ -353,7 +353,7 @@ public void testFromMap_ReturnsError_IfQueryParamsContainsNonStringValues() {
353353                QueryParameters .QUERY_PARAMETERS ,
354354                List .of (List .of ("key" , 1 )),
355355                CustomServiceSettings .REQUEST ,
356-                 new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
356+                 requestContentString ,
357357                CustomServiceSettings .RESPONSE ,
358358                new  HashMap <>(
359359                    Map .of (
@@ -393,7 +393,7 @@ public void testFromMap_ReturnsError_IfRequestMapIsMissing() {
393393                CustomServiceSettings .HEADERS ,
394394                new  HashMap <>(Map .of ("key" , "value" )),
395395                "invalid_request" ,
396-                 new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
396+                 requestContentString ,
397397                CustomServiceSettings .RESPONSE ,
398398                new  HashMap <>(
399399                    Map .of (
@@ -413,13 +413,7 @@ public void testFromMap_ReturnsError_IfRequestMapIsMissing() {
413413            () -> CustomServiceSettings .fromMap (mapSettings , ConfigurationParseContext .REQUEST , TaskType .TEXT_EMBEDDING , "inference_id" )
414414        );
415415
416-         assertThat (
417-             exception .getMessage (),
418-             is (
419-                 "Validation Failed: 1: [service_settings] does not contain the required setting [request];" 
420-                     + "2: [service_settings] does not contain the required setting [content];" 
421-             )
422-         );
416+         assertThat (exception .getMessage (), is ("Validation Failed: 1: [service_settings] does not contain the required setting [request];" ));
423417    }
424418
425419    public  void  testFromMap_ReturnsError_IfResponseMapIsMissing () {
@@ -433,7 +427,7 @@ public void testFromMap_ReturnsError_IfResponseMapIsMissing() {
433427                CustomServiceSettings .HEADERS ,
434428                new  HashMap <>(Map .of ("key" , "value" )),
435429                CustomServiceSettings .REQUEST ,
436-                 new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
430+                 requestContentString ,
437431                "invalid_response" ,
438432                new  HashMap <>(
439433                    Map .of (
@@ -464,46 +458,6 @@ public void testFromMap_ReturnsError_IfResponseMapIsMissing() {
464458        );
465459    }
466460
467-     public  void  testFromMap_ReturnsError_IfRequestMapIsNotEmptyAfterParsing () {
468-         String  url  = "http://www.abc.com" ;
469-         String  requestContentString  = "request body" ;
470- 
471-         var  mapSettings  = new  HashMap <String , Object >(
472-             Map .of (
473-                 CustomServiceSettings .URL ,
474-                 url ,
475-                 CustomServiceSettings .HEADERS ,
476-                 new  HashMap <>(Map .of ("key" , "value" )),
477-                 CustomServiceSettings .REQUEST ,
478-                 new  HashMap <>(Map .of (CustomServiceSettings .REQUEST_CONTENT , requestContentString , "key" , "value" )),
479-                 CustomServiceSettings .RESPONSE ,
480-                 new  HashMap <>(
481-                     Map .of (
482-                         CustomServiceSettings .JSON_PARSER ,
483-                         new  HashMap <>(
484-                             Map .of (TextEmbeddingResponseParser .TEXT_EMBEDDING_PARSER_EMBEDDINGS , "$.result.embeddings[*].embedding" )
485-                         ),
486-                         CustomServiceSettings .ERROR_PARSER ,
487-                         new  HashMap <>(Map .of (ErrorResponseParser .MESSAGE_PATH , "$.error.message" ))
488-                     )
489-                 )
490-             )
491-         );
492- 
493-         var  exception  = expectThrows (
494-             ElasticsearchStatusException .class ,
495-             () -> CustomServiceSettings .fromMap (mapSettings , ConfigurationParseContext .REQUEST , TaskType .TEXT_EMBEDDING , "inference_id" )
496-         );
497- 
498-         assertThat (
499-             exception .getMessage (),
500-             is (
501-                 "Configuration contains unknown settings [{key=value}] while parsing field [request]" 
502-                     + " for settings [custom_service_settings]" 
503-             )
504-         );
505-     }
506- 
507461    public  void  testFromMap_ReturnsError_IfJsonParserMapIsNotEmptyAfterParsing () {
508462        String  url  = "http://www.abc.com" ;
509463        String  requestContentString  = "request body" ;
@@ -515,7 +469,7 @@ public void testFromMap_ReturnsError_IfJsonParserMapIsNotEmptyAfterParsing() {
515469                CustomServiceSettings .HEADERS ,
516470                new  HashMap <>(Map .of ("key" , "value" )),
517471                CustomServiceSettings .REQUEST ,
518-                 new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
472+                 requestContentString ,
519473                CustomServiceSettings .RESPONSE ,
520474                new  HashMap <>(
521475                    Map .of (
@@ -560,7 +514,7 @@ public void testFromMap_ReturnsError_IfResponseMapIsNotEmptyAfterParsing() {
560514                CustomServiceSettings .HEADERS ,
561515                new  HashMap <>(Map .of ("key" , "value" )),
562516                CustomServiceSettings .REQUEST ,
563-                 new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
517+                 requestContentString ,
564518                CustomServiceSettings .RESPONSE ,
565519                new  HashMap <>(
566520                    Map .of (
@@ -602,7 +556,7 @@ public void testFromMap_ReturnsError_IfErrorParserMapIsNotEmptyAfterParsing() {
602556                CustomServiceSettings .HEADERS ,
603557                new  HashMap <>(Map .of ("key" , "value" )),
604558                CustomServiceSettings .REQUEST ,
605-                 new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
559+                 requestContentString ,
606560                CustomServiceSettings .RESPONSE ,
607561                new  HashMap <>(
608562                    Map .of (
@@ -642,7 +596,7 @@ public void testFromMap_ReturnsError_IfTaskTypeIsInvalid() {
642596                CustomServiceSettings .HEADERS ,
643597                new  HashMap <>(Map .of ("key" , "value" )),
644598                CustomServiceSettings .REQUEST ,
645-                 new   HashMap <>( Map . of ( CustomServiceSettings . REQUEST_CONTENT ,  requestContentString )) ,
599+                 requestContentString ,
646600                CustomServiceSettings .RESPONSE ,
647601                new  HashMap <>(
648602                    Map .of (
@@ -687,9 +641,7 @@ public void testXContent() throws IOException {
687641                "headers": { 
688642                    "key": "value" 
689643                }, 
690-                 "request": { 
691-                     "content": "string" 
692-                 }, 
644+                 "request": "string", 
693645                "response": { 
694646                    "json_parser": { 
695647                        "text_embeddings": "$.result.embeddings[*].embedding" 
0 commit comments