mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-20 13:28:13 +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:
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