🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
fix(prompt): wrap TextPrompt with str for clearer multiline display in debug view (#3337)
Lei Zhang98541d9c5546
diff --git a/camel/societies/workforce/role_playing_worker.py b/camel/societies/workforce/role_playing_worker.pyindex f1d52c0ca..c42f392dc 100644--- a/camel/societies/workforce/role_playing_worker.py+++ b/camel/societies/workforce/role_playing_worker.py@@ -119,11 +119,13 @@ class RolePlayingWorker(Worker):`TaskState.FAILED`."""dependency_tasks_info = self._get_dep_tasks_info(dependencies)- prompt = ROLEPLAY_PROCESS_TASK_PROMPT.format(- content=task.content,- parent_task_content=task.parent.content if task.parent else "",- dependency_tasks_info=dependency_tasks_info,- additional_info=task.additional_info,+ prompt = str(+ ROLEPLAY_PROCESS_TASK_PROMPT.format(+ content=task.content,+ parent_task_content=task.parent.content if task.parent else "",+ dependency_tasks_info=dependency_tasks_info,+ additional_info=task.additional_info,+ ))role_play_session = RolePlaying(assistant_role_name=self.assistant_role_name,@@ -183,12 +185,14 @@ class RolePlayingWorker(Worker):input_msg = assistant_response.msgchat_history_str = "\n".join(chat_history)- prompt = ROLEPLAY_SUMMARIZE_PROMPT.format(- user_role=self.user_role_name,- assistant_role=self.assistant_role_name,- content=task.content,- chat_history=chat_history_str,- additional_info=task.additional_info,+ prompt = str(+ ROLEPLAY_SUMMARIZE_PROMPT.format(+ user_role=self.user_role_name,+ assistant_role=self.assistant_role_name,+ content=task.content,+ chat_history=chat_history_str,+ additional_info=task.additional_info,+ ))if self.use_structured_output_handler and self.structured_handler:# Use structured output handler for prompt-based extractiondiff --git a/camel/societies/workforce/single_agent_worker.py b/camel/societies/workforce/single_agent_worker.pyindex 8ed3a2711..752ecbb18 100644--- a/camel/societies/workforce/single_agent_worker.py+++ b/camel/societies/workforce/single_agent_worker.py@@ -359,11 +359,15 @@ class SingleAgentWorker(Worker):try:dependency_tasks_info = self._get_dep_tasks_info(dependencies)- prompt = PROCESS_TASK_PROMPT.format(- content=task.content,- parent_task_content=task.parent.content if task.parent else "",- dependency_tasks_info=dependency_tasks_info,- additional_info=task.additional_info,+ prompt = str(+ PROCESS_TASK_PROMPT.format(+ content=task.content,+ parent_task_content=task.parent.content+ if task.parent+ else "",+ dependency_tasks_info=dependency_tasks_info,+ additional_info=task.additional_info,+ ))if self.use_structured_output_handler and self.structured_handler:diff --git a/camel/societies/workforce/workforce.py b/camel/societies/workforce/workforce.pyindex 11c6e5a82..012a8cd74 100644--- a/camel/societies/workforce/workforce.py+++ b/camel/societies/workforce/workforce.py@@ -863,10 +863,12 @@ class Workforce(BaseNode):Union[List[Task], Generator[List[Task], None, None]]:The subtasks or generator of subtasks."""- decompose_prompt = TASK_DECOMPOSE_PROMPT.format(- content=task.content,- child_nodes_info=self._get_child_nodes_info(),- additional_info=task.additional_info,+ decompose_prompt = str(+ TASK_DECOMPOSE_PROMPT.format(+ content=task.content,+ child_nodes_info=self._get_child_nodes_info(),+ additional_info=task.additional_info,+ ))self.task_agent.reset()result = task.decompose(self.task_agent, decompose_prompt)@@ -993,16 +995,18 @@ class Workforce(BaseNode):]# Format the unified analysis prompt- analysis_prompt = TASK_ANALYSIS_PROMPT.format(- task_id=task.id,- task_content=task.content,- task_result=task_result,- failure_count=task.failure_count,- task_depth=task.get_depth(),- assigned_worker=task.assigned_worker_id or "unknown",- issue_type=issue_type,- issue_specific_analysis=issue_analysis,- response_format=response_format,+ analysis_prompt = str(+ TASK_ANALYSIS_PROMPT.format(+ task_id=task.id,+ task_content=task.content,+ task_result=task_result,+ failure_count=task.failure_count,+ task_depth=task.get_depth(),+ assigned_worker=task.assigned_worker_id or "unknown",+ issue_type=issue_type,+ issue_specific_analysis=issue_analysis,+ response_format=response_format,+ ))try:@@ -3121,10 +3125,12 @@ class Workforce(BaseNode):Returns:Worker: The created worker node."""- prompt = CREATE_NODE_PROMPT.format(- content=task.content,- child_nodes_info=self._get_child_nodes_info(),- additional_info=task.additional_info,+ prompt = str(+ CREATE_NODE_PROMPT.format(+ content=task.content,+ child_nodes_info=self._get_child_nodes_info(),+ additional_info=task.additional_info,+ ))# Check if we should use structured handlerif self.use_structured_output_handler: