Skip to content

Commit 07b837b

Browse files
committed
feat(tools): add support for string descriptions in Annotated
1 parent f187b29 commit 07b837b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/strands/tools/decorator.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _extract_annotated_metadata(
130130
args = get_args(annotation)
131131
actual_type = args[0]
132132

133-
# Look through metadata for a string description or a FieldInfo object.
133+
# Look through metadata for a string description or a FieldInfo object
134134
for meta in args[1:]:
135135
if isinstance(meta, str):
136136
description = meta
@@ -157,16 +157,15 @@ def _extract_annotated_metadata(
157157
"docstring."
158158
)
159159

160-
# Determine the final description with a clear priority order.
160+
# Determine the final description with a clear priority order
161161
# Priority: 1. Annotated string -> 2. Docstring -> 3. Fallback
162162
final_description = description
163163
if final_description is None:
164164
final_description = self.param_descriptions.get(param_name)
165165
if final_description is None:
166166
final_description = f"Parameter {param_name}"
167167

168-
# Create a new, simple FieldInfo object from scratch.
169-
# This avoids all the immutability and mutation issues we encountered previously.
168+
# Create FieldInfo object from scratch
170169
final_field = Field(default=param_default, description=final_description)
171170

172171
return actual_type, final_field

0 commit comments

Comments
 (0)