Skip to content

Add RerankerModel to effect/ai. #10814

Open

Description

@thomasfosterau

What is the problem this feature would solve?

Effect’s AI modules currently have an EmbeddingModel module for generating embeddings. A common use case for these embeddings is to use some sort of vector database, storing them and then querying them. A reranker model, by contrast, is typically given a query (as a string) and a list of candidate documents to rank (as a list of strings), and scores them against the query.

Several of the providers Effect already supports offer reranker models:

What is the feature you are proposing to solve the problem?

A RerankerModel module, analogous to LanguageModel, EmbeddingModel, and DecisionModel.

The input to a reranker model is typically a query (a string) and a list of documents (a string[]). The order of the documents in the list matters for some providers because they either return the index of the document.

The output is typically a list of the documents and their scores. As far as I know, most providers return the score as a float in the range [0, 1], but Cloudflare seems to leave that for the caller.

What alternatives have you considered?

I got Claude to throw together a prototype and released it as an NPM package, so this can be easily solved outside of Effect itself: https://github.com/thomasfosterau/effect-ext/blob/trunk/packages/effect-ext/src/RerankerModel.ts

Activity

  1. added
    enhancement
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions