feat(catalogs): name the rerank operation and its billing basis - #107
Merged
Conversation
Add ProviderOperationRerank, the tenth provider operation. A catalog can now state that a provider ranks documents by their relevance to a query. A reranker reads text and writes text, which is also the shape of a chat model, so the media operation table cannot separate the two. Add ModelTagRerank and derive the operation from the tag instead. The chat completions view keeps refusing the same model. Four providers bill reranking in two different units. Add SearchUnit and RerankBasis to ModelOperationPricing so a consumer reads which unit the provider counts rather than guessing from which price is present. The price validator holds the basis and its price together. Claude-Session: https://claude.ai/code/session_0131AtNgj1Qagv2csZGuxPFM
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.
What
Adds
ProviderOperationRerank, the tenth provider operation, so a catalog can state that a provider ranks documents by their relevance to a query.Why the tag decides, and not the modalities
The package already holds a table of dedicated media operations keyed on input and output modalities. A reranker reads text and writes text, which is also the shape of a chat model, so the modalities separate nothing. The table therefore cannot carry the row.
ModelTagRerankdoes the work instead. A model carrying the tag serves the rerank operation and no chat operation. The same model without the tag stays a chat model. One test asserts both halves, because a reranker in the chat list would receive a request it cannot answer.The two billing bases
Four providers publish a rerank endpoint and bill it in two different units. Cohere and OpenRouter bill a search unit. Jina and Voyage bill the tokens they read.
ModelOperationPricinggainsSearchUnitandRerankBasis. The price validator holds the pair together:search-unitsearch_unitpricetokensearch_unitprice is presentA price with no stated basis would leave a consumer to guess the unit, and a basis no constant names would reach a billing path as a silent default.
Scope
The endpoint contract lands here: an endpoint that names
rerankvalidates, it still needs a path, and it accepts an author-specific path. No provider in the shipped catalog serves reranking today, so the endpoint data lands beside the providers that carry it in a follow-up.Evidence
go test ./pkg/catalogs/...go test ./...go build ./...make docs-checkmake openapiEvery command ran with
GOTOOLCHAIN=go1.25.12, the toolchain continuous integration pins.https://claude.ai/code/session_0131AtNgj1Qagv2csZGuxPFM