31fb3c8921c5c1b257db7d8cb7ea3f0b1918bfa6
Task 69dd4221f309a98be0006b2e – Structured Assignment Card
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.
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
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
from agent import parse_assignment
text = "Сдайте к пятнице мини-отчёт по LangChain: 2 страницы, упор на агентов. Оценка: за полноту и за пример кода."
card = parse_assignment(text)
print(card.model_dump())
Architecture
- PromptTemplate – contains a short instruction and the format instructions from
PydanticOutputParser. - ChatOpenAI – calls BroJS LLM.
- PydanticOutputParser – validates that the model output matches the schema.
- The chain is a simple prompt → llm → parser pipeline.
The code is intentionally straightforward to keep the focus on structured output generation.
Description
Languages
Python
100%