mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-21 22:08:21 +00:00
Add feature to override _ask_human_input function in Task (#2419)
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -1205,6 +1205,7 @@ def test_agent_max_retry_limit():
|
||||
"tool_names": "",
|
||||
"tools": "",
|
||||
"ask_for_human_input": True,
|
||||
"ask_human_input_function": None,
|
||||
}
|
||||
),
|
||||
mock.call(
|
||||
@@ -1213,6 +1214,7 @@ def test_agent_max_retry_limit():
|
||||
"tool_names": "",
|
||||
"tools": "",
|
||||
"ask_for_human_input": True,
|
||||
"ask_human_input_function": None,
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
23
tests/test_custom_human_input.py
Normal file
23
tests/test_custom_human_input.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
from crewai.task import Task
|
||||
|
||||
|
||||
def test_task_custom_human_input_parameter():
|
||||
"""Test that the Task class accepts the ask_human_input parameter."""
|
||||
# Custom human input function
|
||||
def custom_input_func(final_answer):
|
||||
return "Custom feedback"
|
||||
|
||||
# Create a task with the custom function
|
||||
task = Task(
|
||||
description="Test task",
|
||||
expected_output="Test output",
|
||||
human_input=True,
|
||||
ask_human_input=custom_input_func
|
||||
)
|
||||
|
||||
# Verify the parameter was stored correctly
|
||||
assert task.ask_human_input == custom_input_func
|
||||
assert callable(task.ask_human_input)
|
||||
Reference in New Issue
Block a user