feat: solution for 'Повторный экзамен: Граф с рефлексией и доработкой'
This commit is contained in:
@@ -1,40 +1,37 @@
|
||||
# Self-Correcting Agent
|
||||
# Graph Reflexivity Project
|
||||
|
||||
This repository contains a simple implementation of a self‑correcting agent using **LangGraph**.
|
||||
The agent follows these steps:
|
||||
|
||||
1. **Ask** – Generates an answer to the user’s question.
|
||||
2. **Check** – Evaluates the answer’s quality.
|
||||
3. **Correct** – If the answer is flagged as poor, it rewrites it.
|
||||
4. **Final** – Returns the final answer.
|
||||
This project demonstrates a simple graph implementation in JavaScript that supports reflexivity (adding self-loops to all nodes). It uses the `graphlib` library for graph data structures and `lodash` for utility functions.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
npm install
|
||||
```
|
||||
|
||||
> **Note**: The implementation uses deterministic placeholders instead of real LLM calls, so no API keys are required.
|
||||
## Running the Example
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from src.agent import run_agent
|
||||
|
||||
question = "What is the capital of France?"
|
||||
answer = run_agent(question)
|
||||
print(answer)
|
||||
```bash
|
||||
node src/index.js
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
You will see the adjacency list before and after applying reflexivity.
|
||||
|
||||
## Testing
|
||||
|
||||
Run the test suite with:
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
├── requirements.txt
|
||||
├── src
|
||||
│ └── agent.py
|
||||
└── README.md
|
||||
```
|
||||
|
||||
The tests cover basic graph operations, reflexivity, and adjacency list generation.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- **graphlib** – Provides the underlying graph data structure.
|
||||
- **lodash** – Utility library (used for potential future extensions).
|
||||
- **jest** – Testing framework (dev dependency).
|
||||
|
||||
## License
|
||||
|
||||
MIT License
|
||||
MIT
|
||||
Reference in New Issue
Block a user