[Platform] Add ModelCard with pricing, region and extra metadata to model catalog#2130
Draft
wachterjohannes wants to merge 1 commit into
Draft
[Platform] Add ModelCard with pricing, region and extra metadata to model catalog#2130wachterjohannes wants to merge 1 commit into
wachterjohannes wants to merge 1 commit into
Conversation
…odel catalog Introduce an optional, objective metadata layer for model catalog entries: ModelCard (pricing, region, plus an open app-owned extra bag) and ModelPricing (cache-aware, per-million-token rates). A catalog entry may declare an optional 'metadata' key; AbstractModelCatalog builds the ModelCard and exposes it via the new Model::getCard(). Fully backward compatible - the card defaults to null. Model subclasses that override the constructor forward the new argument so the card is not silently dropped.
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.
Adds an optional, objective metadata layer to model catalog entries so a
Modelcan answer "what do you cost?" and "where do you run?". This is the data layer that a
cost tracker (token usage → money) and a criteria router (filter by region/tier) build
on; both are out of scope here.
What's added
ModelCatalog\ModelPricing— immutable VO with per-1M-token rates, cache-aware(
cachedInputPerMillion/cacheWritePerMillion, matchingTokenUsage's cachecounters),
currencydefaulting toUSD.ModelCatalog\ModelCard— immutable VO holding platform-blessed facts (pricing,region) plus an open, app-ownedextrabag (get()/all()). Platform code neverbranches on
extracontents.Model::getCard(): ?ModelCard— new optional 4th constructor slot, defaulting tonull.AbstractModelCatalogparses an optionalmetadatakey per entry and attaches thecard.
Usage
Notes
metadatais optional andgetCard()returnsnullwhen absent; no existing catalog entry needs editing.
getCard()(notgetMetadata()) on purpose: the platform alreadyhas a generic mutable
Metadata\Metadatabag exposed viagetMetadata(): Metadataonevery Result/Message (runtime side-channel data). A
ModelCardis a static catalogdescriptor, so it gets its own name to avoid overloading that convention.
catalogs. Model subclasses that override
__construct(Claude, OpenAi/Gemini/ScalewayEmbeddings, Scaleway, Voyage) forward the new argument so the card isn't silently
dropped; a regression test guards this through a subclass.
Possible follow-ups (separate PRs): wiring a pricing source such as
ModelsDev,populating real bridge data, the cost tracker, and the criteria router.