Skip to content
Prev Previous commit
Next Next commit
return Collections.unmodifiableList(functions)
  • Loading branch information
Milder Hernandez Cagua
Milder Hernandez Cagua committed Apr 29, 2025
commit bc618869e76dec1927b0a9624a6a8737644f89e9
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.microsoft.semantickernel.semanticfunctions.KernelFunction;

import javax.annotation.Nullable;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
Expand All @@ -20,7 +21,7 @@ public abstract class FunctionChoiceBehavior {

protected FunctionChoiceBehavior(List<KernelFunction<?>> functions,
@Nullable FunctionChoiceBehaviorOptions options) {
this.functions = functions;
this.functions = functions != null ? Collections.unmodifiableList(functions) : null;
this.fullFunctionNames = new HashSet<>();

if (functions != null) {
Comment thread
milderhc marked this conversation as resolved.
Expand All @@ -42,7 +43,7 @@ protected FunctionChoiceBehavior(List<KernelFunction<?>> functions,
* @return The functions that are allowed.
*/
public List<KernelFunction<?>> getFunctions() {
return functions;
return Collections.unmodifiableList(functions);
}

/**
Expand Down