feat: solution for 'Экзамен: Самокорректирующийся агент'
This commit is contained in:
@@ -1,26 +1,77 @@
|
||||
# Self‑Correcting Agent
|
||||
# Assignment: Самокорректирующийся агент
|
||||
|
||||
This repository demonstrates a minimal setup for a self‑correcting agent using **langgraph** and **langchain‑openai**.
|
||||
The project includes:
|
||||
This repository contains a small command‑line 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 Python 3.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 machine‑readable
|
||||
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 well‑formed 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
|
||||
|
||||
* Python 3.9 or newer
|
||||
* No third‑party packages
|
||||
|
||||
## License
|
||||
|
||||
This project is released under the MIT License. Feel free to use and
|
||||
modify it as you wish.
|
||||
Reference in New Issue
Block a user