Overview
The structured-output package itself does not depend on a published configuration path. At the package boundary, configuration is passed as typed objects (LLMConfig, StructuredOutputConfig, StructuredOutputRuntime).
Configuration path resolution matters when you load LLM provider presets from
YAML files. This page explains how that resolution works.
Preset-Based Configuration
Load a named preset to create anLLMConfig:
Path Resolution Order
When no explicit base path is given,LLMConfig::fromPreset() searches the
following locations (in order) and uses the first one that exists:
config/llm/presets/— project-level published presetspackages/polyglot/resources/config/llm/presets/— monorepo locationvendor/cognesy/instructor-php/packages/polyglot/resources/config/llm/presets/— Composer install (monorepo package)vendor/cognesy/instructor-polyglot/resources/config/llm/presets/— Composer install (standalone package)
Environment Variable
You can set theINSTRUCTOR_CONFIG_PATHS environment variable in your .env file
to tell the broader InstructorPHP ecosystem where to find configuration files:
LLMConfig
preset resolution or explicit configuration objects.
Key Types at the Package Boundary
| Type | Purpose |
|---|---|
LLMConfig | Provider connection settings (API URL, key, model, driver) |
StructuredOutputConfig | Structured output behavior (output mode, retries, prompts) |
StructuredOutputRuntime | Assembled runtime with inference provider and event handling |