Discover and explore top open-source AI tools and projects—updated daily.
PHP library for structured data extraction using LLMs
Top 92.5% on SourcePulse
Instructor for PHP enables structured data extraction from LLM outputs, simplifying integration for PHP developers. It handles complex data parsing, validation, and retries, allowing users to focus on application logic rather than LLM response handling.
How It Works
Instructor leverages PHP's type hinting and reflection capabilities to define data structures. It translates these structures into schemas for LLMs, automatically validates responses against these schemas, and manages retries with LLM feedback for invalid outputs. This approach reduces boilerplate code and improves the reliability of LLM-driven data extraction.
Quick Start & Requirements
composer require cognesy/instructor-php
Highlighted Details
Maintenance & Community
The project is actively maintained by cognesy. Community support is available via Twitter and GitHub. Contributions are welcomed.
Licensing & Compatibility
Limitations & Caveats
Instructor relies on PHP DocBlocks for certain advanced features like type hints for arrays and additional LLM instructions, which may require adherence to specific documentation conventions. The library is inspired by Python's Pydantic, but PHP's ecosystem lacks a direct equivalent, leading to reliance on a combination of PHP features and external components for its functionality.
4 days ago
1 day