add README.md

This commit is contained in:
2026-05-27 13:54:37 +00:00
parent 70726c1935
commit 58a12482a2
+26 -36
View File
@@ -1,46 +1,36 @@
# Парсер заданий: сырой текст -> TaskCard # Task 69dd4221f309a98be0006b2e Structured Assignment Card
## Описание ## What this project does
Инструмент для преобразования неформального описания учебного задания в структурированную карточку TaskCard. This repository contains a small Python package that turns an informal assignment description into a **structured data card**. The card is represented by a Pydantic model and can be used downstream in pipelines for filtering, storage or further processing.
## Структура TaskCard The core logic lives in `models.py` (the data schema) and `agent.py` (the LangChain chain that calls the LLM). The entry point `main.py` demonstrates three different example inputs.
| Поле | Тип | Описание |
|------|-----|----------|
| title | str | Краткое название |
| subject | str | Тема/предмет |
| deadline | str? | Срок сдачи |
| deliverable | str | Что сдавать |
| requirements | list[str] | Требования |
| difficulty | str | Сложность |
| grading_criteria | str? | Критерии оценки |
| tags | list[str] | Теги |
## Установка ## File structure
- **requirements.txt** Python dependencies required to run the code.
- **README.md** this documentation file.
- **models.py** Pydantic model for the assignment card.
- **agent.py** LangChain chain that parses a raw text into the model.
- **main.py** example usage and simple CLI.
## Installation
```bash ```bash
pip install -r requirements.txt pip install -r requirements.txt
``` ```
Make sure you have an OpenAI compatible key set in `JOURNAL_MCP_PAT` environment variable (the BroJS endpoint).
## Использование ## Usage examples
```bash
python main.py
```
Или программно:
```python ```python
from parser import TaskParser from agent import parse_assignment
parser = TaskParser()
card = parser.parse("Напишите отчёт по LangChain до пятницы, 5 страниц") text = "Сдайте к пятнице мини-отчёт по LangChain: 2 страницы, упор на агентов. Оценка: за полноту и за пример кода."
print(card.to_markdown()) card = parse_assignment(text)
print(card.model_dump())
``` ```
## Пример вывода ## Architecture
```markdown 1. **PromptTemplate** contains a short instruction and the format instructions from `PydanticOutputParser`.
## Отчёт по LangChain 2. **ChatOpenAI** calls BroJS LLM.
**Предмет:** LangChain / Python 3. **PydanticOutputParser** validates that the model output matches the schema.
**Дедлайн:** пятница 4. The chain is a simple *prompt → llm → parser* pipeline.
**Сдать:** отчёт (5 страниц)
**Требования:** The code is intentionally straightforward to keep the focus on structured output generation.
- Объём 5 страниц
**Сложность:** средне
**Теги:** langchain, отчёт, python
```