Files
povtornyy-ekzamen-graf-s-re…/README.md
T

79 lines
1.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
A lightweight Python program that demonstrates a simple selfcorrecting agent.
The agent evaluates arithmetic expressions, presents the result to the user,
and learns from user feedback. Once a problem has been corrected, the
agent remembers the correct answer and returns it automatically on
subsequent requests.
> **Note**
> This project is intentionally minimal to illustrate the concept of a
> selfcorrecting system. It is not intended for production use.
## Features
- **Safe evaluation** of arithmetic expressions (`+`, `-`, `*`, `-`, `**`).
- **Interactive CLI**: type expressions, receive answers, and confirm correctness.
- **Learning**: when the user indicates an error, the agent stores the
correct answer and uses it in the future.
- **Persistence**: learned knowledge is saved to `knowledge.json` in the
current working directory.
## Installation
The project requires Python3.8 or newer.
```bash
# Clone the repository
git clone https://git.brojs.ru/kuzakhmetovartur/ekzamen-samokorrektiruyuschiysya-agent.git
cd ekzamen-samokorrektiruyuschiysya-agent
# (Optional) Create a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\\Scripts\\activate
# Install dependencies (none required for the core functionality)
pip install -r requirements.txt # Empty file, kept for compatibility
```
## Usage
Run the program from the command line:
```bash
python -m src.index
```
You will see a prompt:
```
SelfCorrecting Agent
Type 'exit' to quit.
Enter problem:
```
Enter an arithmetic expression, e.g.:
```
Enter problem: 2 + 3 * 4
````
The program will output:
````
Answer: 14
Is this correct? (y/n):
````
- **y** if the answer is correct.
- **n** and then provide the correct answer if the program made a mistake.
To exit, type **exit** or **quit**.
## Example Session
```
SelfCorrecting Agent
Type … (truncated for brevity)
```