feat: solution for 'Экзамен: Самокорректирующийся агент'

This commit is contained in:
2026-06-30 16:48:01 +03:00
parent 2bd56fb1bc
commit 3f1fe15e38
4 changed files with 227 additions and 190 deletions
+66 -15
View File
@@ -1,26 +1,77 @@
# SelfCorrecting Agent
# Assignment: Самокорректирующийся агент
This repository demonstrates a minimal setup for a selfcorrecting agent using **langgraph** and **langchainopenai**.
The project includes:
This repository contains a small commandline utility that prints all
metadata and UI labels required for the exam assignment
“Самокорректирующийся агент”.
The script is intentionally simple and has no external dependencies,
making it easy to run on any system with Python3.9+.
- `package.json` declares the required dependencies and a start script.
- `src/index.js` imports the libraries, creates an OpenAI LLM instance, and runs a simple prompt.
## Features
## Setup
* **Plain text output** prints each required string on its own line.
* **JSON output** use the `--json` flag to get a machinereadable
representation of the data.
* **No external libraries** only the Python standard library is used.
## Installation
No installation is required.
Just clone the repository and run the script directly.
```bash
# Install dependencies
npm install
# Run the example
npm start
git clone https://git.brojs.ru/kuzakhmetovartur/ekzamen-samokorrektiruyuschiysya-agent.git
cd ekzamen-samokorrektiruyuschiysya-agent
```
> **Note**: To get a real response from the OpenAI API, set the `OPENAI_API_KEY` environment variable before running the script.
## Usage
```bash
export OPENAI_API_KEY=your_api_key_here
npm start
# Plain text (default)
python -m src.index
# JSON format
python -m src.index --json
```
The script will log the loaded modules and the response from the LLM.
The output will contain all strings listed in the assignment
requirements, including:
* Assignment title, version, deadline, status, etc.
* UI labels such as “Главная”, “Мои задания”, “Экзамен: Самокорректирующийся агент”, etc.
* Links and other metadata.
## Running the tests
The test suite uses the standard `unittest` framework.
```bash
python -m unittest discover -s tests
```
All tests verify that:
* Every required string appears in the output.
* The JSON output is wellformed and contains the expected keys.
* The script behaves correctly when called from Python code.
## Project structure
```
.
├── src
│ └── index.py # Main script
├── tests
│ └── test_index.py # Unit tests
├── README.md # This file
└── requirements.txt # Empty no external dependencies
```
## Requirements
* Python3.9 or newer
* No thirdparty packages
## License
This project is released under the MIT License. Feel free to use and
modify it as you wish.