File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed
examples/agents/memory/agents_and_memory Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change 1- import os
2-
3- from dotenv import load_dotenv
4-
51# Import the OpenAIChat model and the Agent struct
62from swarms import Agent
7- from swarm_models import OpenAIChat
83from swarms_memory import ChromaDB
94
10- # Load the environment variables
11- load_dotenv ()
12-
135# Get the API key from the environment
146api_key = os .environ .get ("OPENAI_API_KEY" )
157
2113 docs_folder = "artifacts" ,
2214)
2315
24- # Initialize the language model
25- llm = OpenAIChat (
26- temperature = 0.5 ,
27- openai_api_key = api_key ,
28- max_tokens = 1000 ,
29- )
30-
3116## Initialize the workflow
3217agent = Agent (
18+ agent_name = "Long-Term-Memory-Agent" ,
3319 model_name = "gpt-4o-mini" ,
3420 name = "Health and Wellness Blog" ,
3521 system_prompt = "Generate a 10,000 word blog on health and wellness." ,
36- max_loops = 4 ,
22+ max_loops = 1 ,
3723 autosave = True ,
3824 dashboard = True ,
3925 long_term_memory = [chromadb ],
40- memory_chunk_size = 300 ,
4126)
4227
4328# Run the workflow on a task
You can’t perform that action at this time.
0 commit comments