Skip to content

Commit 2e65593

Browse files
Update python/semantic_kernel/functions/kernel_function.py
For enable deep copy Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 9e93880 commit 2e65593

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

python/semantic_kernel/functions/kernel_function.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,7 @@ def function_copy(self, plugin_name: str | None = None) -> "KernelFunction":
388388
KernelFunction: The copied function.
389389
"""
390390
cop: KernelFunction = copy(self)
391-
# Only copy metadata if we need to modify plugin_name
392-
if plugin_name and plugin_name != self.metadata.plugin_name:
393-
cop.metadata = self.metadata.model_copy() # Shallow copy via Pydantic
391+
cop.metadata = self.metadata.model_copy(update={"plugin_name": plugin_name}, deep=True)
394392
cop.metadata.plugin_name = plugin_name
395393
else:
396394
# Reuse reference when no modification needed (safe as metadata is immutable in practice)

0 commit comments

Comments
 (0)