mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 06:48:02 -05:00
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
@@ -163,11 +163,29 @@ def response_to_actions(
|
||||
if 'view_range' in other_kwargs:
|
||||
# Remove view_range from other_kwargs since it is not needed for FileEditAction
|
||||
other_kwargs.pop('view_range')
|
||||
|
||||
# Filter out unexpected arguments
|
||||
valid_kwargs = {}
|
||||
# Get valid parameters from the str_replace_editor tool definition
|
||||
str_replace_editor_tool = create_str_replace_editor_tool()
|
||||
valid_params = set(
|
||||
str_replace_editor_tool['function']['parameters'][
|
||||
'properties'
|
||||
].keys()
|
||||
)
|
||||
for key, value in other_kwargs.items():
|
||||
if key in valid_params:
|
||||
valid_kwargs[key] = value
|
||||
else:
|
||||
raise FunctionCallValidationError(
|
||||
f'Unexpected argument {key} in tool call {tool_call.function.name}. Allowed arguments are: {valid_params}'
|
||||
)
|
||||
|
||||
action = FileEditAction(
|
||||
path=path,
|
||||
command=command,
|
||||
impl_source=FileEditSource.OH_ACI,
|
||||
**other_kwargs,
|
||||
**valid_kwargs,
|
||||
)
|
||||
# ================================================
|
||||
# AgentThinkAction
|
||||
|
||||
Reference in New Issue
Block a user