mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-27 17:18:13 +00:00
feat: Add multi-round dialogue functionality (fixes #2250)
- Add max_dialogue_rounds parameter to Task class with default of 10 - Update _handle_regular_feedback method to support multiple rounds - Update _ask_human_input method to display current round information - Pass max_dialogue_rounds parameter through agent execution flow - Add tests for Task class max_dialogue_rounds parameter Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
37
tests/agents/test_multi_round_dialogue.py
Normal file
37
tests/agents/test_multi_round_dialogue.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from crewai.task import Task
|
||||
|
||||
|
||||
class TestMultiRoundDialogue(unittest.TestCase):
|
||||
"""Test the multi-round dialogue functionality."""
|
||||
|
||||
def test_task_max_dialogue_rounds_default(self):
|
||||
"""Test that Task has a default max_dialogue_rounds of 10."""
|
||||
# Create a task with default max_dialogue_rounds
|
||||
task = Task(
|
||||
description="Test task",
|
||||
expected_output="Test output",
|
||||
human_input=True
|
||||
)
|
||||
|
||||
# Verify the default value
|
||||
self.assertEqual(task.max_dialogue_rounds, 10)
|
||||
|
||||
def test_task_max_dialogue_rounds_custom(self):
|
||||
"""Test that Task accepts a custom max_dialogue_rounds."""
|
||||
# Create a task with custom max_dialogue_rounds
|
||||
task = Task(
|
||||
description="Test task",
|
||||
expected_output="Test output",
|
||||
human_input=True,
|
||||
max_dialogue_rounds=5
|
||||
)
|
||||
|
||||
# Verify the custom value
|
||||
self.assertEqual(task.max_dialogue_rounds, 5)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user