feat: solution for 'Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)'
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
# 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:
|
||||
|
||||
1. Generates 3–5 comparison criteria using an LLM.
|
||||
2. Performs a web search for each entity‑criterion pair via Tavily and stores a short note.
|
||||
3. Builds a Markdown table with the findings.
|
||||
4. 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
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
python src/main.py
|
||||
```
|
||||
|
||||
The script will compare the default entities: **Chroma, FAISS, Qdrant**.
|
||||
You can also provide custom entities:
|
||||
|
||||
```bash
|
||||
python src/main.py --entities "TensorFlow, PyTorch, JAX"
|
||||
```
|
||||
|
||||
The output will display:
|
||||
|
||||
1. Generated comparison criteria.
|
||||
2. The Markdown table of findings.
|
||||
3. 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
|
||||
Reference in New Issue
Block a user