Release Notes - v1.12.0
Executive Summary
The release includes substantial refactoring across core packages to improve separation of concerns, eliminate technical debt, and achieve better performance characteristics.Breaking Changes
instructor Package
- Removed
CanExecuteStructuredOutputinterface - Replaced with dual-interface architecture:CanStreamStructuredOutputUpdates(stream-level iteration) andCanHandleStructuredOutputAttempts(attempt-level orchestration) - Removed
IterativeToGeneratorAdapter- All execution now flows through unifiedAttemptIteratorwith specialized stream iterators - Request handler hierarchy replaced -
RequestHandler,SyncRequestHandler,PartialStreamingRequestHandlerremoved in favor of stream iterator pattern
addons Package
- Namespace reorganization - Shared components moved from
StepByStepto domain-specific namespaces:- Chat traits moved to
Chat/StateandChat/Stepnamespaces - Selector implementations moved to dedicated subdirectories
- Chat traits moved to
polyglot Package
- Default HTTP client changed - Changed from
guzzletocurlpreset to make it easy to use Instructor out of the box
utils Package
ProgrammingLanguageis now an enum - Changed from class toenum ProgrammingLanguage : string; direct instantiation patterns will break
New Features
Native cURL HTTP Driver (http-client)
Zero-dependency HTTP functionality using PHP’s built-in cURL:- CurlDriver: Full HTTP method support with custom headers, timeouts, SSL verification
- Concurrent requests:
CurlPoolusingcurl_multifor parallel execution - Streaming support:
CurlStreamingHttpResponsewith real-time chunked delivery - Event integration: Full support for
HttpRequestSent,HttpResponseReceived,HttpRequestFailed - Comprehensive tests: Integration tests covering GET/POST, headers, errors, timeouts, streaming
Major Improvements
Unified Streaming Architecture (instructor)
Code refactoring achieving O(1) memory usage and consistent execution model:- Stream iterator pattern: Three specialized implementations (
SyncUpdateGenerator,PartialStreamingUpdateGenerator,StreamingUpdatesGenerator) with unified contract - AttemptIterator orchestration: Single code path for sync and streaming with validation, retries, failure recovery
- Transducer-based pipeline: Pure transformation stages (delta extraction, JSON assembly, deserialization, deduplication, sequence tracking) using immutable state
- Rolling aggregation: Eliminated accumulation of all partial responses
- Robust retry handling:
DefaultRetryPolicywith flexible logic for validation failures, connection errors, rate limits - Enhanced state management:
StructuredOutputAttemptStateandAttemptPhaseenum for explicit progress tracking
ToolUse Refactoring (addons)
Significant architectural improvements with better separation of concerns:- ReAct driver decomposition: Extracted into action classes (
MakeReActPrompt,MakeToolCalls) and validation layer (ReActValidator) - Improved data structures:
DecisionWithDetails,ReActDecisionimplementingDecisioncontract - Better error handling: Structured validation results with comprehensive decision validation
- Formatter extraction:
ReActFormatterutility for output formatting - Reorganized continuation: Moved to
ContinuationCriteriasubdirectory - Executor abstraction:
CanExecuteToolCallscontract
Chat Improvements (addons)
Enhanced code organization and reusability:- Extracted traits:
HandlesChatSteps,HandlesChatCompletion,HasChatCompletionfor state and step management - Reorganized selectors: Moved to dedicated namespaces (
RoundRobin,LLMSelector) - Enhanced state management: Dedicated step handling
New LLM Provider Support
Inception Inference Provider (polyglot)
- InceptionDriver: Complete inference driver supporting Inception API
Bug Fixes & Quality Improvements
Stream Completion Handling (stream)
- Fixed completion phase: Added
transduction->completed()call to flush remaining values - Stateful transformations: Properly finalize and emit accumulated data at stream end
- Data loss prevention: Ensures buffered data is not lost on stream termination
Type Safety Improvements (utils)
- PartialJsonParser: Enhanced type safety ensuring
parse()always returnsarray|objectas declared - Metadata: Added
withMergedData(array $data)method for batch updates
Static Analysis (addons)
- Fixed Psalm/PHPStan issues: Resolved static analysis warnings throughout
- Improved transducer stability: Enhanced streaming driver reliability
- Better error handling: Comprehensive error handling in ReActDriver
Migration Guide
For instructor Users
- No action required for public API users - changes are internal
- Custom implementations of
CanExecuteStructuredOutputmust migrate to new dual-interface architecture - Streaming behavior is now more consistent with better memory efficiency
For polyglot Users
- Verify HTTP behavior if relying on Guzzle-specific features
- Update configuration to explicitly specify
guzzlepreset if needed:'preset' => 'guzzle'
For utils Users
- Update
ProgrammingLanguageusage from class to enum syntax - Example:
ProgrammingLanguage::PHPinstead ofnew ProgrammingLanguage('PHP') - Consider SafeSandbox for any untrusted code execution needs