pull/462/head
Kye 8 months ago
parent c6a6ff78e9
commit 30df15f70c

@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "swarms"
version = "4.8.7"
version = "4.8.8"
description = "Swarms - Pytorch"
license = "MIT"
authors = ["Kye Gomez <kye@apac.ai>"]

@ -0,0 +1,23 @@
def algorithm_of_thoughts_sop(objective: str):
AOT_PROMPT = f"""
This function systematically breaks down the given objective into distinct, manageable subtasks.
It structures the problem-solving process through explicit step-by-step exploration,
using a methodical search tree approach. Key steps are numbered to guide the exploration of solutions.
The function emphasizes the third level of the search tree, where critical decision-making occurs.
Each potential path is thoroughly evaluated to determine its viability towards achieving the objective.
The process includes:
- Identifying initial steps in the search tree.
- Delineating and exploring critical third-level decisions.
- Considering alternative paths if initial trials are not promising.
The goal is to think atomically and provide solutions for each subtask identified,
leading to a conclusive final result. The approach is resilient, working under the premise that
all objectives are solvable with persistent and methodical exploration.
### OBJECTIVE
{objective}
###
"""
return AOT_PROMPT

@ -33,6 +33,7 @@ from swarms.tools.tool import BaseTool
from swarms.utils.data_to_text import data_to_text
from swarms.utils.parse_code import extract_code_from_markdown
from swarms.utils.pdf_to_text import pdf_to_text
from swarms.prompts.aot_prompt import algorithm_of_thoughts_sop
# Utils
@ -229,6 +230,9 @@ class Agent:
list_tool_schemas: Optional[List[BaseModel]] = None,
metadata_output_type: str = "json",
state_save_file_type: str = "json",
chain_of_thoughts: bool = False,
algorithm_of_thoughts: bool = False,
tree_of_thoughts: bool = False,
*args,
**kwargs,
):
@ -297,6 +301,9 @@ class Agent:
self.list_tool_schemas = list_tool_schemas
self.metadata_output_type = metadata_output_type
self.state_save_file_type = state_save_file_type
self.chain_of_thoughts = chain_of_thoughts
self.algorithm_of_thoughts = algorithm_of_thoughts
self.tree_of_thoughts = tree_of_thoughts
# The max_loops will be set dynamically if the dynamic_loop
if self.dynamic_loops:
@ -417,6 +424,13 @@ class Agent:
# Description
self.description = agent_description
# If the algorithm of thoughts is enabled then set the sop to the algorithm of thoughts
if self.algorithm_of_thoughts is not None:
self.short_memory.add(
role=self.agent_name,
content=algorithm_of_thoughts_sop(objective=self.task),
)
def set_system_prompt(self, system_prompt: str):
"""Set the system prompt"""
self.system_prompt = system_prompt

Loading…
Cancel
Save