From 8195aaedea1c1cb2fd30a654c2d38bb0cdeb96f0 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 12 Feb 2025 20:01:22 +0000 Subject: [PATCH] docs: Enhance method documentation and type hints - Add comprehensive docstrings - Improve type hints clarity - Add missing error documentation Co-Authored-By: Joe Moura --- src/crewai/agents/crew_agent_executor.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/crewai/agents/crew_agent_executor.py b/src/crewai/agents/crew_agent_executor.py index 59985f9d6..fe3a1fbb1 100644 --- a/src/crewai/agents/crew_agent_executor.py +++ b/src/crewai/agents/crew_agent_executor.py @@ -511,11 +511,17 @@ class CrewAgentExecutor(CrewAgentExecutorMixin): def _handle_human_feedback(self, formatted_answer: AgentFinish) -> AgentFinish: """Handle human feedback with different flows for training vs regular use. + This method processes human feedback by either handling it as training data + or as regular feedback requiring potential multiple iterations. + Args: - formatted_answer: The initial AgentFinish result to get feedback on + formatted_answer (AgentFinish): The initial AgentFinish result to get feedback on Returns: AgentFinish: The final answer after processing feedback + + Raises: + FeedbackProcessingError: If feedback processing fails """ human_feedback = self._ask_human_input(formatted_answer.output) @@ -615,7 +621,14 @@ class CrewAgentExecutor(CrewAgentExecutorMixin): raise FeedbackProcessingError(error_msg) def _feedback_requires_changes(self, response: Optional[str]) -> bool: - """Determine if feedback response indicates need for changes.""" + """Determine if feedback response indicates need for changes. + + Args: + response (Optional[str]): The LLM's response to feedback classification + + Returns: + bool: True if feedback requires changes, False otherwise + """ return response == "true" if response else False def _process_feedback_iteration(self, feedback: str) -> AgentFinish: