@@ -34,7 +34,7 @@ public class KernelArguments implements Map<String, ContextVariable<?>> {
3434 public static final String MAIN_KEY = "input" ;
3535
3636 protected final CaseInsensitiveMap <ContextVariable <?>> variables ;
37- protected final Map <String , PromptExecutionSettings > promptExecutionSettings ;
37+ protected final Map <String , PromptExecutionSettings > executionSettings ;
3838
3939 /**
4040 * Create a new instance of KernelArguments.
@@ -43,17 +43,17 @@ public class KernelArguments implements Map<String, ContextVariable<?>> {
4343 */
4444 protected KernelArguments (
4545 @ Nullable Map <String , ContextVariable <?>> variables ,
46- @ Nullable Map <String , PromptExecutionSettings > promptExecutionSettings ) {
46+ @ Nullable Map <String , PromptExecutionSettings > executionSettings ) {
4747 if (variables == null ) {
4848 this .variables = new CaseInsensitiveMap <>();
4949 } else {
5050 this .variables = new CaseInsensitiveMap <>(variables );
5151 }
5252
53- if (promptExecutionSettings == null ) {
54- this .promptExecutionSettings = new HashMap <>();
53+ if (executionSettings == null ) {
54+ this .executionSettings = new HashMap <>();
5555 } else {
56- this .promptExecutionSettings = new HashMap <>(promptExecutionSettings );
56+ this .executionSettings = new HashMap <>(executionSettings );
5757 }
5858 }
5959
@@ -63,18 +63,16 @@ protected KernelArguments(
6363 * @param content The content to use for the function invocation.
6464 */
6565 protected KernelArguments (@ NonNull ContextVariable <?> content ) {
66- this . variables = new CaseInsensitiveMap <> ();
66+ this ();
6767 this .variables .put (MAIN_KEY , content );
68-
69- this .promptExecutionSettings = new HashMap <>();
7068 }
7169
7270 /**
7371 * Create a new instance of KernelArguments.
7472 */
7573 protected KernelArguments () {
7674 this .variables = new CaseInsensitiveMap <>();
77- this .promptExecutionSettings = new HashMap <>();
75+ this .executionSettings = new HashMap <>();
7876 }
7977
8078 /**
@@ -84,7 +82,7 @@ protected KernelArguments() {
8482 */
8583 protected KernelArguments (@ NonNull KernelArguments arguments ) {
8684 this .variables = new CaseInsensitiveMap <>(arguments .variables );
87- this .promptExecutionSettings = new HashMap <>(arguments .promptExecutionSettings );
85+ this .executionSettings = new HashMap <>(arguments .executionSettings );
8886 }
8987
9088 /**
@@ -93,8 +91,8 @@ protected KernelArguments(@NonNull KernelArguments arguments) {
9391 * @return prompt execution settings
9492 */
9593 @ Nonnull
96- public Map <String , PromptExecutionSettings > getPromptExecutionSettings () {
97- return Collections .unmodifiableMap (promptExecutionSettings );
94+ public Map <String , PromptExecutionSettings > getExecutionSettings () {
95+ return Collections .unmodifiableMap (executionSettings );
9896 }
9997
10098 /**
@@ -233,7 +231,7 @@ public Set<Entry<String, ContextVariable<?>>> entrySet() {
233231 * @return copy of the current instance
234232 */
235233 public KernelArguments copy () {
236- return new KernelArguments (variables , promptExecutionSettings );
234+ return new KernelArguments (variables , executionSettings );
237235 }
238236
239237 /**
@@ -253,13 +251,13 @@ public static class Builder<U extends KernelArguments> implements SemanticKernel
253251
254252 private final Function <KernelArguments , U > constructor ;
255253 private final Map <String , ContextVariable <?>> variables ;
256- private final Map <String , PromptExecutionSettings > promptExecutionSettings ;
254+ private final Map <String , PromptExecutionSettings > executionSettings ;
257255
258256
259257 protected Builder (Function <KernelArguments , U > constructor ) {
260258 this .constructor = constructor ;
261259 this .variables = new HashMap <>();
262- this .promptExecutionSettings = new HashMap <>();
260+ this .executionSettings = new HashMap <>();
263261 }
264262
265263 /**
@@ -365,24 +363,28 @@ public <T> Builder<U> withVariable(String key, T value,
365363 /**
366364 * Set prompt execution settings
367365 *
368- * @param promptExecutionSettings Prompt execution settings
366+ * @param executionSettings Execution settings
369367 * @return {$code this} Builder for fluent coding
370368 */
371- public Builder <U > withPromptExecutionSettings (Map <String , PromptExecutionSettings > promptExecutionSettings ) {
372- return withPromptExecutionSettings (new ArrayList <>(promptExecutionSettings .values ()));
369+ public Builder <U > withExecutionSettings (Map <String , PromptExecutionSettings > executionSettings ) {
370+ return withExecutionSettings (new ArrayList <>(executionSettings .values ()));
373371 }
374372
375373 /**
376374 * Set prompt execution settings
377375 *
378- * @param promptExecutionSettings Prompt execution settings
376+ * @param executionSettings Execution settings
379377 * @return {$code this} Builder for fluent coding
380378 */
381- public Builder <U > withPromptExecutionSettings (List <PromptExecutionSettings > promptExecutionSettings ) {
382- for (PromptExecutionSettings settings : promptExecutionSettings ) {
379+ public Builder <U > withExecutionSettings (List <PromptExecutionSettings > executionSettings ) {
380+ if (executionSettings == null ) {
381+ return this ;
382+ }
383+
384+ for (PromptExecutionSettings settings : executionSettings ) {
383385 String serviceId = settings .getServiceId ();
384386
385- if (this .promptExecutionSettings .containsKey (serviceId )) {
387+ if (this .executionSettings .containsKey (serviceId )) {
386388 if (serviceId .equals (PromptExecutionSettings .DEFAULT_SERVICE_ID )) {
387389 throw new SKException (
388390 String .format (
@@ -404,7 +406,7 @@ public Builder<U> withPromptExecutionSettings(List<PromptExecutionSettings> prom
404406
405407 @ Override
406408 public U build () {
407- KernelArguments arguments = new KernelArguments (variables , promptExecutionSettings );
409+ KernelArguments arguments = new KernelArguments (variables , executionSettings );
408410 return constructor .apply (arguments );
409411 }
410412 }
0 commit comments