Lifecycle¶
As Instructor for PHP processes your request, it goes through several stages:
- Initialize and self-configure (with possible overrides defined by developer).
- Analyze classes and properties of the response data model specified by developer.
- Encode data model into a schema that can be provided to LLM.
- Execute request to LLM using specified messages (content) and response model metadata.
- Receive a response from LLM or multiple partial responses (if streaming enabled).
- Deserialize response received from LLM into originally requested classes and their properties.
- In case response contained incomplete or corrupted data - if errors are encountered, create feedback message for LLM and requests regeneration of the response.
- Execute validations defined by developer for the data model - if any of them fail, create feedback message for LLM and requests regeneration of the response.
- Repeat the steps 4-8, unless specified limit of retries has been reached or response passes validation