|
|
||
|---|---|---|
| .. | ||
| README.md | ||
| data.txt | ||
| main.py | ||
| requirements.txt | ||
| utils.py | ||
README.md
Structured Output Demo
A minimal demo application showing how to use PocketFlow to extract structured data from a resume using direct prompting and YAML formatting. Why YAML? Check out the doc.
This implementation is based on: Structured Output for Beginners: 3 Must-Know Prompting Tips.
Features
- Extracts structured data using prompt engineering
- Validates output structure before processing
Run It
-
Install the packages you need with this simple command:
pip install -r requirements.txt -
Make sure your OpenAI API key is set:
export OPENAI_API_KEY="your-api-key-here"Alternatively, you can edit the
utils.pyfile to include your API key directly.Let's do a quick check to make sure your API key is working properly:
python utils.py -
Edit data.txt with the resume you want to parse (a sample resume is already included)
-
Run the application:
python main.py
How It Works
flowchart LR
parser[ResumeParserNode]
The Resume Parser application uses a single node that:
- Takes resume text from the shared state (loaded from data.txt)
- Sends the resume to an LLM with a prompt that requests YAML formatted output
- Extracts and validates the structured YAML data
- Outputs the structured result
Files
main.py: Implementation of the ResumeParserNodeutils.py: LLM utilitiesdata.txt: Sample resume text file
Example Output
=== Resume Parser - Structured Output with Indexes & Comments ===
=== STRUCTURED RESUME DATA (Comments & Skill Index List) ===
name: JOHN SMTIH
email: johnsmtih1983@gnail.com
experience:
- {title: SALES MANAGER, company: ABC Corportaion}
- {title: ASST. MANAGER, company: XYZ Industries}
- {title: CUSTOMER SERVICE REPRESENTATIVE, company: Fast Solutions Inc}
skill_indexes: [0, 1, 2, 3, 4]
============================================================
✅ Extracted resume information.
--- Found Target Skills (from Indexes) ---
- Team leadership & management (Index: 0)
- CRM software (Index: 1)
- Project management (Index: 2)
- Public speaking (Index: 3)
- Microsoft Office (Index: 4)
----------------------------------------