Skip to content

Commit

Permalink
refactor: Improve feedback message formatting
Browse files Browse the repository at this point in the history
- Use i18n for feedback message formatting
- Enhance method documentation
- Improve code organization

Co-Authored-By: Joe Moura <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and Joe Moura committed Feb 12, 2025
1 parent 0fd72fc commit c10665c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/crewai/agents/crew_agent_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@ def _handle_regular_feedback(
) -> AgentFinish:
"""Process feedback for regular use with potential multiple iterations.
This method handles the iterative feedback process where the agent continues
to improve its answer based on user feedback until no more changes are needed.
Args:
current_answer (AgentFinish): The current answer from the agent
initial_feedback (str): The initial feedback from the user
Expand All @@ -582,20 +585,18 @@ def _handle_regular_feedback(
AgentFinish: The final answer after processing all feedback iterations
Raises:
FeedbackProcessingError: If feedback processing fails
FeedbackProcessingError: If feedback processing or validation fails
"""
try:
feedback = initial_feedback
answer = current_answer

while self.ask_for_human_input:
# Add feedback message with user role using standard formatter
self.messages.append(self._format_msg(
f"Feedback: {feedback}",
role="user"
))
feedback_msg = self._i18n.slice("feedback_message").format(feedback=feedback)
self.messages.append(self._format_msg(feedback_msg, role="user"))

response = self._get_llm_feedback_response(feedback)

if not self._feedback_requires_changes(response):
self.ask_for_human_input = False
else:
Expand Down

0 comments on commit c10665c

Please sign in to comment.