11package com .sap .ai .sdk .app .services ;
22
3+ import com .sap .ai .sdk .foundationmodels .openai .OpenAiChatCompletionConfig ;
34import com .sap .ai .sdk .foundationmodels .openai .OpenAiClient ;
45import com .sap .ai .sdk .foundationmodels .openai .OpenAiModel ;
56import com .sap .ai .sdk .foundationmodels .openai .spring .OpenAiChatModel ;
@@ -53,7 +54,7 @@ public EmbeddingResponse embedStrings() {
5354 */
5455 @ Nonnull
5556 public ChatResponse completion () {
56- val options = new OpenAiChatOptions ();
57+ val options = new OpenAiChatOptions (new OpenAiChatCompletionConfig () );
5758 val prompt = new Prompt ("What is the capital of France?" , options );
5859 return chatClient .call (prompt );
5960 }
@@ -65,7 +66,7 @@ public ChatResponse completion() {
6566 */
6667 @ Nonnull
6768 public ChatResponse streamChatCompletion () {
68- val options = new OpenAiChatOptions ();
69+ val options = new OpenAiChatOptions (new OpenAiChatCompletionConfig () );
6970 val prompt =
7071 new Prompt ("Can you give me the first 100 numbers of the Fibonacci sequence?" , options );
7172 return chatClient .call (prompt );
@@ -81,7 +82,7 @@ public ChatResponse streamChatCompletion() {
8182 */
8283 @ Nonnull
8384 public ChatResponse toolCalling (final boolean internalToolExecutionEnabled ) {
84- val options = new OpenAiChatOptions ();
85+ val options = new OpenAiChatOptions (new OpenAiChatCompletionConfig () );
8586 options .setToolCallbacks (List .of (ToolCallbacks .from (new WeatherMethod ())));
8687 options .setInternalToolExecutionEnabled (internalToolExecutionEnabled );
8788
@@ -100,8 +101,14 @@ public ChatResponse ChatMemory() {
100101 val memory = MessageWindowChatMemory .builder ().chatMemoryRepository (repository ).build ();
101102 val advisor = MessageChatMemoryAdvisor .builder (memory ).build ();
102103 val cl = ChatClient .builder (chatClient ).defaultAdvisors (advisor ).build ();
103- val prompt1 = new Prompt ("What is the capital of France?" , new OpenAiChatOptions ());
104- val prompt2 = new Prompt ("And what is the typical food there?" , new OpenAiChatOptions ());
104+ val prompt1 =
105+ new Prompt (
106+ "What is the capital of France?" ,
107+ new OpenAiChatOptions (new OpenAiChatCompletionConfig ()));
108+ val prompt2 =
109+ new Prompt (
110+ "And what is the typical food there?" ,
111+ new OpenAiChatOptions (new OpenAiChatCompletionConfig ()));
105112
106113 cl .prompt (prompt1 ).call ().content ();
107114 return Objects .requireNonNull (
0 commit comments