Skip to content

Commit 8d109a9

Browse files
sjrljulian-risch
authored andcommitted
fix: Update to ComponentTool __deepcopy__ (#9302)
* Hopefully a fix * Add reno
1 parent 1401c51 commit 8d109a9

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

haystack/tools/component_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def __deepcopy__(self, memo: Dict[Any, Any]) -> "ComponentTool":
435435
try:
436436
# Try to deep copy the attribute
437437
setattr(result, key, deepcopy(value, memo))
438-
except TypeError:
438+
except (TypeError, NotImplementedError):
439439
# Fall back to using the original attribute for components that use Jinja2-templates
440440
logger.debug(
441441
"deepcopy of ComponentTool {tool_name} failed. Using original attribute '{attribute}' instead.",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
Update the __deepcopy__ of ComponentTool to gracefully handle NotImplementedError when trying to deepcopy attributes.

0 commit comments

Comments
 (0)