Add `RerankerModel` to `effect/ai`.

未关闭
#10,814 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
ai

调研方向

Start by reading the existing EmbeddingModel, LanguageModel and DecisionModel modules in the effect/ai package to see the shared interface shape and how provider implementations plug in. The linked prototype at thomasfosterau/effect-ext (RerankerModel.ts) sketches a possible API for query-plus-documents input and scored results. Done means the new module exists alongside the others, is exported, and has at least one provider integration plus tests; expect to discuss the public interface with maintainers before writing much code.

由索引模型根据 Issue 内容生成。

描述

enhancement
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

主要语言
TypeScript
星标
16.7k
派生
808
平均合并
21 小时 22 分钟
30 天内合并 PR
486

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Effect-TS/effect 的其他 Issue

查看 Effect-TS/effect 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。