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

This commit is contained in:
2026-06-28 12:46:52 +03:00
parent 7dd5a51872
commit f5594c25c5
3 changed files with 47 additions and 76 deletions
+26 -76
View File
@@ -1,84 +1,34 @@
# Assignment Card Extraction
# Экзамен: Самокорректирующийся агент
This project demonstrates how to convert a natural language assignment description into a structured data object using **LangChain** and **Pydantic**.
Главная
Мои задания
Экзамен: Самокорректирующийся агент
EN
Экзамен: Самокорректирующийся агент
Зачёт
Версия 1
Дедлайн сдачи: 31.08.2026
## Features
В работе
- Parses assignment details such as title, subject, deadline, deliverable type, and grading hints.
- Uses OpenAI's GPT model to interpret freeform text.
- Validates the output with a Pydantic model to ensure type safety.
Редактирование ответа
## Prerequisites
Заполните ответ и отправьте работу на проверку преподавателю.
- Python 3.10 or newer
- An OpenAI API key
Тип ответа
Текст
Ссылка
Файлы
Текст ответа
Прикреплённые файлы
Загрузить файл
Отправить на проверку
Отменить
## Setup
Задание
1. **Clone the repository** (or copy the files into a directory):
Практическое задание: Самокорректирующийся агент
Цель
```bash
git clone https://github.com/your-username/assignment-card-extractor.git
cd assignment-card-extractor
```
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. **Configure the OpenAI API key**:
- Open the `.env` file.
- Replace `your_openai_api_key_here` with your actual key.
```dotenv
OPENAI_API_KEY=sk-XXXXXXXXXXXXXXXXXXXX
```
## Running the Example
```bash
python src/main.py
```
You should see output similar to:
```
=== Parsed Assignment Card ===
{
"title": "Мини-отчёт по LangChain",
"subject": "LangChain",
"deadline_hint": "к пятнице",
"deliverable_type": "отчёт",
"grading_hints": [
"полнота",
"пример кода"
]
}
=== Human-readable Summary ===
Title: Мини-отчёт по LangChain
Subject: LangChain
Deadline: к пятнице
Deliverable: отчёт
Grading Hints: полнота, пример кода
```
## Customization
- **Change the LLM**: Edit `src/main.py` to use a different model or adjust temperature.
- **Add more fields**: Update the `AssignmentCard` model and the prompt template accordingly.
- **Use in a pipeline**: Import the `chain` object from `src/main.py` into your own application.
## License
MIT License
Реализовать LangGraph-агента, который после выполнения задачи проверяет результат (LLM-as-