Skip to content

feat(catalogs): name the rerank operation and its billing basis - #107

Merged
jackspirou merged 1 commit into
mainfrom
codex/reranking-rnk1
Aug 28, 2026
Merged

feat(catalogs): name the rerank operation and its billing basis#107
jackspirou merged 1 commit into
mainfrom
codex/reranking-rnk1

Conversation

@jackspirou

Copy link
Copy Markdown
Member

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.

ModelTagRerank does 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.

ModelOperationPricing gains SearchUnit and RerankBasis. The price validator holds the pair together:

Recorded basis The validator requires
search-unit a search_unit price
token an input token price
absent that no search_unit price is present
any other value nothing, because it names the value and refuses

A 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 rerank validates, 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

Command Result
go test ./pkg/catalogs/... ok
go test ./... exit 0, 65 packages ok
go build ./... clean
make docs-check all documentation up to date
make openapi regenerated, three enum entries added

Every command ran with GOTOOLCHAIN=go1.25.12, the toolchain continuous integration pins.

https://claude.ai/code/session_0131AtNgj1Qagv2csZGuxPFM

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
@jackspirou
jackspirou merged commit befb6e7 into main Aug 28, 2026
3 checks passed
@jackspirou
jackspirou deleted the codex/reranking-rnk1 branch August 28, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant