instructor-php
PHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.
Overview
Instructor PHP is a set of framework-agnostic PHP components: Instructor for structured output from LLMs, Polyglot for unified inference across providers, Retrieval for vector search and RAG context, and an Agent SDK, with Laravel and Symfony packages. It is aimed at PHP developers who want typed results from AI services without hand-parsing JSON.
Polyglot includes a typed decision API with a TypeSafe driver. Code such as Decision::using('typesafe') sends questions built from classes like Noul (and the other primitives) and returns typed answers, so a PHP application can call Jev through the same provider abstraction it uses for OpenAI, Anthropic, Gemini or Ollama. Drivers are pluggable, so other decision backends could be added. The project is MIT-licensed and documented on instructorphp.com.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Yes / no | User-defined yes/no question via Polyglot's Decision API | yes · no |
| Choice | User-defined choice question via Polyglot's Decision API(inferred) | — |
How it works
- Build a Questions collection with Noul, Choice or Score
- Call Decision::using('typesafe') with state and questions
- Polyglot's TypeSafe driver calls Jev
- Use typed answers in PHP code
Strengths
- Jev available through the same provider abstraction as LLMs
- Framework integrations for Laravel and Symfony
- Custom drivers can add other decision backends
Caveats
- Decision API is one small part of a large monorepo
- Requires a TypeSafe API key for the TypeSafe driver
Getting started
See packages/polyglot/docs/decision/overview.md and examples/B06_Decisions/DecisionPrimitives/run.php in the repository.At a glance
- Type
- Project
- Status
- production
- Language
- PHP
- Runtime
- library (Laravel, Symfony)
- Has code
- yes
- License
- MIT
Use cases and integrations
How curated lists describe it
A TypeSafe Decision driver within Instructor PHP’s Polyglot module.
logicrw/awesome-jev-projects
Frequently asked questions
How does Instructor PHP use Jev?
Its Polyglot module has a TypeSafe driver for a typed Decision API with Noul, Choice and Score questions.
Can I switch decision providers?
Drivers are pluggable, so you can write your own.
Is it framework-specific?
No, it is framework-agnostic, with optional Laravel and Symfony packages.
Related projects
Ax, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.
PluginproductionTypeScriptEffect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.
ProjectproductionTypeScriptElixir library for unified LLM calls across providers, with an evaluate interface that calls Jev via TypeSafe or OpenRouter.
ProjectproductionElixirSelf-hosted multi-tenant AI agent platform listed as including optional TypeSafe client tools for classification, scoring and yes/no.
LibraryproductionPythonProvider-agnostic TypeScript AI SDK; per list sources, an @tanstack/ai-typesafe adapter exposes Jev decisions through decide().
ServiceproductionTypeScript- SwiftJev★ 9
TypeSafe Jev provider for the SwiftDecision framework, returning validated probability distributions through its DecisionBackend protocol.
ProjectbetaSwift