53 lines
1.5 KiB
Markdown
53 lines
1.5 KiB
Markdown
# Shopping List AI Agent
|
||
|
||
This project demonstrates a simple hierarchical AI agent built with LangChain that helps plan a shopping list, fetches prices for each item using a sub‑agent, and calculates the total cost.
|
||
|
||
## Prerequisites
|
||
|
||
- Python 3.10+
|
||
- A local LLM server (e.g., LM Studio) running at `http://localhost:1234/v1`.
|
||
The server must expose an OpenAI‑compatible API.
|
||
|
||
## Installation
|
||
|
||
bash
|
||
# Clone the repository
|
||
git clone https://github.com/your-username/shopping-list-agent.git
|
||
cd shopping-list-agent
|
||
|
||
# Create a virtual environment (optional but recommended)
|
||
python -m venv venv
|
||
source venv/bin/activate # On Windows use `venv\\Scripts\\activate`
|
||
|
||
# Install dependencies
|
||
pip install -r requirements.txt
|
||
|
||
|
||
## Running the Agent
|
||
|
||
bash
|
||
python src/main.py
|
||
|
||
|
||
The script will ask the agent to plan a shopping list for the following request:
|
||
|
||
|
||
Помоги составить список покупок: молоко, хлеб, яблоки. Я нахожусь в Казани.
|
||
|
||
|
||
The agent will:
|
||
|
||
1. Parse the list of products and the city.
|
||
2. For each product, invoke the `get_price` tool, which internally creates a sub‑agent that generates a realistic price table.
|
||
3. Sum the prices and output the final total.
|
||
|
||
All intermediate tool calls and the final answer are printed to the console.
|
||
|
||
## Customization
|
||
|
||
- **Model**: Change the `model` parameter in `src/main.py` to match the model name exposed by your LM Studio instance.
|
||
- **Temperature**: Adjust the `temperature` argument to control the randomness of the responses.
|
||
|
||
## License
|
||
|
||
MIT License |