From 5a9b56223edb60a4e5a5b4cb18136de362f8497c Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Fri, 16 May 2025 22:44:41 -0700 Subject: [PATCH] cerebas example md --- cerebas_example.py | 13 ++++ docs/mkdocs.yml | 1 + docs/swarms/models/cerebas_example.md | 86 +++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 cerebas_example.py create mode 100644 docs/swarms/models/cerebas_example.md diff --git a/cerebas_example.py b/cerebas_example.py new file mode 100644 index 00000000..c42a75ab --- /dev/null +++ b/cerebas_example.py @@ -0,0 +1,13 @@ +from swarms.structs.agent import Agent + +agent = Agent( + agent_name="Financial-Analysis-Agent", + agent_description="Personal finance advisor agent", + max_loops=4, + model_name="cerebras/llama3-70b-instruct", + dynamic_temperature_enabled=True, + interactive=False, + output_type="all", +) + +agent.run("Conduct an analysis of the best real undervalued ETFs") diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 5c379fc2..062c93c1 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -347,6 +347,7 @@ nav: - OpenAIChat: "swarms/models/openai.md" - OpenAIFunctionCaller: "swarms/models/openai_function_caller.md" - Groq: "swarms/models/groq.md" + - Cerebras: "swarms/models/cerebas_example.md" - MultiModal Models: - BaseMultiModalModel: "swarms/models/base_multimodal_model.md" - Multi Modal Models Available: "swarms/models/multimodal_models.md" diff --git a/docs/swarms/models/cerebas_example.md b/docs/swarms/models/cerebas_example.md new file mode 100644 index 00000000..44134e84 --- /dev/null +++ b/docs/swarms/models/cerebas_example.md @@ -0,0 +1,86 @@ +# Using Cerebras LLaMA with Swarms + +This guide demonstrates how to create and use an AI agent powered by the Cerebras LLaMA 3 70B model using the Swarms framework. + +## Prerequisites + +- Python 3.7+ +- Swarms library installed (`pip install swarms`) + +## Step-by-Step Guide + +### 1. Import Required Module + +```python +from swarms.structs.agent import Agent +``` + +This imports the `Agent` class from Swarms, which is the core component for creating AI agents. + +### 2. Create an Agent Instance + +```python +agent = Agent( + agent_name="Financial-Analysis-Agent", + agent_description="Personal finance advisor agent", + max_loops=4, + model_name="cerebras/llama3-70b-instruct", + dynamic_temperature_enabled=True, + interactive=False, + output_type="all", +) +``` + +Let's break down each parameter: + +- `agent_name`: A descriptive name for your agent (here, "Financial-Analysis-Agent") + +- `agent_description`: A brief description of the agent's purpose + +- `max_loops`: Maximum number of interaction loops the agent can perform (set to 4) + +- `model_name`: Specifies the Cerebras LLaMA 3 70B model to use + +- `dynamic_temperature_enabled`: Enables dynamic adjustment of temperature for varied responses + +- `interactive`: When False, runs without requiring user interaction + +- `output_type`: Set to "all" to return complete response information + +### 3. Run the Agent + +```python +agent.run("Conduct an analysis of the best real undervalued ETFs") +``` + +This command: + +1. Activates the agent + +2. Processes the given prompt about ETF analysis + +3. Returns the analysis based on the model's knowledge + +## Notes + +- The Cerebras LLaMA 3 70B model is a powerful language model suitable for complex analysis tasks + +- The agent can be customized further with additional parameters + +- The `max_loops=4` setting prevents infinite loops while allowing sufficient processing depth + +- Setting `interactive=False` makes the agent run autonomously without user intervention + +## Example Output + +The agent will provide a detailed analysis of undervalued ETFs, including: + +- Market analysis + +- Performance metrics + +- Risk assessment + +- Investment recommendations + +Note: Actual output will vary based on current market conditions and the model's training data. \ No newline at end of file