Update README.md

This commit is contained in:
2026-06-04 23:19:41 +00:00
parent c41664bd91
commit 289da3c25c
+48 -2
View File
@@ -1,3 +1,49 @@
# task-6a1865008a94f887e50d471c
# Structured Output Extraction with LangChain & Pydantic
Экзамен: Структурированный вывод (Pydantic)
This repository demonstrates how to extract structured data from freeform text using **LangChain** and **Pydantic**. Two schemas are supported:
1. **PersonInfo** name, optional age, profession, skills.
2. **MeetingNotes** date, participants, topics, decisions, next steps.
The extraction is performed in a single LLM call with a prompt that includes the JSON schema. The result is parsed into a validated Pydantic model.
## Requirements
```text
langchain>=1.0.0
langchain-openai>=0.0.0
pydantic>=2.0.0
python-dotenv
```
Install with:
```bash
pip install -r requirements.txt
```
## Usage
```bash
# Person example
python main.py "Анна, 28 лет, Python-разработчик. Навыки: FastAPI, Docker."
# Meeting example
python main.py "Meeting on 2024-10-01. Participants: Alice, Bob. Topics: Budget, Timeline. Decisions: Increase budget. Next steps: Prepare report."
```
The script will automatically detect the type of text and output the parsed Pydantic model.
## Running from the CLI
You can also run the script interactively:
```bash
python main.py
Enter text (or press Ctrl-D to exit):
Анна, 28 лет, Python-разработчик. Навыки: FastAPI, Docker.
```
## License
MIT