2525import com .sap .ai .sdk .orchestration .model .DocumentGroundingFilter ;
2626import com .sap .ai .sdk .orchestration .model .GroundingFilterSearchConfiguration ;
2727import com .sap .ai .sdk .orchestration .model .LlamaGuard38b ;
28- import com .sap .ai .sdk .orchestration .model .ResponseFormatJsonObject ;
2928import com .sap .ai .sdk .orchestration .model .ResponseFormatText ;
3029import com .sap .ai .sdk .orchestration .model .SearchDocumentKeyValueListPair ;
3130import com .sap .ai .sdk .orchestration .model .SearchSelectOptionEnum ;
@@ -112,7 +111,8 @@ public Stream<String> streamChatCompletion(@Nonnull final String topic) {
112111 @ Nonnull
113112 public OrchestrationChatResponse template (@ Nonnull final String language ) {
114113 val template = Message .user ("Reply with 'Orchestration Service is working!' in {{?language}}" );
115- val templatingConfig = Template .create ().template (List .of (template .createChatMessage ()));
114+ val templatingConfig =
115+ TemplateConfig .create ().withTemplate (List .of (template .createChatMessage ()));
116116 val configWithTemplate = config .withTemplateConfig (templatingConfig );
117117
118118 val inputParams = Map .of ("language" , language );
@@ -351,8 +351,6 @@ public OrchestrationChatResponse grounding(@Nonnull final String userMessage) {
351351 */
352352 @ Nonnull
353353 public OrchestrationChatResponse responseFormatJsonSchema (@ Nonnull final String word ) {
354- val config = new OrchestrationModuleConfig ().withLlmConfig (GPT_4O_MINI );
355-
356354 // Example class
357355 class Translation {
358356 @ JsonProperty (required = true )
@@ -388,17 +386,12 @@ class Translation {
388386 */
389387 @ Nonnull
390388 public OrchestrationChatResponse responseFormatJsonObject (@ Nonnull final String word ) {
391- final var llmWithImageSupportConfig =
392- new OrchestrationModuleConfig ().withLlmConfig (GPT_4O_MINI );
393-
394389 val template = Message .user ("What is '%s' in German?" .formatted (word ));
395390 val templatingConfig =
396- Template .create ()
397- .template (List .of (template .createChatMessage ()))
398- .responseFormat (
399- ResponseFormatJsonObject .create ()
400- .type (ResponseFormatJsonObject .TypeEnum .JSON_OBJECT ));
401- val configWithTemplate = llmWithImageSupportConfig .withTemplateConfig (templatingConfig );
391+ TemplateConfig .create ()
392+ .withTemplate (List .of (template .createChatMessage ()))
393+ .withJsonResponse ();
394+ val configWithTemplate = config .withTemplateConfig (templatingConfig );
402395
403396 val prompt =
404397 new OrchestrationPrompt (
@@ -419,15 +412,12 @@ public OrchestrationChatResponse responseFormatJsonObject(@Nonnull final String
419412 */
420413 @ Nonnull
421414 public OrchestrationChatResponse responseFormatText (@ Nonnull final String word ) {
422- final var llmWithImageSupportConfig =
423- new OrchestrationModuleConfig ().withLlmConfig (GPT_4O_MINI );
424-
425415 val template = Message .user ("Whats '%s' in German?" .formatted (word ));
426416 val templatingConfig =
427417 Template .create ()
428418 .template (List .of (template .createChatMessage ()))
429419 .responseFormat (ResponseFormatText .create ().type (ResponseFormatText .TypeEnum .TEXT ));
430- val configWithTemplate = llmWithImageSupportConfig .withTemplateConfig (templatingConfig );
420+ val configWithTemplate = config .withTemplateConfig (templatingConfig );
431421
432422 val prompt =
433423 new OrchestrationPrompt (
0 commit comments