[Platform] Add Endpoint value object and expose it on Model#2235
Open
tacman wants to merge 1 commit into
Open
Conversation
OskarStark
reviewed
Jun 25, 2026
Introduces an `Endpoint` value object (a contract identifier the model speaks, e.g. "openai.chat_completions" / "openai.responses", plus optional contract-specific defaults) as a first-class concept on `Model`. `Model` gains `getEndpoints()`, `hasEndpoints()`, `getDefaultEndpoint()` (the first declared endpoint), `getEndpoint()` and `supportsEndpoint()`. Catalogs declare a model's endpoints via the new `AbstractModelCatalog::endpointsForModel()` hook, which defaults to none. This is purely additive and backward-compatible: the new constructor parameter is optional and last, the hook defaults to `[]`, and no consumer or bridge is changed — models without endpoints behave exactly as before. This is slice 1 of the endpoint refactor sketched in symfony#2029, carved out as a small, BC-safe PR so the `Endpoint` concept can land and be iterated on independently of the larger dispatch rework.
6d226cc to
dc62d37
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This carves out slice 1 of @chr-hertel's endpoint refactor (#2029) as a small, self-contained, backward-compatible PR — the piece that PR explicitly marks as landable on its own:
The intent is to let the
Endpointshape land and be iterated on now (it's also what batch routing — #1802 — and multi-contract models like OpenAI chat-completions vs. responses would hang off of), independently of the larger dispatch rework.What's here
Endpoint— a value object identifying one contract a model speaks, plus optional contract-specific defaults:Model— a new optional, last constructor parameterarray $endpoints = [], and five accessors:AbstractModelCatalog— a newendpointsForModel(array $modelConfig): arrayhook (defaults to[]), called ingetModel()and forwarded to theModelconstructor, so a catalog can declare a model's endpoints by overriding one method.Backward compatibility
Fully additive:
Modelconstructor parameter is optional and last;(Bridge
Modelsubclasses with custom constructors —Anthropic\Claude, the OpenAI/ScalewayEmbeddings— keep working unchanged; they'll opt into forwarding$endpointsif and when a catalog starts declaring endpoints for them, in a follow-up.)Tests
EndpointTest(construction, defaults, empty-contract guard),ModelTest(all five accessors incl. default-is-first and the unsupported-contract exception), andAbstractModelCatalogTest(default = no endpoints; the hook populates a model's endpoints). Full Platform suite green; PHPStan and CS-Fixer clean.The
EndpointAPI here matches #2029 verbatim so it drops straight into that branch's later slices.