diff --git a/.env.example b/.env.example index e229a10..8cdb3a4 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,6 @@ # API Keys OPENAI_API_KEY=your_openai_key_here -# Optional: LangSmith tracing LANGSMITH_API_KEY=your_langsmith_key_here LANGCHAIN_TRACING_V2=true LANGCHAIN_PROJECT=music-support-bot diff --git a/README.md b/README.md index ec03d35..d9571e7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Music Store Customer Support Bot - Starter Code -Simple starter code for building a customer support agent for the Chinook music store database using `create_agent()`. +Simple starter code for building a customer support agent for the Chinook music store database using `create_agent()` or `create_deep_agent()`. ## Setup @@ -9,8 +9,9 @@ Simple starter code for building a customer support agent for the Chinook music pip install -r requirements.txt pip install langgraph-cli -# 2. Add your API key to .env -# Edit OPENAI_API_KEY in the .env file +# 2. Add your API keys to .env +# - OPENAI_API_KEY: https://platform.openai.com/api-keys +# - LANGSMITH_API_KEY: https://smith.langchain.com/ (sign up, then Settings > API Keys) # 3. Run Studio langgraph dev @@ -29,7 +30,7 @@ take_home/ ├── .env # Environment variables (add your API keys here) ├── .env.example # Template └── src/ - ├── agent.py # Agent definition using create_agent() + ├── agent.py # Agent definition ├── db.py # Database connection (loads from GitHub) └── tools/ ├── customer_tools.py # get_customer_orders tool diff --git a/src/agent.py b/src/agent.py index b8daa45..5475170 100644 --- a/src/agent.py +++ b/src/agent.py @@ -1,19 +1,14 @@ -""" -Music Store Customer Support Bot - Simple 2-Tool Agent +"""Music Store Customer Support Bot""" -Uses create_agent() with minimal tools for simplicity. -""" import os from langchain_openai import ChatOpenAI from langchain.agents import create_agent +from langchain.agents import create_deep_agent from src.tools.customer_tools import get_customer_orders from src.tools.music_tools import list_tracks_by_artist -# Model configuration DEFAULT_MODEL = os.getenv("MODEL", "gpt-4o") - -# System prompt for the agent SYSTEM_PROMPT = """You are a helpful customer support agent for a music store. You can help customers with: @@ -26,20 +21,16 @@ Important: - Be friendly, helpful, and professional - For questions outside these capabilities, politely explain what you can help with""" +TOOLS = [get_customer_orders, list_tracks_by_artist] + def build_agent(): - """Build the customer support agent with 2 simple tools.""" + """Build agent using create_agent.""" model = ChatOpenAI(model=DEFAULT_MODEL, temperature=0) + return create_agent(model=model, tools=TOOLS, system_prompt=SYSTEM_PROMPT) - tools = [ - get_customer_orders, # View order history - list_tracks_by_artist # Browse tracks by artist - ] - agent = create_agent( - model=model, - tools=tools, - system_prompt=SYSTEM_PROMPT - ) - - return agent +# def build_agent(): +# """Build agent using create_deep_agent.""" +# model = ChatOpenAI(model=DEFAULT_MODEL, temperature=0) +# return create_deep_agent(model=model, tools=TOOLS, system_prompt=SYSTEM_PROMPT)