1.7 KiB
1.7 KiB
LangGraph Comparative Review Agent
This project implements a LangGraph agent that, given three entities (e.g., technologies, products, or approaches), produces a comparative review. The agent:
- Generates 3–5 comparison criteria using an LLM.
- Performs a web search for each entity‑criterion pair via Tavily and stores a short note.
- Builds a Markdown table with the findings.
- Produces a verdict recommending which entity suits which use case.
Features
- LLM powered: Uses OpenAI’s GPT model to generate criteria and verdicts.
- Web search: Uses Tavily to fetch up-to-date information for each pair.
- CLI: Run from the command line with default or custom entities.
- Modular: Separate files for state, nodes, graph, and CLI.
Setup
# 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
# Create a .env file with your API keys
cp .env.example .env
# Edit .env and fill in your keys
Usage
python src/main.py
The script will compare the default entities: Chroma, FAISS, Qdrant.
You can also provide custom entities:
python src/main.py --entities "TensorFlow, PyTorch, JAX"
The output will display:
- Generated comparison criteria.
- The Markdown table of findings.
- The final verdict.
Project Structure
src/
├── cli.py # CLI entry point
├── graph.py # LangGraph definition
├── main.py # Script to run the graph
├── nodes.py # Node implementations
└── state.py # TypedDict for state
License
MIT License