Files
ekzamen-samokorrektiruyusch…/README.md
T

67 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SelfCorrecting Agent Demo
## Overview
This repository contains a minimal Python project that demonstrates a **selfcorrecting agent** using the OpenAI API.
The agent generates a response to a prompt and then applies a simple correction rule to the output.
## Technology Stack
| Component | Version | Notes |
|-----------|---------|-------|
| Python | 3.11+ | The code is written for Python 3.11. |
| OpenAI SDK | `openai>=1.0.0` | Required dependency for interacting with the OpenAI API. |
> **Mandatory Dependency**
> The assignment explicitly requires the `openai` package. It is listed in `requirements.txt` and will be installed with `pip install -r requirements.txt`.
## Setup
1. **Clone the repository**
```bash
git clone https://git.brojs.ru/kuzakhmetovartur/ekzamen-samokorrektiruyuschiysya-agent.git
cd ekzamen-samokorrektiruyuschiysya-agent
```
2. **Create a virtual environment** (recommended)
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\\Scripts\\activate
```
3. **Install dependencies**
```bash
pip install -r requirements.txt
```
4. **Set your OpenAI API key**
```bash
export OPENAI_API_KEY="sk-..."
```
## Running the Demo
```bash
python src/index.py
```
You should see two outputs: the raw response from the model and the corrected version.
## Extending the Agent
The current correction logic is intentionally simple. To build a more sophisticated selfcorrecting agent:
- Replace the `correct_text` function with a rulebased or MLbased correction.
- Add unit tests in a `tests/` directory.
- Integrate with a larger application or chatbot framework.
## License
This project is provided as-is for educational purposes. Feel free to adapt and extend it.
---
**Author:** Artur Kuzakhmetov
**Date:** 28.05.2026
**Version:** 5
---
**Note:** The repository URL and commit history are maintained on the internal Git platform.