# Instructor for PHP > The complete AI toolkit for PHP: call 25+ LLM providers through one API with Polyglot (inference, embeddings, and typed decision models), turn responses into validated PHP objects with Instructor, build tool-using agents with Agents, and orchestrate CLI coding agents with AgentCtrl. ## Main - [Overview](https://instructorphp.com/llms/index.md): A modular PHP toolkit for LLM inference, structured outputs, agents, and coding-agent control. - [Getting Started](https://instructorphp.com/llms/getting-started.md) - [Features](https://instructorphp.com/llms/features.md) - [Packages](https://instructorphp.com/llms/packages.md) - [Use Cases](https://instructorphp.com/llms/use-cases.md) - [Why Instructor](https://instructorphp.com/llms/why-instructor.md) ## Packages - [Overview](https://instructorphp.com/llms/packages/index.md) ### Instructor - [Introduction](https://instructorphp.com/llms/packages/instructor/introduction.md): Structured data extraction in PHP, powered by LLMs. Designed for simplicity, transparency, and control. - [Quickstart](https://instructorphp.com/llms/packages/instructor/quickstart.md): Extract structured data from LLM responses in under 5 minutes. - [Setup](https://instructorphp.com/llms/packages/instructor/setup.md): Install the package and configure your LLM provider. - [Testing Doubles](https://instructorphp.com/llms/packages/instructor/testing-doubles.md): Deterministic testing seams for structured output. - [Upgrade](https://instructorphp.com/llms/packages/instructor/upgrade.md): Migrate structured-output applications to the current API. - [Cli Tools](https://instructorphp.com/llms/packages/instructor/cli_tools.md): Command-line tools related to the broader InstructorPHP project. ### Instructor / Concepts - [Overview](https://instructorphp.com/llms/packages/instructor/concepts/overview.md): The core concepts behind Instructor's structured output extraction. - [Why](https://instructorphp.com/llms/packages/instructor/concepts/why.md): Why a schema-first approach to LLM output is easier, safer, and more productive. ### Instructor / Essentials - [Usage](https://instructorphp.com/llms/packages/instructor/essentials/usage.md): The day-to-day API for structured output. - [Data Model](https://instructorphp.com/llms/packages/instructor/essentials/data_model.md): Choose the shape you want back from the model. - [Validation](https://instructorphp.com/llms/packages/instructor/essentials/validation.md): Validate extracted data before you use it. - [Modes](https://instructorphp.com/llms/packages/instructor/essentials/modes.md): Choose how Instructor asks the model for structured output. - [Scalars](https://instructorphp.com/llms/packages/instructor/essentials/scalars.md): Extract one value without creating a full class. - [Demonstrations](https://instructorphp.com/llms/packages/instructor/essentials/demonstrations.md): Guide the model with a small number of examples. - [Customize Prompts](https://instructorphp.com/llms/packages/instructor/essentials/customize_prompts.md): Add system text, prompt text, and cached context. - [Configuration](https://instructorphp.com/llms/packages/instructor/essentials/configuration.md): Keep provider, runtime, and request configuration separate. ### Instructor / Advanced - [Partials](https://instructorphp.com/llms/packages/instructor/advanced/partials.md): Read streaming updates as the response is built. - [Sequences](https://instructorphp.com/llms/packages/instructor/advanced/sequences.md): Extract collections of typed objects. - [Structures](https://instructorphp.com/llms/packages/instructor/advanced/structures.md): Define dynamic data shapes at runtime without PHP classes. - [Function Calls](https://instructorphp.com/llms/packages/instructor/advanced/function_calls.md): Extract function and method arguments from natural language using LLMs. - [Manual Schemas](https://instructorphp.com/llms/packages/instructor/advanced/manual_schemas.md): Build JSON schemas programmatically without PHP classes. - [Json Extraction](https://instructorphp.com/llms/packages/instructor/advanced/json_extraction.md): How Instructor recovers structured data from LLM responses. - [Output Formats](https://instructorphp.com/llms/packages/instructor/advanced/output_formats.md): Keep one schema and choose how the result is materialized. - [Prompts](https://instructorphp.com/llms/packages/instructor/advanced/prompts.md): Control system messages, user prompts, examples, and cached context. - [Model Options](https://instructorphp.com/llms/packages/instructor/advanced/model_options.md): Control the LLM provider, model, and request options. - [Structure To Structure](https://instructorphp.com/llms/packages/instructor/advanced/structure-to-structure.md): Use structured data as input for LLM-driven transformations. ### Instructor / Techniques - [Prompting](https://instructorphp.com/llms/packages/instructor/techniques/prompting.md): Prompting guidelines and structural patterns for better structured output. - [Classification](https://instructorphp.com/llms/packages/instructor/techniques/classification.md): Use enums and response models to turn text into categories with LLM-powered classification. - [Search](https://instructorphp.com/llms/packages/instructor/techniques/search.md): Turn natural-language requests into structured search queries. ### Instructor / Internals - [Instructor](https://instructorphp.com/llms/packages/instructor/internals/instructor.md): The main public types in the package. - [Lifecycle](https://instructorphp.com/llms/packages/instructor/internals/lifecycle.md): What happens between request creation and the final result. - [Configuration Path](https://instructorphp.com/llms/packages/instructor/internals/configuration_path.md): How configuration paths are resolved for provider presets. - [Config Files](https://instructorphp.com/llms/packages/instructor/internals/config_files.md): What configuration files do and do not belong to this package. - [Settings Class](https://instructorphp.com/llms/packages/instructor/internals/settings_class.md): There is no single global settings object in this package. - [Environment](https://instructorphp.com/llms/packages/instructor/internals/environment.md): Where environment variables matter. - [Events](https://instructorphp.com/llms/packages/instructor/internals/events.md): Observe requests and streaming updates. - [Response Models](https://instructorphp.com/llms/packages/instructor/internals/response_models.md): How schemas are derived from the target type. - [Debugging](https://instructorphp.com/llms/packages/instructor/internals/debugging.md): The fastest ways to inspect what happened. ### Instructor / Misc - [Help](https://instructorphp.com/llms/packages/instructor/misc/help.md): Where to ask questions, report issues, and find resources. - [Llm Providers](https://instructorphp.com/llms/packages/instructor/misc/llm_providers.md): Supported LLM API providers and how to select them. - [Philosophy](https://instructorphp.com/llms/packages/instructor/misc/philosophy.md): The principles behind Instructor PHP. - [Contributing](https://instructorphp.com/llms/packages/instructor/misc/contributing.md): Where to look when changing this package or its docs. ### Polyglot - [Overview](https://instructorphp.com/llms/packages/polyglot/overview.md): Polyglot is the low-level LLM transport layer for InstructorPHP, providing a unified API for interacting with multiple LLM and embeddings providers. - [Quickstart](https://instructorphp.com/llms/packages/polyglot/quickstart.md): Get up and running with Polyglot in under 5 minutes. - [Setup](https://instructorphp.com/llms/packages/polyglot/setup.md): Install Polyglot and configure it for your PHP project. - [Testing Doubles](https://instructorphp.com/llms/packages/polyglot/testing-doubles.md): Deterministic testing seams for inference, embeddings, and decisions. - [Upgrade](https://instructorphp.com/llms/packages/polyglot/upgrade.md): Migrate applications and custom drivers across Polyglot breaking changes. ### Polyglot / Essentials - [Overview](https://instructorphp.com/llms/packages/polyglot/essentials/overview.md): How to use the Inference facade for LLM API access, text generation, streaming, and provider switching. - [Inference Class](https://instructorphp.com/llms/packages/polyglot/essentials/inference-class.md): The primary facade for making LLM requests -- creation, configuration, and execution. - [Creating Requests](https://instructorphp.com/llms/packages/polyglot/essentials/creating-requests.md): Build inference requests with messages, models, and options using the fluent API. - [Reasoning](https://instructorphp.com/llms/packages/polyglot/essentials/reasoning.md): Select model-aware reasoning modes, effort levels, and token budgets through one portable API. - [Request Options](https://instructorphp.com/llms/packages/polyglot/essentials/request-options.md): Customize provider-specific request fields, retry policies, caching, and advanced options. - [Response Handling](https://instructorphp.com/llms/packages/polyglot/essentials/response-handling.md): Work with `PendingInference`, `InferenceResponse`, and streaming to consume LLM output in the format your application needs. ### Polyglot / Modes - [Overview](https://instructorphp.com/llms/packages/polyglot/modes/overview.md): Control how LLM providers structure their output using native request fields. - [Tools](https://instructorphp.com/llms/packages/polyglot/modes/tools.md): Request native tool calls with explicit tool definitions and process the results. - [Json Schema](https://instructorphp.com/llms/packages/polyglot/modes/json-schema.md): Request native schema-constrained JSON when the provider supports it. - [Json](https://instructorphp.com/llms/packages/polyglot/modes/json.md): Ask the provider for native JSON object output using the response format field. - [Md Json](https://instructorphp.com/llms/packages/polyglot/modes/md-json.md): Markdown-wrapped JSON is handled by Instructor, not by Polyglot directly. - [Text](https://instructorphp.com/llms/packages/polyglot/modes/text.md): Plain text is the default inference path -- no configuration required. ### Polyglot / Streaming - [Overview](https://instructorphp.com/llms/packages/polyglot/streaming/overview.md): Stream LLM response deltas as they arrive for real-time output. - [Misc](https://instructorphp.com/llms/packages/polyglot/streaming/misc.md): Transform, filter, and aggregate streaming deltas with built-in helpers. ### Polyglot / Batch Inference - [Overview](https://instructorphp.com/llms/packages/polyglot/batch-inference/overview.md): Submit native provider batch jobs and resume their asynchronous lifecycle. - [Submit And Resume](https://instructorphp.com/llms/packages/polyglot/batch-inference/submit-and-resume.md): Prepare keyed inference requests and retain a reference for another process. - [Status And Cancellation](https://instructorphp.com/llms/packages/polyglot/batch-inference/status-and-cancellation.md): Observe immutable job snapshots and request cancellation without assuming a final state. - [Results](https://instructorphp.com/llms/packages/polyglot/batch-inference/results.md): Read keyed successes and failures from partial or final provider artifacts. - [List Jobs](https://instructorphp.com/llms/packages/polyglot/batch-inference/list-jobs.md): Page through jobs in the configured provider and account scope. - [Providers](https://instructorphp.com/llms/packages/polyglot/batch-inference/providers.md): Provider operations, input forms, options, and model eligibility boundaries. - [Errors And Testing](https://instructorphp.com/llms/packages/polyglot/batch-inference/errors-and-testing.md): Handle uncertain submissions, safe retries, and deterministic batch tests. - [Internals And Removal](https://instructorphp.com/llms/packages/polyglot/batch-inference/internals-and-removal.md): Understand the isolated batch module, transport ownership, and reversal boundary. ### Polyglot / Embeddings - [Overview](https://instructorphp.com/llms/packages/polyglot/embeddings/overview.md): Generate vector embeddings through the Embeddings facade across multiple providers. - [Work With Embeddings](https://instructorphp.com/llms/packages/polyglot/embeddings/work-with-embeddings.md): Build requests, execute them, and work with vectors and responses. - [Optimization](https://instructorphp.com/llms/packages/polyglot/embeddings/optimization.md): Batch processing, retry policies, caching strategies, and best practices for production embeddings. ### Polyglot / Decision - [Overview](https://instructorphp.com/llms/packages/polyglot/decision/overview.md): Execute typed Noul, Choice, and Score questions through Polyglot's Decision API. - [Questions](https://instructorphp.com/llms/packages/polyglot/decision/questions.md): Model application judgments with Noul, Choice, Score, and structured state. - [Responses](https://instructorphp.com/llms/packages/polyglot/decision/responses.md): Read typed Decision answers, distributions, confidence, usage, and provider metadata. - [Runtime](https://instructorphp.com/llms/packages/polyglot/decision/runtime.md): Configure Decision presets, explicit runtimes, retries, events, and custom drivers. - [Classifier Dev](https://instructorphp.com/llms/packages/polyglot/decision/classifier-dev.md): Use classifier.dev dimensions for native Choice and projected Noul and Score decisions. - [Clef](https://instructorphp.com/llms/packages/polyglot/decision/clef.md): Run System One decisions on Cloudflare Workers AI with the Clef and Clef-flash models. - [Fastino](https://instructorphp.com/llms/packages/polyglot/decision/fastino.md): Answer typed System One questions with Fastino's GLiDE decision model. - [Jeff](https://instructorphp.com/llms/packages/polyglot/decision/jeff.md): Connect Decision to a self-hosted Jeff System One service. - [Laya](https://instructorphp.com/llms/packages/polyglot/decision/laya.md): Connect Decision to a separately deployed Typed Decision Lab service backed by MLX or PyTorch. - [Perplexity](https://instructorphp.com/llms/packages/polyglot/decision/perplexity.md): Answer typed System One questions with Perplexity's pplx-decider-v1-27b decision model. - [Respan](https://instructorphp.com/llms/packages/polyglot/decision/respan.md): Score conversation behaviors with RESPAN while preserving not-observable probability. - [Evaluation](https://instructorphp.com/llms/packages/polyglot/decision/evaluation.md): Compare Decision providers with labeled corpora, primitive-specific metrics, and operational evidence. - [Errors Testing](https://instructorphp.com/llms/packages/polyglot/decision/errors-testing.md): Handle Decision failures and test provider integrations without live API calls. ### Polyglot / Advanced - [Custom Config](https://instructorphp.com/llms/packages/polyglot/advanced/custom-config.md): Build config objects when presets are not enough. - [Custom Http Client](https://instructorphp.com/llms/packages/polyglot/advanced/custom-http-client.md): Inject your own HTTP transport into a runtime. - [Context Caching](https://instructorphp.com/llms/packages/polyglot/advanced/context-caching.md): Attach stable context to later requests for reduced token usage. - [Connection Mgmt](https://instructorphp.com/llms/packages/polyglot/advanced/connection-mgmt.md): Switch providers by changing presets, not request code. - [Json Schema](https://instructorphp.com/llms/packages/polyglot/advanced/json-schema.md): Use arrays or the schema builder to define structured response formats. - [Extending](https://instructorphp.com/llms/packages/polyglot/advanced/extending.md): Register custom drivers or build a runtime with your own wiring. ### Polyglot / Internals - [Overview](https://instructorphp.com/llms/packages/polyglot/internals/overview.md): How the public facades, runtimes, requests, and drivers fit together. - [Lifecycle](https://instructorphp.com/llms/packages/polyglot/internals/lifecycle.md): What happens between building a request and receiving the final response. - [Configuration](https://instructorphp.com/llms/packages/polyglot/internals/configuration.md): The config objects used to build runtimes and presets. - [Model Catalog](https://instructorphp.com/llms/packages/polyglot/internals/model-catalog.md): Exact, request-scoped model facts without provider guessing. - [Providers](https://instructorphp.com/llms/packages/polyglot/internals/providers.md): Provider objects are small config resolvers with optional explicit drivers. - [Adapters](https://instructorphp.com/llms/packages/polyglot/internals/adapters.md): How drivers translate between Polyglot data and provider payloads. - [Http Client](https://instructorphp.com/llms/packages/polyglot/internals/http-client.md): Polyglot depends on the shared Instructor HTTP transport. - [Request Response](https://instructorphp.com/llms/packages/polyglot/internals/request-response.md): The main data objects used by the package. - [Events](https://instructorphp.com/llms/packages/polyglot/internals/events.md): Runtime events are available for observability and debugging. - [Public Api](https://instructorphp.com/llms/packages/polyglot/internals/public-api.md): The main classes applications are expected to use. ### Polyglot / Troubleshooting - [Overview](https://instructorphp.com/llms/packages/polyglot/troubleshooting/overview.md): Common causes of broken requests in Polyglot and how to resolve them. - [Debugging](https://instructorphp.com/llms/packages/polyglot/troubleshooting/debugging.md): Use runtime events, wiretapping, and HTTP middleware to inspect requests and responses. - [Issues Connection](https://instructorphp.com/llms/packages/polyglot/troubleshooting/issues-connection.md): Diagnose and resolve network connectivity problems. - [Issues Authentication](https://instructorphp.com/llms/packages/polyglot/troubleshooting/issues-authentication.md): Diagnose and resolve API key and credential problems. - [Issues Configuration](https://instructorphp.com/llms/packages/polyglot/troubleshooting/issues-configuration.md): Diagnose and resolve preset loading and configuration problems. - [Issues Rate Limits](https://instructorphp.com/llms/packages/polyglot/troubleshooting/issues-rate-limits.md): Diagnose and handle provider rate limiting and quota issues. - [Issues Streaming](https://instructorphp.com/llms/packages/polyglot/troubleshooting/issues-streaming.md): Diagnose and resolve streaming response problems. - [Issues Model Specific](https://instructorphp.com/llms/packages/polyglot/troubleshooting/issues-model-specific.md): Diagnose and resolve issues caused by differences in model capabilities. - [Issues Provider Specific](https://instructorphp.com/llms/packages/polyglot/troubleshooting/issues-provider-specific.md): Diagnose and resolve issues unique to individual LLM providers. ### Agents - [Introduction](https://instructorphp.com/llms/packages/agents/01-introduction.md): Overview of the Agents SDK for building LLM-powered agents that reason and act through tool use - [Basic Agent](https://instructorphp.com/llms/packages/agents/02-basic-agent.md): Create your first agent with AgentLoop, add tools, customize drivers, and understand the execution lifecycle - [Basic Concepts](https://instructorphp.com/llms/packages/agents/03-basic-concepts.md): Core components of the agent system: AgentLoop, AgentState, AgentContext, AgentStep, and ExecutionState - [Controlling The Loop](https://instructorphp.com/llms/packages/agents/04-controlling-the-loop.md): Run agents to completion with execute() or step through with iterate() for fine-grained control - [Tools](https://instructorphp.com/llms/packages/agents/05-tools.md): Register and use tools that let agents take actions based on LLM decisions - [Building Tools](https://instructorphp.com/llms/packages/agents/06-building-tools.md): Step-by-step guide to building tools with FunctionTool, BaseTool, and FakeTool - [Context And Compilers](https://instructorphp.com/llms/packages/agents/07-context-and-compilers.md): Manage conversation data with AgentContext and control message compilation for LLM calls - [Hooks](https://instructorphp.com/llms/packages/agents/08-hooks.md): Intercept agent lifecycle events for logging, guards, state modification, and tool blocking - [Stop Conditions](https://instructorphp.com/llms/packages/agents/09-stop-conditions.md): Control when the agent loop stops using stop signals, continuation logic, and exceptions - [Testing](https://instructorphp.com/llms/packages/agents/10-testing.md): Test agents deterministically using FakeAgentDriver and FakeTool without LLM calls - [State Internals](https://instructorphp.com/llms/packages/agents/11-state-internals.md): Deep dive into AgentState structure, execution tracking, message metadata, and serialization - [Tool Calling Internals](https://instructorphp.com/llms/packages/agents/12-tool-calling-internals.md): How ToolCallingDriver, ReActDriver, and ToolExecutor implement tool use through different strategies - [Agent Builder](https://instructorphp.com/llms/packages/agents/13-agent-builder.md) - [Agent Templates](https://instructorphp.com/llms/packages/agents/14-agent-templates.md) - [Subagents](https://instructorphp.com/llms/packages/agents/15-subagents.md) - [Session Runtime](https://instructorphp.com/llms/packages/agents/16-session-runtime.md) - [Building Tools Advanced](https://instructorphp.com/llms/packages/agents/17-building-tools-advanced.md): Lower-level tool patterns: context-aware tools, descriptors, registries, and deferred tools - [Observing Agent Execution](https://instructorphp.com/llms/packages/agents/18-observing-agent-execution.md) - [Skills](https://instructorphp.com/llms/packages/agents/19-skills.md): Extend agents with reusable, portable skill modules following the Agent Skills Open Standard - [Self Knowledge](https://instructorphp.com/llms/packages/agents/20-self-knowledge.md) - [Evals](https://instructorphp.com/llms/packages/agents/21-evals.md): Write, run, and interpret behavioral evals that grade an agent target with deterministic assertions and semantic judges - [Eval Assertions](https://instructorphp.com/llms/packages/agents/22-eval-assertions.md): The deterministic assertion catalogue for agent evals: outcome, trajectory, event, step, and cost checks, and when they must be trusted over a judge - [Eval Judges](https://instructorphp.com/llms/packages/agents/23-eval-judges.md): Grade agent behavior semantically with a lightweight or agentic judge, the terminal submission protocol, guard configuration, and the honest limits of injection scoping - [Eval Traces And Artifacts](https://instructorphp.com/llms/packages/agents/24-eval-traces-and-artifacts.md): The EvalStep/AgentRun trace projection, the safe-by-default trace policy, the artifact layout written to disk, and the provenance and cost data that make one eval score comparable to another - [Running Evals](https://instructorphp.com/llms/packages/agents/25-running-evals.md): The agents-eval CLI, reading compact and verbose output, verdicts and exit codes for CI, why a single run is not a measurement, and wiring evals into PHPUnit and Pest - [Testing Doubles](https://instructorphp.com/llms/packages/agents/testing-doubles.md): A quick map of the deterministic testing facilities in Agents. ### Agent-ctrl - [Overview](https://instructorphp.com/llms/packages/agent-ctrl/1-overview.md): Agent-Ctrl provides a unified, fluent PHP API for orchestrating CLI-based code agents such as Claude Code, OpenAI Codex, OpenCode, and Pi. - [Getting Started](https://instructorphp.com/llms/packages/agent-ctrl/2-getting-started.md): Install Agent-Ctrl, send your first prompt to a CLI-based code agent, and learn the basic configuration options available across all bridges. - [Testing Doubles](https://instructorphp.com/llms/packages/agent-ctrl/testing-doubles.md): Deterministic testing seams for AgentCtrl. - [Streaming](https://instructorphp.com/llms/packages/agent-ctrl/3-streaming.md): Receive real-time text output, tool activity, completion events, and streamed errors from any CLI-based code agent while it is still running. - [Session Management](https://instructorphp.com/llms/packages/agent-ctrl/4-session-management.md): Continue the most recent agent session or resume a specific session by ID to maintain conversational context across multiple executions. - [Agent Options](https://instructorphp.com/llms/packages/agent-ctrl/5-agent-options.md): Configure shared builder options available on every agent and provider-specific options unique to Claude Code, Codex, OpenCode, Pi, and Gemini. - [Response Object](https://instructorphp.com/llms/packages/agent-ctrl/6-response-object.md): Read text output, session identifiers, token usage, cost, tool calls, and parse diagnostics from the unified AgentResponse returned by every execution. - [Troubleshooting](https://instructorphp.com/llms/packages/agent-ctrl/7-troubleshooting.md): Diagnose and resolve common setup, execution, streaming, and parsing problems when using Agent-Ctrl with CLI-based code agents. - [Claude Code Bridge](https://instructorphp.com/llms/packages/agent-ctrl/8-claude-code-bridge.md): Use the Claude Code bridge for general coding workflows with system prompts, turn limits, permission controls, verbose streaming, and multi-directory access. - [Codex Bridge](https://instructorphp.com/llms/packages/agent-ctrl/9-codex-bridge.md): Use the Codex bridge for OpenAI Codex with sandbox controls, auto-approval modes, image input, and thread-based session management. - [Opencode Bridge](https://instructorphp.com/llms/packages/agent-ctrl/10-opencode-bridge.md): Use the OpenCode bridge for flexible model selection with provider-prefixed IDs, named agents, file attachments, session sharing, and cost tracking. - [Pi Bridge](https://instructorphp.com/llms/packages/agent-ctrl/11-pi-bridge.md): Use the Pi bridge for a minimal, extensible coding agent with thinking levels, multi-provider models, TypeScript extensions, skills, and granular JSONL event streaming. - [Gemini Bridge](https://instructorphp.com/llms/packages/agent-ctrl/12-gemini-bridge.md): Use the Gemini bridge for Google's CLI coding agent with model aliases, approval modes, sandbox, extensions, MCP servers, and granular stream-json event streaming. ### Telemetry - [Introduction](https://instructorphp.com/llms/packages/telemetry/01-introduction.md): What the Telemetry package does and where it fits in the runtime stack - [Basic Setup](https://instructorphp.com/llms/packages/telemetry/02-basic-setup.md): Create a telemetry instance, record a span, and flush it - [Runtime Wiring](https://instructorphp.com/llms/packages/telemetry/03-runtime-wiring.md): Attach telemetry to a shared event bus with projectors and RuntimeEventBridge - [Troubleshooting](https://instructorphp.com/llms/packages/telemetry/04-troubleshooting.md): Common telemetry setup problems and how to debug them - [Langfuse](https://instructorphp.com/llms/packages/telemetry/05-langfuse.md): Minimal setup for exporting telemetry to Langfuse - [Logfire](https://instructorphp.com/llms/packages/telemetry/06-logfire.md): Minimal setup for exporting telemetry to Logfire ### Sandbox - [Overview](https://instructorphp.com/llms/packages/sandbox/1-overview.md): Sandboxed command execution with pluggable drivers, immutable execution policies, and real-time output streaming. - [Getting Started](https://instructorphp.com/llms/packages/sandbox/2-getting-started.md): Run your first sandboxed command in three steps: create a policy, pick a driver, and execute. - [Execution Policy](https://instructorphp.com/llms/packages/sandbox/3-execution-policy.md): Configure timeout, memory, file-system paths, environment variables, network access, and output limits with an immutable policy object. - [Drivers](https://instructorphp.com/llms/packages/sandbox/4-drivers.md): Choose and configure the isolation backend for command execution: Host, Docker, Podman, Firejail, or Bubblewrap. - [Streaming And Results](https://instructorphp.com/llms/packages/sandbox/5-streaming-and-results.md): Consume command output in real time with streaming callbacks, and inspect execution results through the ExecResult API. - [Testing](https://instructorphp.com/llms/packages/sandbox/6-testing.md): Use FakeSandbox for fast, deterministic tests without running real processes. - [Troubleshooting](https://instructorphp.com/llms/packages/sandbox/7-troubleshooting.md): Diagnose and resolve common setup, runtime, and configuration issues with the Sandbox package. ### HTTP Client - [Overview](https://instructorphp.com/llms/packages/http/1-overview.md): A framework-agnostic HTTP transport with pluggable drivers, streaming, and middleware. - [Getting Started](https://instructorphp.com/llms/packages/http/2-getting-started.md): Install the package, send your first request, and set up mocks for testing. - [Testing Doubles](https://instructorphp.com/llms/packages/http/testing-doubles.md): Deterministic transport testing with the built-in HTTP mock driver. - [Making Requests](https://instructorphp.com/llms/packages/http/3-making-requests.md): Create requests with plain values, set headers, encode bodies, and configure streaming. - [Handling Responses](https://instructorphp.com/llms/packages/http/4-handling-responses.md): Read status codes, headers, and bodies from buffered and streamed responses. - [Streaming Responses](https://instructorphp.com/llms/packages/http/5-streaming-responses.md): Enable streaming, consume chunks as they arrive, and process server-sent events. - [Pooling](https://instructorphp.com/llms/packages/http/6-pooling.md): Send multiple requests concurrently using the dedicated http-pool package. - [Middleware](https://instructorphp.com/llms/packages/http/10-middleware.md): Intercept, modify, and extend HTTP request/response behavior with middleware. - [Changing Client](https://instructorphp.com/llms/packages/http/7-changing-client.md): Switch HTTP drivers without changing your request code. - [Changing Client Config](https://instructorphp.com/llms/packages/http/8-changing-client-config.md): Configure timeouts, error handling, stream settings, and debug output. - [Custom Clients](https://instructorphp.com/llms/packages/http/9-1-custom-clients.md): Register your own HTTP drivers and response adapters when the bundled ones are not enough. ### Laravel - [Overview](https://instructorphp.com/llms/packages/laravel/index.md) - [Installation](https://instructorphp.com/llms/packages/laravel/installation.md) - [Configuration](https://instructorphp.com/llms/packages/laravel/configuration.md) - [Facades](https://instructorphp.com/llms/packages/laravel/facades.md) - [Native Agents](https://instructorphp.com/llms/packages/laravel/native-agents.md) - [Response Models](https://instructorphp.com/llms/packages/laravel/response-models.md) - [Agents](https://instructorphp.com/llms/packages/laravel/agents.md) - [Events](https://instructorphp.com/llms/packages/laravel/events.md) - [Commands](https://instructorphp.com/llms/packages/laravel/commands.md) - [Testing](https://instructorphp.com/llms/packages/laravel/testing.md) - [Advanced](https://instructorphp.com/llms/packages/laravel/advanced.md) - [Troubleshooting](https://instructorphp.com/llms/packages/laravel/troubleshooting.md) ### Retrieval - [Overview](https://instructorphp.com/llms/packages/retrieval/overview.md) ### Symfony - [Overview](https://instructorphp.com/llms/packages/symfony/overview.md) - [Quickstart](https://instructorphp.com/llms/packages/symfony/quickstart.md) - [Runtime Surfaces](https://instructorphp.com/llms/packages/symfony/runtime-surfaces.md) - [Configuration](https://instructorphp.com/llms/packages/symfony/configuration.md) - [Sessions](https://instructorphp.com/llms/packages/symfony/sessions.md) - [Testing](https://instructorphp.com/llms/packages/symfony/testing.md) - [Telemetry](https://instructorphp.com/llms/packages/symfony/telemetry.md) - [Logging](https://instructorphp.com/llms/packages/symfony/logging.md) - [Delivery](https://instructorphp.com/llms/packages/symfony/delivery.md) - [Operations](https://instructorphp.com/llms/packages/symfony/operations.md) - [Migration](https://instructorphp.com/llms/packages/symfony/migration.md) ### Xprompt - [Introduction](https://instructorphp.com/llms/packages/xprompt/01-introduction.md): Prompts as PHP classes — composable, testable, swappable - [Getting Started](https://instructorphp.com/llms/packages/xprompt/02-getting-started.md): Create your first prompt class, pass context, and render output - [Composition](https://instructorphp.com/llms/packages/xprompt/03-composition.md): Build complex system prompts from smaller, reusable prompt classes - [Templates](https://instructorphp.com/llms/packages/xprompt/04-templates.md): Use Twig templates with front matter metadata for prompt content - [Structured Data](https://instructorphp.com/llms/packages/xprompt/05-structured-data.md): Render criteria, rubrics, and taxonomies from YAML or inline data using NodeSet - [Variants And Registry](https://instructorphp.com/llms/packages/xprompt/06-variants-and-registry.md): Register prompt classes by name, swap implementations via overrides, and auto-discover prompts - [Configuration](https://instructorphp.com/llms/packages/xprompt/07-configuration.md): Configure template engine settings, resource paths, and presets ## Cookbook - [Introduction](https://instructorphp.com/llms/cookbook/introduction.md): Running and viewing cookbooks with Instructor Hub tool - [Contributing](https://instructorphp.com/llms/cookbook/contributing.md) ### A01_Basics - [Basic use](https://instructorphp.com/llms/cookbook/examples/A01_Basics/basic_use.md) - [Specifying required and optional parameters via constructor](https://instructorphp.com/llms/cookbook/examples/A01_Basics/constructor_parameters.md) - [Getters and setters](https://instructorphp.com/llms/cookbook/examples/A01_Basics/getters_and_setters.md) - [Private vs public object field](https://instructorphp.com/llms/cookbook/examples/A01_Basics/public_vs_private.md) - [Basic use via StructuredOutput](https://instructorphp.com/llms/cookbook/examples/A01_Basics/basic_use_mixin.md) - [Fluent API](https://instructorphp.com/llms/cookbook/examples/A01_Basics/fluent_api.md) - [Handling errors with `Maybe` helper class](https://instructorphp.com/llms/cookbook/examples/A01_Basics/maybe.md) - [Messages API](https://instructorphp.com/llms/cookbook/examples/A01_Basics/messages_api.md) - [Mixed Type Property](https://instructorphp.com/llms/cookbook/examples/A01_Basics/mixed_type_property.md) - [Modes](https://instructorphp.com/llms/cookbook/examples/A01_Basics/modes.md) - [Making some fields optional](https://instructorphp.com/llms/cookbook/examples/A01_Basics/optional_fields.md) - [Automatic correction based on validation results](https://instructorphp.com/llms/cookbook/examples/A01_Basics/self_correction.md) - [Using attributes](https://instructorphp.com/llms/cookbook/examples/A01_Basics/attributes.md) - [Load LLM Config Data From YAML](https://instructorphp.com/llms/cookbook/examples/A01_Basics/using_config.md) - [Validation](https://instructorphp.com/llms/cookbook/examples/A01_Basics/validation.md) - [Custom validation using Symfony Validator](https://instructorphp.com/llms/cookbook/examples/A01_Basics/custom_validation.md) - [Validation across multiple fields](https://instructorphp.com/llms/cookbook/examples/A01_Basics/validation_multifield.md) - [Validation with LLM](https://instructorphp.com/llms/cookbook/examples/A01_Basics/validation_with_llm.md) ### A02_Advanced - [Use custom configuration source](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/config_providers.md) - [Context caching (structured output)](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/context_cache_structured.md) - [Context caching (structured output, OpenAI)](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/context_cache_structured_oai.md) - [Context caching (structured output, OpenAI Responses)](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/context_cache_structured_oai_responses.md) - [Customize parameters of LLM driver](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/custom_config.md) - [Use custom HTTP client instance](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/custom_http_client.md) - [Use custom HTTP client instance - Laravel](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/custom_http_client_laravel.md) - [Custom prompts](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/custom_prompts.md) - [Customize parameters via DSN](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/custom_llm_with_dsn.md) - [Extracting arguments of function or method](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/function_calls.md) - [Manual Schema Building](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/manual_schemas.md) - [Streaming partial updates during inference](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/partials.md) - [Providing example inputs and outputs](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/demonstrations.md) - [Extracting scalar values](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/scalars.md) - [Extracting sequences of objects](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/sequences.md) - [Streaming](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/streaming.md) - [Structures](https://instructorphp.com/llms/cookbook/examples/A02_Advanced/structures.md) ### A03_Troubleshooting - [Calculating request cost](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/cost_calculation.md) - [Debugging](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/debugging.md) - [Read StructuredOutput EventLog JSONL](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/structured_output_eventlog_readback.md) - [Laravel Logging Integration](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/logging_laravel.md) - [Monolog Logging with Functional Pipeline](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/logging_monolog.md) - [PSR-3 Logging with Functional Pipeline](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/logging_psr.md) - [Symfony Logging Integration](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/logging_symfony.md) - [Observe StructuredOutput events, logs, and telemetry](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/observability_telemetry_mechanisms.md) - [Receive specific internal event with onEvent()](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/on_event.md) - [Load Config From Custom Path](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/settings.md) - [Send StructuredOutput telemetry to Langfuse](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/structured_telemetry_langfuse.md) - [Send StructuredOutput telemetry to Logfire](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/structured_telemetry_logfire.md) - [Tracking token usage via events](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/token_usage_events.md) - [Receive all internal events with wiretap()](https://instructorphp.com/llms/cookbook/examples/A03_Troubleshooting/wiretap.md) ### A04_APISupport - [A21](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/a21.md) - [Anthropic](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/anthropic.md) - [Azure OpenAI](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/azure_openai.md) - [Cerebras](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/cerebras.md) - [Cohere](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/cohere.md) - [DeepSeek](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/deepseek.md) - [Fireworks.ai](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/fireworks.md) - [Google Gemini](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/google_gemini.md) - [Google Gemini (OpenAI compatible API)](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/google_gemini_oai.md) - [Groq](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/groq.md) - [Hugging Face](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/huggingface.md) - [Inception](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/inception.md) - [Meta](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/meta.md) - [Minimaxi](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/minimaxi.md) - [Mistral AI](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/mistralai.md) - [MoonshotAI](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/moonshotai.md) - [Local / Ollama](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/ollama.md) - [OpenAI](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/openai.md) - [OpenAI Responses API](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/openai-responses.md) - [OpenRouter](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/openrouter.md) - [Perplexity](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/perplexity.md) - [Qwen](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/qwen.md) - [SambaNova](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/sambanova.md) - [Together.ai](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/togetherai.md) - [xAI / Grok](https://instructorphp.com/llms/cookbook/examples/A04_APISupport/xai.md) ### A05_Extras - [Extraction of complex objects](https://instructorphp.com/llms/cookbook/examples/A05_Extras/complex_extraction.md) - [Extraction of complex objects (Anthropic)](https://instructorphp.com/llms/cookbook/examples/A05_Extras/complex_extraction_claude.md) - [Extraction of complex objects (Cohere)](https://instructorphp.com/llms/cookbook/examples/A05_Extras/complex_extraction_cohere.md) - [Extraction of complex objects (Gemini)](https://instructorphp.com/llms/cookbook/examples/A05_Extras/complex_extraction_gemini.md) - [Cost calculation (StructuredOutput)](https://instructorphp.com/llms/cookbook/examples/A05_Extras/cost_calculation_structured.md) - [Custom Content Extractors](https://instructorphp.com/llms/cookbook/examples/A05_Extras/custom_extractor.md) - [Using structured data as an input](https://instructorphp.com/llms/cookbook/examples/A05_Extras/structured_input.md) - [Image processing - car damage detection](https://instructorphp.com/llms/cookbook/examples/A05_Extras/image_car_damage.md) - [Image to data (OpenAI)](https://instructorphp.com/llms/cookbook/examples/A05_Extras/image_to_data.md) - [Image to data (Anthropic)](https://instructorphp.com/llms/cookbook/examples/A05_Extras/image_to_data_anthropic.md) - [Image to data (Gemini)](https://instructorphp.com/llms/cookbook/examples/A05_Extras/image_to_data_gemini.md) - [Generating JSON Schema from PHP classes](https://instructorphp.com/llms/cookbook/examples/A05_Extras/json_schema.md) - [Streaming (Structured Output, OpenAI Responses)](https://instructorphp.com/llms/cookbook/examples/A05_Extras/streaming_structured_openai_responses.md) - [Return extracted data as array](https://instructorphp.com/llms/cookbook/examples/A05_Extras/output_format_array.md) - [Use different class for schema and output](https://instructorphp.com/llms/cookbook/examples/A05_Extras/output_format_instance_of.md) - [Streaming with array output format](https://instructorphp.com/llms/cookbook/examples/A05_Extras/output_format_streaming.md) - [Pure Array Processing (No Classes)](https://instructorphp.com/llms/cookbook/examples/A05_Extras/pure_array_processing.md) - [Generating JSON Schema from PHP classes](https://instructorphp.com/llms/cookbook/examples/A05_Extras/schema.md) - [Generating JSON Schema dynamically](https://instructorphp.com/llms/cookbook/examples/A05_Extras/schema_dynamic.md) - [Structured output validation loop](https://instructorphp.com/llms/cookbook/examples/A05_Extras/structured_output_validation_loop.md) - [Create tasks from meeting transcription](https://instructorphp.com/llms/cookbook/examples/A05_Extras/transcription_to_tasks.md) - [Translating UI text fields](https://instructorphp.com/llms/cookbook/examples/A05_Extras/translate_ui_fields.md) - [Web page to PHP objects](https://instructorphp.com/llms/cookbook/examples/A05_Extras/web_to_objects.md) ### B01_LLM - [Working directly with LLMs](https://instructorphp.com/llms/cookbook/examples/B01_LLM/inference.md) - [Working directly with LLMs and JSON - JSON mode](https://instructorphp.com/llms/cookbook/examples/B01_LLM/llm_json.md) - [Working directly with LLMs and JSON - JSON Schema mode](https://instructorphp.com/llms/cookbook/examples/B01_LLM/llm_json_schema.md) - [Working directly with LLMs and JSON - Markdown JSON prompting](https://instructorphp.com/llms/cookbook/examples/B01_LLM/llm_md_json.md) - [Working directly with LLMs and JSON - Tool calling](https://instructorphp.com/llms/cookbook/examples/B01_LLM/llm_tools.md) - [Generating JSON Schema from PHP classes](https://instructorphp.com/llms/cookbook/examples/B01_LLM/llm_with_schema_helper.md) - [Generating JSON Schema from PHP classes](https://instructorphp.com/llms/cookbook/examples/B01_LLM/llm_with_tools_helper.md) ### B02_LLMAdvanced - [Use custom configuration source for Inference](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/llm_config_providers.md) - [Context caching (text inference)](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/context_cache_llm.md) - [Context caching (text inference, OpenAI)](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/context_cache_llm_oai.md) - [Customize configuration of LLM driver](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/llm_custom_config.md) - [Using custom LLM driver](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/custom_llm_driver.md) - [Customize LLM Configuration with DSN string](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/custom_llm_via_dsn.md) - [Work directly with HTTP client facade](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/http_client.md) - [Reasoning content from an OpenAI-compatible endpoint](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/openai_compatible_reasoning_content.md) - [Parallel Calls](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/parallel_calls.md) - [Reasoning Content Access](https://instructorphp.com/llms/cookbook/examples/B02_LLMAdvanced/reasoning_content.md) ### B03_LLMTroubleshooting - [Read Inference EventLog JSONL](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/inference_eventlog_readback.md) - [Debugging HTTP Calls](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/http_debug.md) - [Embeddings Logging with Laravel](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/llm_logging_laravel_embeddings.md) - [Inference Logging with Laravel](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/llm_logging_laravel_inference.md) - [Inference Logging with Monolog](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/llm_logging_monolog.md) - [Inference Logging with Symfony](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/llm_logging_symfony.md) - [Send LLM runtime telemetry to Langfuse](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/llm_telemetry_langfuse.md) - [Send LLM runtime telemetry to Logfire](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/llm_telemetry_logfire.md) - [Send streaming LLM telemetry to Langfuse](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/llm_telemetry_streaming_langfuse.md) - [Send streaming LLM telemetry to Logfire](https://instructorphp.com/llms/cookbook/examples/B03_LLMTroubleshooting/llm_telemetry_streaming_logfire.md) ### B04_LLMApiSupport - [A21](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_a21.md) - [Anthropic](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_anthropic.md) - [Azure OpenAI](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_azure_openai.md) - [Cerebras](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_cerebras.md) - [Cohere](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_cohere.md) - [DeepSeek](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_deepseek.md) - [Fireworks.ai](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_fireworks.md) - [Google Gemini](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_google_gemini.md) - [Google Gemini (OpenAI-compatible)](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_google_gemini_oai.md) - [Groq](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_groq.md) - [Inception](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_inception.md) - [Meta](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_meta.md) - [Minimaxi](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_minimaxi.md) - [Mistral AI](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_mistralai.md) - [MoonshotAI](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_moonshotai.md) - [Local / Ollama](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_ollama.md) - [OpenAI](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_openai.md) - [OpenAI Responses API](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_openai-responses.md) - [OpenRouter](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_openrouter.md) - [Perplexity](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_perplexity.md) - [Qwen](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_qwen.md) - [SambaNova](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_sambanova.md) - [Together.ai](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_togetherai.md) - [xAI / Grok](https://instructorphp.com/llms/cookbook/examples/B04_LLMApiSupport/llm_xai.md) ### B05_LLMExtras - [Multi-Participant AI Chat Panel Discussion](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/chat_with_many_participants.md) - [Chat with summary](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/chat_with_summary.md) - [Cost calculation (Polyglot)](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/cost_calculation_inference.md) - [Using images in prompts](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/image_data.md) - [Streaming metrics (Polyglot)](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/metrics_streaming.md) - [Exact model catalog records](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/model_catalog.md) - [Streaming (Inference, OpenAI Responses)](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/streaming_inference_openai_responses.md) - [Prompt Templates](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/prompt_templates.md) - [Simple content summary](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/summary_with_llm.md) - [Inference and tool use](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/tool_use.md) - [Inference and tool use (ReAct driver)](https://instructorphp.com/llms/cookbook/examples/B05_LLMExtras/tool_use_react.md) ### B06_Decisions - [Typed decision primitives](https://instructorphp.com/llms/cookbook/examples/B06_Decisions/decision_primitives.md) - [Explicit Decision runtime and pending execution](https://instructorphp.com/llms/cookbook/examples/B06_Decisions/decision_runtime.md) - [Dynamic decision choices](https://instructorphp.com/llms/cookbook/examples/B06_Decisions/decision_dynamic_choices.md) - [Decision model metadata](https://instructorphp.com/llms/cookbook/examples/B06_Decisions/decision_model_metadata.md) - [Decision model pricing](https://instructorphp.com/llms/cookbook/examples/B06_Decisions/decision_model_pricing.md) - [Evaluate Decision providers on a fixed labeled corpus](https://instructorphp.com/llms/cookbook/examples/B06_Decisions/decision_provider_evaluation.md) - [Structured decision state and criteria](https://instructorphp.com/llms/cookbook/examples/B06_Decisions/decision_structured_state.md) ### B07_Embeddings - [Custom Embeddings Config](https://instructorphp.com/llms/cookbook/examples/B07_Embeddings/custom_embeddings_config.md) - [Embeddings utils](https://instructorphp.com/llms/cookbook/examples/B07_Embeddings/embed_utils.md) - [Embeddings](https://instructorphp.com/llms/cookbook/examples/B07_Embeddings/embeddings.md) - [Embedding model metadata](https://instructorphp.com/llms/cookbook/examples/B07_Embeddings/embedding_model_metadata.md) - [Embedding model pricing](https://instructorphp.com/llms/cookbook/examples/B07_Embeddings/embedding_model_pricing.md) ### B08_Retrieval - [Index Documents and Ask with RAG](https://instructorphp.com/llms/cookbook/examples/B08_Retrieval/retrieval_index_and_ask.md) - [Vector Storage and Bounded Retrieval](https://instructorphp.com/llms/cookbook/examples/B08_Retrieval/retrieval.md) - [Draft Support Replies with Sources](https://instructorphp.com/llms/cookbook/examples/B08_Retrieval/support_reply_with_sources.md) ### B09_BatchInference - [Native batch lifecycle](https://instructorphp.com/llms/cookbook/examples/B09_BatchInference/batch_inference_lifecycle.md) - [Request batch cancellation](https://instructorphp.com/llms/cookbook/examples/B09_BatchInference/batch_inference_cancel.md) - [List batch jobs with an opaque cursor](https://instructorphp.com/llms/cookbook/examples/B09_BatchInference/batch_inference_list_jobs.md) - [Run a provider batch lifecycle explicitly](https://instructorphp.com/llms/cookbook/examples/B09_BatchInference/batch_inference_live.md) - [Read partial batch results](https://instructorphp.com/llms/cookbook/examples/B09_BatchInference/batch_inference_partial_results.md) - [Choose provider batch options](https://instructorphp.com/llms/cookbook/examples/B09_BatchInference/batch_inference_provider_options.md) - [Resume a batch in another PHP process](https://instructorphp.com/llms/cookbook/examples/B09_BatchInference/batch_inference_resume.md) - [Handle unsupported batch capabilities](https://instructorphp.com/llms/cookbook/examples/B09_BatchInference/batch_inference_unsupported.md) ### C01_Http - [HTTP Client – Basics](https://instructorphp.com/llms/cookbook/examples/C01_Http/http_client_basics.md) - [HTTP Client – Streaming Basics](https://instructorphp.com/llms/cookbook/examples/C01_Http/http_client_streaming_basics.md) - [HTTP Middleware (Hooks)](https://instructorphp.com/llms/cookbook/examples/C01_Http/http_middleware_hooks.md) - [HTTP Middleware (Stream)](https://instructorphp.com/llms/cookbook/examples/C01_Http/http_middleware_stream.md) - [HTTP Middleware (Sync)](https://instructorphp.com/llms/cookbook/examples/C01_Http/http_middleware_sync.md) - [HTTP Client – Pool Basics](https://instructorphp.com/llms/cookbook/examples/C01_Http/http_client_pool_basics.md) - [HTTP Client – Opt-in Stream Capture](https://instructorphp.com/llms/cookbook/examples/C01_Http/http_client_stream_capture.md) ### D01_Agents - [AgentLoop::execute()](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_loop_execute.md) - [AgentLoop::iterate()](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_loop_iterate.md) - [Agent with Bash Tool](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_loop_bash_tool.md) - [Agent with Custom Tool](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_loop_custom_tool.md) - [Agent Lifecycle Hooks](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_loop_hooks.md) - [Custom Context Compiler](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_loop_context_compiler.md) - [Agent Stop Conditions](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_loop_stop_conditions.md) - [Agent Events and Wiretap](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_loop_events.md) - [Multi-Execution Conversations](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_loop_multi_execution.md) - [Describe an AgentLoop](https://instructorphp.com/llms/cookbook/examples/D01_Agents/agent_describe.md) ### D02_AgentBuilder - [Basic Agent Usage](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_basic.md) - [Agent with File System Tools](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_file_system.md) - [Agent with Structured Output Extraction](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_structured_output.md) - [Agent Hooks - Tool Interception](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_hooks.md) - [Agent Self-Critique Pattern](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_self_critique.md) - [Agent-Driven Codebase Search](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_search.md) - [Agent Subagent Orchestration](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_subagents.md) - [Agent Execution Retrospective (D-Mail)](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_retrospective.md) - [Agent Planning Subagent Tool](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_planning_subagent.md) - [Agent Skills - SKILL.md Open Standard](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_skills.md) - [Derive a System Prompt from the Built Agent](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_derived_prompt.md) - [Agent Self-Knowledge](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_self_knowledge.md) - [Install Agent Self-Description](https://instructorphp.com/llms/cookbook/examples/D02_AgentBuilder/agent_self_description.md) ### D03_AgentTemplates - [Template from Definition](https://instructorphp.com/llms/cookbook/examples/D03_AgentTemplates/template_from_definition.md) - [Template from Markdown](https://instructorphp.com/llms/cookbook/examples/D03_AgentTemplates/template_from_markdown.md) - [Template from YAML](https://instructorphp.com/llms/cookbook/examples/D03_AgentTemplates/template_from_yaml.md) - [Template with Tools and Capabilities](https://instructorphp.com/llms/cookbook/examples/D03_AgentTemplates/template_with_tools_and_capabilities.md) - [Template Overrides Seed State](https://instructorphp.com/llms/cookbook/examples/D03_AgentTemplates/template_override_seed_state.md) - [Coding Agent Creates and Repairs an Example](https://instructorphp.com/llms/cookbook/examples/D03_AgentTemplates/coding_agent_creates_example.md) - [Agent Definition Tools](https://instructorphp.com/llms/cookbook/examples/D03_AgentTemplates/agent_definition_tools.md) - [Composer Capability Discovery](https://instructorphp.com/llms/cookbook/examples/D03_AgentTemplates/composer_capability_discovery.md) - [Round-Trip an Agent Definition](https://instructorphp.com/llms/cookbook/examples/D03_AgentTemplates/agent_definition_round_trip.md) ### D04_AgentSessions - [Session Create and Persist](https://instructorphp.com/llms/cookbook/examples/D04_AgentSessions/session_create_and_persist.md) - [SessionRuntime Execute Action](https://instructorphp.com/llms/cookbook/examples/D04_AgentSessions/session_runtime_execute_action.md) - [SessionRuntime Read APIs](https://instructorphp.com/llms/cookbook/examples/D04_AgentSessions/session_runtime_read_apis.md) - [Session SendMessage Action](https://instructorphp.com/llms/cookbook/examples/D04_AgentSessions/session_send_message_action.md) - [Session Fork Action](https://instructorphp.com/llms/cookbook/examples/D04_AgentSessions/session_fork_action.md) - [Session Conflict Handling](https://instructorphp.com/llms/cookbook/examples/D04_AgentSessions/session_conflict_handling.md) - [Session Runtime Hooks](https://instructorphp.com/llms/cookbook/examples/D04_AgentSessions/session_runtime_hooks.md) ### D05_AgentTroubleshooting - [Read Agent EventLog JSONL](https://instructorphp.com/llms/cookbook/examples/D05_AgentTroubleshooting/agent_eventlog_readback.md) - [Send Subagent telemetry to Langfuse](https://instructorphp.com/llms/cookbook/examples/D05_AgentTroubleshooting/agent_subagent_telemetry_langfuse.md) - [Send Subagent telemetry to Logfire](https://instructorphp.com/llms/cookbook/examples/D05_AgentTroubleshooting/agent_subagent_telemetry_logfire.md) - [Send Agent telemetry to Langfuse](https://instructorphp.com/llms/cookbook/examples/D05_AgentTroubleshooting/agent_telemetry_langfuse.md) - [Send Agent telemetry to Logfire](https://instructorphp.com/llms/cookbook/examples/D05_AgentTroubleshooting/agent_telemetry_logfire.md) ### D06_AgentEvals - [Agent eval overview](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_overview.md) - [Agent eval cases and datasets](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_cases.md) - [Deterministic agent eval assertions](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_assertions.md) - [Agent eval judge](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_judge.md) - [Local and HTTP agent eval targets](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_targets.md) - [Agent eval reporters](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_reporters.md) - [Running agent eval suites](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/running_agent_evals.md) - [Agent evals in PHPUnit and Pest](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_test_suites.md) - [A stronger judge for a weaker target](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_judging_agent.md) - [Live agent-judging-agent with real models](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_judging_agent_live.md) - [A single run is not a measurement](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_repeated_judging.md) - [Discovering and running evals from the CLI](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_discovery_and_cli.md) - [Safe and full eval trace policies](https://instructorphp.com/llms/cookbook/examples/D06_AgentEvals/agent_eval_trace_policies.md) ### D10_AgentCtrl - [Basic Agent Control Usage](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/agent_ctrl_basic.md) - [Agent Control Events & Monitoring](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/agent_ctrl_events.md) - [Agent Control Streaming](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/agent_ctrl_streaming.md) - [Agent Control Runtime Switching](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/agent_ctrl_switching.md) - [Claude Code CLI - Basic](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/claude_code_basic.md) - [Claude Code CLI - Agentic Search](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/claude_code_search.md) - [OpenAI Codex CLI - Basic](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/codex_basic.md) - [OpenAI Codex CLI - Streaming](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/codex_streaming.md) - [Read AgentCtrl EventLog JSONL](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/agent_ctrl_eventlog_readback.md) - [Gemini CLI - Basic](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/gemini_basic.md) - [Gemini CLI - Streaming](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/gemini_streaming.md) - [OpenCode CLI - Basic](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/opencode_basic.md) - [OpenCode CLI - Streaming](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/opencode_streaming.md) - [Pi CLI - Basic](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/pi_basic.md) - [Pi CLI - Streaming](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/pi_streaming.md) - [Send AgentCtrl telemetry to Langfuse](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/agent_ctrl_telemetry_langfuse.md) - [Send AgentCtrl telemetry to Logfire](https://instructorphp.com/llms/cookbook/examples/D10_AgentCtrl/agent_ctrl_telemetry_logfire.md) ### D11_TellHarness - [Tell Harness: Stateless PHP Run](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_stateless_run.md) - [Tell Harness: Observe a Long-Running Run](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_observable_run.md) - [Tell Harness: Durable Named Conversation](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_durable_conversation.md) - [Tell Harness: Safe Transient Experiment](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_transient_experiment.md) - [Tell Harness: Explicit Context Lifecycle](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_context_lifecycle.md) - [Tell Harness: Branch, Recover, and Reset Work](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_branch_workflow.md) - [Tell Harness: Configure a Branch Without Storing Secrets](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_branch_configuration.md) - [Tell Harness: Bound, Cancel, and Observe a Run](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_controlled_run.md) - [Tell Harness: Discover Providers and Invoke a Tool Directly](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_agent_capabilities.md) - [Tell Harness: Test Deterministically Without Provider I/O](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_deterministic_testing.md) - [Tell Harness: Typed Reasoning Configuration](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_reasoning_configuration.md) - [Tell Harness: External One-Run Protocol](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_external_protocol.md) - [Tell Harness: Configure an Embedded Tell Instance](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_modular_host.md) - [Tell Harness: Own Persistent Shell Jobs](https://instructorphp.com/llms/cookbook/examples/D11_TellHarness/tell_harness_persistent_shell_jobs.md) ### D20_Sandbox - [Sandbox: Host ls -Al](https://instructorphp.com/llms/cookbook/examples/D20_Sandbox/sandbox_host_ls.md) - [Sandbox: Run PHP Script](https://instructorphp.com/llms/cookbook/examples/D20_Sandbox/sandbox_run_php_script.md) - [Sandbox: Streaming Output](https://instructorphp.com/llms/cookbook/examples/D20_Sandbox/sandbox_streaming_output.md) - [Sandbox: Timeout Guard](https://instructorphp.com/llms/cookbook/examples/D20_Sandbox/sandbox_timeout_guard.md) ### D21_SandboxAPIs - [Sandbox API: Bubblewrap](https://instructorphp.com/llms/cookbook/examples/D21_SandboxAPIs/sandbox_api_bubblewrap_echo.md) - [Sandbox API: Docker](https://instructorphp.com/llms/cookbook/examples/D21_SandboxAPIs/sandbox_api_docker_echo.md) - [Sandbox API: Firejail](https://instructorphp.com/llms/cookbook/examples/D21_SandboxAPIs/sandbox_api_firejail_echo.md) - [Sandbox API: Host](https://instructorphp.com/llms/cookbook/examples/D21_SandboxAPIs/sandbox_api_host_echo.md) - [Sandbox API: Podman](https://instructorphp.com/llms/cookbook/examples/D21_SandboxAPIs/sandbox_api_podman_echo.md) ### Z01_ZeroShot - [Assign a Role](https://instructorphp.com/llms/cookbook/examples/Z01_ZeroShot/assign_role.md) - [Auto-Refine The Prompt](https://instructorphp.com/llms/cookbook/examples/Z01_ZeroShot/auto_refine.md) - [Clarify Ambiguous Information](https://instructorphp.com/llms/cookbook/examples/Z01_ZeroShot/clarify_ambiguity.md) - [Define Style](https://instructorphp.com/llms/cookbook/examples/Z01_ZeroShot/define_style.md) - [Emotional Stimuli](https://instructorphp.com/llms/cookbook/examples/Z01_ZeroShot/emotional_stimuli.md) - [Generate Follow-Up Questions](https://instructorphp.com/llms/cookbook/examples/Z01_ZeroShot/follow_up_questions.md) - [Ask Model to Repeat the Query](https://instructorphp.com/llms/cookbook/examples/Z01_ZeroShot/repeat_query.md) - [Simulate a Perspective](https://instructorphp.com/llms/cookbook/examples/Z01_ZeroShot/simulate_perspective.md) ### Z02_FewShot - [Consistency Based Self Adaptive Prompting (COSP)](https://instructorphp.com/llms/cookbook/examples/Z02_FewShot/consistency_based_examples.md) - [Example Ordering](https://instructorphp.com/llms/cookbook/examples/Z02_FewShot/example_ordering.md) - [Generate In-Context Examples](https://instructorphp.com/llms/cookbook/examples/Z02_FewShot/in_context_examples.md) - [Select Effective Examples](https://instructorphp.com/llms/cookbook/examples/Z02_FewShot/select_effective_samples.md) ### Z03_ThoughtGen - [Analogical Prompting](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/analogical_prompting.md) - [Automate Example Selection](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/automate_selection.md) - [Prioritize Complex Examples](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/complex_examples.md) - [Examine The Context](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/examine_context.md) - [Consider Higher-Level Context](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/higher_level_context.md) - [Include Incorrect Examples](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/incorrect_examples.md) - [Use Majority Voting](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/majority_voting.md) - [Generate Prompt Variations](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/prompt_variations.md) - [Structure The Reasoning](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/structure_reasoning.md) - [Prioritize Uncertain Examples](https://instructorphp.com/llms/cookbook/examples/Z03_ThoughtGen/uncertain_examples.md) ### Z04_Ensembling - [Combine Multiple Reasoning Chains](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/combine_reasoning_chains.md) - [Use LLMs to Combine Different Responses](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/combine_responses.md) - [Combine Different Specialized LLMs](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/combine_specialized_llms.md) - [Prioritize Consistent Examples](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/consistent_examples.md) - [Use Distinct Example Subsets](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/distinct_examples.md) - [Use Ensembles To Test Prompts](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/ensemble_test_prompts.md) - [Generate Multiple Candidate Responses](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/multiple_candidates.md) - [Use Task Specific Evaluation Metrics](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/task_specific_evals.md) - [Use Translation for Paraphrasing](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/translation_paraphrasing.md) - [Verify Responses over Majority Voting](https://instructorphp.com/llms/cookbook/examples/Z04_Ensembling/verify_majority_voting.md) ### Z05_SelfCriticism - [Break Down Reasoning Into Multiple Steps](https://instructorphp.com/llms/cookbook/examples/Z05_SelfCriticism/break_down_reasoning.md) - [Determine Uncertainty of Reasoning Chain](https://instructorphp.com/llms/cookbook/examples/Z05_SelfCriticism/determine_uncertainty.md) - [Improve With Feedback](https://instructorphp.com/llms/cookbook/examples/Z05_SelfCriticism/improve_with_feedback.md) - [Reconstruct Prompt from Reasoning Steps](https://instructorphp.com/llms/cookbook/examples/Z05_SelfCriticism/reconstruct_prompt.md) - [Self-Verify Responses](https://instructorphp.com/llms/cookbook/examples/Z05_SelfCriticism/self_verify.md) - [Independently Verify Responses](https://instructorphp.com/llms/cookbook/examples/Z05_SelfCriticism/verify_independently.md) ### Z06_Decomposition - [Break Down Complex Tasks](https://instructorphp.com/llms/cookbook/examples/Z06_Decomposition/break_down_complexity.md) - [Ditch Vanilla Chain Of Thought](https://instructorphp.com/llms/cookbook/examples/Z06_Decomposition/ditch_vanilla_cot.md) - [Generate Code for Intermediate Steps](https://instructorphp.com/llms/cookbook/examples/Z06_Decomposition/generate_code.md) - [Generate in Parallel](https://instructorphp.com/llms/cookbook/examples/Z06_Decomposition/generate_in_parallel.md) - [Solve Simpler Subproblems](https://instructorphp.com/llms/cookbook/examples/Z06_Decomposition/solve_simpler_subtasks.md) - [Leverage Task Specific Systems](https://instructorphp.com/llms/cookbook/examples/Z06_Decomposition/task_specific_systems.md) ### Z07_Misc - [Arbitrary properties](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/arbitrary_properties.md) - [Consistent values of arbitrary properties](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/arbitrary_properties_consistent.md) - [Chain of Summaries](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/chain_of_summaries.md) - [Chain of Thought](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/chain_of_thought.md) - [Single label classification](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/classification.md) - [Multiclass classification](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/classification_multiclass.md) - [Entity relationship extraction](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/entity_relationships.md) - [Handling errors](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/handling_errors.md) - [Limiting the length of lists](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/limiting_lists.md) - [Reflection Prompting](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/reflection_prompting.md) - [Restating instructions](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/restate_instructions.md) - [Ask LLM to rewrite instructions](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/rewrite_instructions.md) - [Expanding search queries](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/search_query_expansion.md) - [Summary with Keywords](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/summary_with_keywords.md) - [Reusing components](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/component_reuse.md) - [Using CoT to improve interpretation of component data](https://instructorphp.com/llms/cookbook/examples/Z07_Misc/component_reuse_cot.md) ## Cheatsheets - [Overview](https://instructorphp.com/llms/cheatsheets/index.md) - [Instructor](https://instructorphp.com/llms/cheatsheets/instructor.md): Structured output extraction from LLMs — core API, response models, validation, and streaming - [Polyglot](https://instructorphp.com/llms/cheatsheets/polyglot.md): Unified LLM API — inference, embeddings, request building, streaming, and provider configuration - [Agents](https://instructorphp.com/llms/cheatsheets/agents.md): Agent loop, state model, tools, context management, hooks, and subagent orchestration - [AgentCtrl](https://instructorphp.com/llms/cheatsheets/agent-ctrl.md): External coding agent control — Claude Code, Codex, OpenCode, and Gemini CLI bridges - [Telemetry](https://instructorphp.com/llms/cheatsheets/telemetry.md) - [Sandbox](https://instructorphp.com/llms/cheatsheets/sandbox.md): Code execution sandbox — execution policies, drivers, streaming results, and security - [HTTP Client](https://instructorphp.com/llms/cheatsheets/http-client.md): Framework-agnostic HTTP client — requests, responses, streaming, pooling, and middleware - [Laravel](https://instructorphp.com/llms/cheatsheets/laravel.md): Laravel integration — service provider, facades, config publishing, and Artisan commands - [Config](https://instructorphp.com/llms/cheatsheets/config.md): Configuration loading — config files, base paths, entries, and environment resolution - [Contracts](https://instructorphp.com/llms/cheatsheets/contracts.md) - [Dynamic](https://instructorphp.com/llms/cheatsheets/dynamic.md): Runtime data structures — schema-driven immutable objects with validation - [Events](https://instructorphp.com/llms/cheatsheets/events.md): PSR-compatible event system — dispatching, listeners, wiretaps, and event handling - [Logging](https://instructorphp.com/llms/cheatsheets/logging.md): Structured logging pipeline — filters, enrichers, formatters, and log drivers - [Messages](https://instructorphp.com/llms/cheatsheets/messages.md): Message store, content parts, tool calls, and multi-section conversation management - [Metrics](https://instructorphp.com/llms/cheatsheets/metrics.md): Metrics collection and export — collectors, registries, exporters, and event integration - [Pipeline](https://instructorphp.com/llms/cheatsheets/pipeline.md): Data processing pipelines — builder, error strategies, processors, and pipe composition - [Schema](https://instructorphp.com/llms/cheatsheets/schema.md): PHP type-to-JSON Schema mapping — schema building, factory, callable schemas, and rendering - [Setup](https://instructorphp.com/llms/cheatsheets/setup.md): CLI commands for publishing package resources and config files, with validation and caching support - [Stream](https://instructorphp.com/llms/cheatsheets/stream.md): Composable stream transformations — transducers, filters, mappers, and lazy evaluation - [Symfony](https://instructorphp.com/llms/cheatsheets/symfony.md): Symfony integration — bundle, config root, container wiring, event bridge, and HTTP transport - [Templates](https://instructorphp.com/llms/cheatsheets/templates.md): Template engine abstraction — Twig, Blade, Arrowpipe, and DSN-based template resolution - [Utils](https://instructorphp.com/llms/cheatsheets/utils.md): Core utilities — JSON processing, collections, text manipulation, and helper functions - [Xprompt](https://instructorphp.com/llms/cheatsheets/xprompt.md): Prompts-as-code — classes, composition, variants, registry, template-backed bodies ## Optional ### Release Notes - [Overview](https://instructorphp.com/llms/release-notes/versions.md) - [v2.14.1](https://instructorphp.com/llms/release-notes/v2.14.1.md) - [v2.14.0](https://instructorphp.com/llms/release-notes/v2.14.0.md) - [v2.13.0](https://instructorphp.com/llms/release-notes/v2.13.0.md) - [v2.12.0](https://instructorphp.com/llms/release-notes/v2.12.0.md) - [v2.11.0](https://instructorphp.com/llms/release-notes/v2.11.0.md): Typed structured decisions and TypeSafe connectivity in Polyglot. - [v2.10.1](https://instructorphp.com/llms/release-notes/v2.10.1.md): Standalone package QA fixes for the v2.10 release train. - [v2.10.0](https://instructorphp.com/llms/release-notes/v2.10.0.md) - [v2.9.5](https://instructorphp.com/llms/release-notes/v2.9.5.md) - [v2.9.4](https://instructorphp.com/llms/release-notes/v2.9.4.md) - [v2.9.3](https://instructorphp.com/llms/release-notes/v2.9.3.md) - [v2.9.2](https://instructorphp.com/llms/release-notes/v2.9.2.md) - [v2.9.1](https://instructorphp.com/llms/release-notes/v2.9.1.md) - [v2.9.0](https://instructorphp.com/llms/release-notes/v2.9.0.md) - [v2.8.5](https://instructorphp.com/llms/release-notes/v2.8.5.md) - [v2.8.4](https://instructorphp.com/llms/release-notes/v2.8.4.md) - [v2.8.3](https://instructorphp.com/llms/release-notes/v2.8.3.md) - [v2.8.2](https://instructorphp.com/llms/release-notes/v2.8.2.md) - [v2.8.1](https://instructorphp.com/llms/release-notes/v2.8.1.md) - [v2.8.0](https://instructorphp.com/llms/release-notes/v2.8.0.md) - [v2.7.1](https://instructorphp.com/llms/release-notes/v2.7.1.md) - [v2.7.0](https://instructorphp.com/llms/release-notes/v2.7.0.md) - [v2.6.2](https://instructorphp.com/llms/release-notes/v2.6.2.md) - [v2.6.1](https://instructorphp.com/llms/release-notes/v2.6.1.md) - [v2.6.0](https://instructorphp.com/llms/release-notes/v2.6.0.md) - [v2.5.2](https://instructorphp.com/llms/release-notes/v2.5.2.md) - [v2.5.1](https://instructorphp.com/llms/release-notes/v2.5.1.md) - [v2.5.0](https://instructorphp.com/llms/release-notes/v2.5.0.md) - [v2.4.1](https://instructorphp.com/llms/release-notes/v2.4.1.md) - [v2.4.0](https://instructorphp.com/llms/release-notes/v2.4.0.md) - [v2.3.1](https://instructorphp.com/llms/release-notes/v2.3.1.md) - [v2.3.0](https://instructorphp.com/llms/release-notes/v2.3.0.md) - [v2.2.0](https://instructorphp.com/llms/release-notes/v2.2.0.md) - [v2.1.0](https://instructorphp.com/llms/release-notes/v2.1.0.md) - [v2.0.0](https://instructorphp.com/llms/release-notes/v2.0.0.md) - [v1.22.0](https://instructorphp.com/llms/release-notes/v1.22.0.md) - [v1.21.0](https://instructorphp.com/llms/release-notes/v1.21.0.md) - [v1.20.0](https://instructorphp.com/llms/release-notes/v1.20.0.md) - [v1.19.0](https://instructorphp.com/llms/release-notes/v1.19.0.md) - [v1.18.4](https://instructorphp.com/llms/release-notes/v1.18.4.md) - [v1.18.3](https://instructorphp.com/llms/release-notes/v1.18.3.md) - [v1.18.2](https://instructorphp.com/llms/release-notes/v1.18.2.md) - [v1.18.1](https://instructorphp.com/llms/release-notes/v1.18.1.md) - [v1.18.0](https://instructorphp.com/llms/release-notes/v1.18.0.md) - [v1.17.0](https://instructorphp.com/llms/release-notes/v1.17.0.md) - [v1.16.0](https://instructorphp.com/llms/release-notes/v1.16.0.md) - [v1.15.0](https://instructorphp.com/llms/release-notes/v1.15.0.md) - [v1.14.0](https://instructorphp.com/llms/release-notes/v1.14.0.md) - [v1.13.0](https://instructorphp.com/llms/release-notes/v1.13.0.md) - [v1.12.0](https://instructorphp.com/llms/release-notes/v1.12.0.md) - [v1.11.0](https://instructorphp.com/llms/release-notes/v1.11.0.md) - [v1.10.3](https://instructorphp.com/llms/release-notes/v1.10.3.md) - [v1.10.2](https://instructorphp.com/llms/release-notes/v1.10.2.md) - [v1.10.1](https://instructorphp.com/llms/release-notes/v1.10.1.md) - [v1.10.0](https://instructorphp.com/llms/release-notes/v1.10.0.md) - [v1.9.1](https://instructorphp.com/llms/release-notes/v1.9.1.md) - [v1.9.0](https://instructorphp.com/llms/release-notes/v1.9.0.md) - [v1.8.1](https://instructorphp.com/llms/release-notes/v1.8.1.md) - [v1.8.0](https://instructorphp.com/llms/release-notes/v1.8.0.md) - [v1.7.0](https://instructorphp.com/llms/release-notes/v1.7.0.md) - [v1.6.0](https://instructorphp.com/llms/release-notes/v1.6.0.md) - [v1.5.0](https://instructorphp.com/llms/release-notes/v1.5.0.md) - [v1.4.2](https://instructorphp.com/llms/release-notes/v1.4.2.md) - [v1.4.1](https://instructorphp.com/llms/release-notes/v1.4.1.md) - [v1.4.0](https://instructorphp.com/llms/release-notes/v1.4.0.md) - [v1.3.0](https://instructorphp.com/llms/release-notes/v1.3.0.md) - [v1.2.0](https://instructorphp.com/llms/release-notes/v1.2.0.md) - [v1.1.0](https://instructorphp.com/llms/release-notes/v1.1.0.md) - [v1.0.0](https://instructorphp.com/llms/release-notes/v1.0.0.md) - [v1.0.0-RC22](https://instructorphp.com/llms/release-notes/v1.0.0-RC22.md) - [v1.0.0-RC21](https://instructorphp.com/llms/release-notes/v1.0.0-RC21.md) - [v1.0.0-RC20](https://instructorphp.com/llms/release-notes/v1.0.0-RC20.md) - [v1.0.0-RC19](https://instructorphp.com/llms/release-notes/v1.0.0-RC19.md) - [v1.0.0-RC18](https://instructorphp.com/llms/release-notes/v1.0.0-RC18.md) - [v1.0.0-RC17](https://instructorphp.com/llms/release-notes/v1.0.0-RC17.md) - [v1.0.0-RC16](https://instructorphp.com/llms/release-notes/v1.0.0-RC16.md) - [v1.0.0-RC15](https://instructorphp.com/llms/release-notes/v1.0.0-RC15.md) - [v1.0.0-RC14](https://instructorphp.com/llms/release-notes/v1.0.0-RC14.md) - [v1.0.0-RC13](https://instructorphp.com/llms/release-notes/v1.0.0-RC13.md) - [v1.0.0-RC12](https://instructorphp.com/llms/release-notes/v1.0.0-RC12.md) - [v1.0.0-RC11](https://instructorphp.com/llms/release-notes/v1.0.0-RC11.md) - [v1.0.0-RC10](https://instructorphp.com/llms/release-notes/v1.0.0-RC10.md) - [v1.0.0-RC9](https://instructorphp.com/llms/release-notes/v1.0.0-RC9.md) - [v1.0.0-RC8](https://instructorphp.com/llms/release-notes/v1.0.0-RC8.md) - [v1.0.0-RC7](https://instructorphp.com/llms/release-notes/v1.0.0-RC7.md) - [v1.0.0-RC6](https://instructorphp.com/llms/release-notes/v1.0.0-RC6.md) - [v1.0.0-rc5](https://instructorphp.com/llms/release-notes/v1.0.0-rc5.md) - [v1.0.0-rc4](https://instructorphp.com/llms/release-notes/v1.0.0-rc4.md) - [v1.0.0-rc3](https://instructorphp.com/llms/release-notes/v1.0.0-rc3.md) - [v1.0.0-rc2](https://instructorphp.com/llms/release-notes/v1.0.0-rc2.md) - [v1.0.0-rc1](https://instructorphp.com/llms/release-notes/v1.0.0-rc1.md) - [v0.17.12](https://instructorphp.com/llms/release-notes/v0.17.12.md) - [v0.17.11](https://instructorphp.com/llms/release-notes/v0.17.11.md) - [v0.17.10](https://instructorphp.com/llms/release-notes/v0.17.10.md) - [v0.17.9](https://instructorphp.com/llms/release-notes/v0.17.9.md) - [v0.17.8](https://instructorphp.com/llms/release-notes/v0.17.8.md) - [v0.17.7](https://instructorphp.com/llms/release-notes/v0.17.7.md) - [v0.17.6](https://instructorphp.com/llms/release-notes/v0.17.6.md) - [v0.17.5](https://instructorphp.com/llms/release-notes/v0.17.5.md) - [v0.17.4](https://instructorphp.com/llms/release-notes/v0.17.4.md) - [v0.17.3](https://instructorphp.com/llms/release-notes/v0.17.3.md) - [v0.17.1](https://instructorphp.com/llms/release-notes/v0.17.1.md) - [v0.17.0](https://instructorphp.com/llms/release-notes/v0.17.0.md) - [v0.16.0](https://instructorphp.com/llms/release-notes/v0.16.0.md) - [v0.15.2](https://instructorphp.com/llms/release-notes/v0.15.2.md) - [v0.15.1](https://instructorphp.com/llms/release-notes/v0.15.1.md) - [v0.15.0](https://instructorphp.com/llms/release-notes/v0.15.0.md) - [v0.14.7](https://instructorphp.com/llms/release-notes/v0.14.7.md) - [v0.14.6](https://instructorphp.com/llms/release-notes/v0.14.6.md) - [v0.14.5](https://instructorphp.com/llms/release-notes/v0.14.5.md) - [v0.14.4](https://instructorphp.com/llms/release-notes/v0.14.4.md) - [v0.14.3](https://instructorphp.com/llms/release-notes/v0.14.3.md) - [v0.14.2](https://instructorphp.com/llms/release-notes/v0.14.2.md) - [v0.14.1](https://instructorphp.com/llms/release-notes/v0.14.1.md) - [v0.14.0](https://instructorphp.com/llms/release-notes/v0.14.0.md) - [v0.13.0](https://instructorphp.com/llms/release-notes/v0.13.0.md) - [v0.12.13](https://instructorphp.com/llms/release-notes/v0.12.13.md) - [v0.12.12](https://instructorphp.com/llms/release-notes/v0.12.12.md) - [v0.12.11](https://instructorphp.com/llms/release-notes/v0.12.11.md) - [v0.12.10](https://instructorphp.com/llms/release-notes/v0.12.10.md) - [v0.12.9](https://instructorphp.com/llms/release-notes/v0.12.9.md) - [v0.12.8](https://instructorphp.com/llms/release-notes/v0.12.8.md) - [v0.12.7](https://instructorphp.com/llms/release-notes/v0.12.7.md) - [v0.12.6](https://instructorphp.com/llms/release-notes/v0.12.6.md) - [v0.12.5](https://instructorphp.com/llms/release-notes/v0.12.5.md) - [v0.12.4](https://instructorphp.com/llms/release-notes/v0.12.4.md) - [v0.12.3](https://instructorphp.com/llms/release-notes/v0.12.3.md) - [v0.12.2](https://instructorphp.com/llms/release-notes/v0.12.2.md) - [v0.12.0](https://instructorphp.com/llms/release-notes/v0.12.0.md) - [v0.8.0](https://instructorphp.com/llms/release-notes/v0.8.0.md)