Skip to content

Commit bc61886

Browse files
author
Milder Hernandez Cagua
committed
return Collections.unmodifiableList(functions)
1 parent 9b821db commit bc61886

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

semantickernel-api/src/main/java/com/microsoft/semantickernel/functionchoice/FunctionChoiceBehavior.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.microsoft.semantickernel.semanticfunctions.KernelFunction;
55

66
import javax.annotation.Nullable;
7+
import java.util.Collections;
78
import java.util.HashSet;
89
import java.util.List;
910
import java.util.Objects;
@@ -20,7 +21,7 @@ public abstract class FunctionChoiceBehavior {
2021

2122
protected FunctionChoiceBehavior(List<KernelFunction<?>> functions,
2223
@Nullable FunctionChoiceBehaviorOptions options) {
23-
this.functions = functions;
24+
this.functions = functions != null ? Collections.unmodifiableList(functions) : null;
2425
this.fullFunctionNames = new HashSet<>();
2526

2627
if (functions != null) {
@@ -42,7 +43,7 @@ protected FunctionChoiceBehavior(List<KernelFunction<?>> functions,
4243
* @return The functions that are allowed.
4344
*/
4445
public List<KernelFunction<?>> getFunctions() {
45-
return functions;
46+
return Collections.unmodifiableList(functions);
4647
}
4748

4849
/**

0 commit comments

Comments
 (0)