diff --git a/README.md b/README.md index b18683b..db493f7 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,36 @@ -# Парсер заданий: сырой текст -> TaskCard +# Task 69dd4221f309a98be0006b2e – Structured Assignment Card -## Описание -Инструмент для преобразования неформального описания учебного задания в структурированную карточку TaskCard. +## What this project does +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 -| Поле | Тип | Описание | -|------|-----|----------| -| title | str | Краткое название | -| subject | str | Тема/предмет | -| deadline | str? | Срок сдачи | -| deliverable | str | Что сдавать | -| requirements | list[str] | Требования | -| difficulty | str | Сложность | -| grading_criteria | str? | Критерии оценки | -| tags | list[str] | Теги | +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. -## Установка +## 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 pip install -r requirements.txt ``` +Make sure you have an OpenAI compatible key set in `JOURNAL_MCP_PAT` environment variable (the BroJS endpoint). -## Использование -```bash -python main.py -``` - -Или программно: +## Usage examples ```python -from parser import TaskParser -parser = TaskParser() -card = parser.parse("Напишите отчёт по LangChain до пятницы, 5 страниц") -print(card.to_markdown()) +from agent import parse_assignment + +text = "Сдайте к пятнице мини-отчёт по LangChain: 2 страницы, упор на агентов. Оценка: за полноту и за пример кода." +card = parse_assignment(text) +print(card.model_dump()) ``` -## Пример вывода -```markdown -## Отчёт по LangChain -**Предмет:** LangChain / Python -**Дедлайн:** пятница -**Сдать:** отчёт (5 страниц) -**Требования:** -- Объём 5 страниц -**Сложность:** средне -**Теги:** langchain, отчёт, python -``` +## Architecture +1. **PromptTemplate** – contains a short instruction and the format instructions from `PydanticOutputParser`. +2. **ChatOpenAI** – calls BroJS LLM. +3. **PydanticOutputParser** – validates that the model output matches the schema. +4. The chain is a simple *prompt → llm → parser* pipeline. + +The code is intentionally straightforward to keep the focus on structured output generation.