parent
048a47931e
commit
c43180de14
@ -1,20 +1,16 @@
|
|||||||
from swarms.structs.agent import Agent
|
from swarms.structs.agent import Agent
|
||||||
from swarms.prompts.finance_agent_sys_prompt import (
|
|
||||||
FINANCIAL_AGENT_SYS_PROMPT,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Initialize the agent
|
# Initialize the agent
|
||||||
agent = Agent(
|
agent = Agent(
|
||||||
agent_name="Financial-Analysis-Agent",
|
agent_name="Financial-Analysis-Agent",
|
||||||
agent_description="Personal finance advisor agent",
|
agent_description="Personal finance advisor agent",
|
||||||
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
|
max_loops=4,
|
||||||
max_loops=2,
|
|
||||||
model_name="gpt-4o-mini",
|
model_name="gpt-4o-mini",
|
||||||
dynamic_temperature_enabled=True,
|
dynamic_temperature_enabled=True,
|
||||||
interactive=False,
|
interactive=False,
|
||||||
output_type="dict",
|
output_type="all",
|
||||||
)
|
)
|
||||||
|
|
||||||
print(
|
agent.run("Conduct an analysis of the best real undervalued ETFs")
|
||||||
agent.run("Conduct an analysis of the best real undervalued ETFs")
|
# print(out)
|
||||||
)
|
# print(type(out))
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
def generate_reasoning_prompt(max_loops: int) -> str:
|
||||||
|
# You are a deliberate, step-by-step reasoning agent designed to solve complex problems
|
||||||
|
# through iterative reasoning loops.
|
||||||
|
|
||||||
|
return f"""
|
||||||
|
Your task is to perform **exactly one loop per generation**,
|
||||||
|
until either the problem is solved or you have completed {max_loops} loops.
|
||||||
|
|
||||||
|
## Instructions:
|
||||||
|
|
||||||
|
- In this generation, perform loop number {{current_loop}} out of {max_loops}.
|
||||||
|
- **Do not perform more than one loop in a single generation.**
|
||||||
|
- Use the **maximum token budget** available to explore, reason, and reflect.
|
||||||
|
- Output must **end** with:
|
||||||
|
- `### End of Loop {{current_loop}}`
|
||||||
|
- **Do not proceed to loop {{current_loop + 1}}** unless explicitly prompted again.
|
||||||
|
|
||||||
|
## Loop Structure (per generation):
|
||||||
|
|
||||||
|
1. **Summarize the Current State**
|
||||||
|
- Recap known information, intermediate thoughts, or context.
|
||||||
|
|
||||||
|
2. **Generate Hypotheses**
|
||||||
|
- Explore possible next steps, questions, or subproblems.
|
||||||
|
|
||||||
|
3. **Evaluate and Choose**
|
||||||
|
- Narrow down based on logic or likelihood of success.
|
||||||
|
|
||||||
|
4. **Act and Update Memory**
|
||||||
|
- Take the chosen step, modify internal reasoning or beliefs.
|
||||||
|
|
||||||
|
5. **Reflect**
|
||||||
|
- Consider whether this step brings you closer to solving the problem.
|
||||||
|
- Suggest whether to continue, backtrack, or finalize.
|
||||||
|
|
||||||
|
## Stopping Criteria:
|
||||||
|
- You will stop reasoning when:
|
||||||
|
- The final answer is found and clearly stated.
|
||||||
|
- {max_loops} loops have been completed.
|
||||||
|
- You conclude that continued reasoning won't help.
|
||||||
|
|
||||||
|
In the final loop (loop {max_loops}), output your final solution as:
|
||||||
|
|
||||||
|
**Final Answer:**
|
||||||
|
|
||||||
|
Be methodical, reflective, and token-efficient. Use all available room to think in detail.
|
||||||
|
Do not rush to conclusions. Each loop is isolated and should be treated as its own generation.
|
||||||
|
"""
|
Loading…
Reference in new issue