Building AI agents, atomically
Enhance quickstart example
KennyVaneetvelde4f958cbf576b
diff --git a/atomic-examples/quickstart/pyproject.toml b/atomic-examples/quickstart/pyproject.tomlindex 7d7ec0c..48ba148 100644--- a/atomic-examples/quickstart/pyproject.toml+++ b/atomic-examples/quickstart/pyproject.toml@@ -1,7 +1,7 @@[tool.poetry]name = "quickstart"version = "0.1.0"-description = ""+description = "Quickstart example for Atomic Agents"authors = ["Kenny Vaneetvelde <[email protected]>"]readme = "README.md"diff --git a/atomic-examples/quickstart/quickstart/main.py b/atomic-examples/quickstart/quickstart/main.pyindex a20e9b4..d1bd0fd 100644--- a/atomic-examples/quickstart/quickstart/main.py+++ b/atomic-examples/quickstart/quickstart/main.py@@ -16,19 +16,24 @@ if not API_KEY:if not API_KEY:raise ValueError("API key is not set. Please set the API key as a static variable or in the environment variable OPENAI_API_KEY.")+# Initialize a Rich Console for pretty console outputsconsole = Console()# Memory setupmemory = AgentMemory()++# Initialize memory with an initial message from the assistantinitial_memory = [{"role": "assistant", "content": "How do you do? What can I do for you? Tell me, pray, what is your need today?"}]memory.load(initial_memory)-# OpenAI client setup+# OpenAI client setup using the Instructor library+# Note, you can also set up a client using any other LLM provider, such as Anthropic, Cohere, etc.+# See the Instructor library for more information: https://github.com/instructor-ai/instructorclient = instructor.from_openai(openai.OpenAI(api_key=API_KEY))-# Agent setup+# Agent setup with specified configurationagent = BaseAgent(config=BaseAgentConfig(client=client,@@ -37,16 +42,26 @@ agent = BaseAgent())+# Generate the default system prompt for the agent+default_system_prompt = agent.system_prompt_generator.generate_prompt()+# Display the system prompt in a styled panel+console.print(Panel(default_system_prompt, width=console.width, style="bold cyan"), style="bold cyan")++# Display the initial message from the assistantagent_message = Text(initial_memory[0]["content"], style="bold green")console.print(Text("Agent:", style="bold green"), end=" ")console.print(agent_message)+# Start an infinite loop to handle user inputs and agent responseswhile True:+ # Prompt the user for input with a styled promptuser_input = console.input("[bold blue]You:[/bold blue] ")+ # Check if the user wants to exit the chatif user_input.lower() in ["/exit", "/quit"]:console.print("Exiting chat...")break+ # Process the user's input through the agent and get the response and display itresponse = agent.run(agent.input_schema(chat_message=user_input))agent_message = Text(response.chat_message, style="bold green")console.print(Text("Agent:", style="bold green"), end=" ")diff --git a/atomic-examples/quickstart/tests/__init__.py b/atomic-examples/quickstart/tests/__init__.pydeleted file mode 100644index e69de29..0000000