Skip to content

ai-proxy plugin: add rerank api for openai compabable extend #2205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

liseri
Copy link
Contributor

@liseri liseri commented May 9, 2025

Ⅰ. Describe what this PR did

为openai 兼容性扩展 增加rerank接口

Ⅱ. Does this pull request fix one issue?

fixes #2168

Ⅲ. Why don't you add test cases (unit test/integration test)?

手动进行插件测试

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@liseri liseri requested review from cr7258, CH3CHO and rinfx as code owners May 9, 2025 06:51
@liseri
Copy link
Contributor Author

liseri commented May 9, 2025

暂时插件测试还没有通过,先不要合并

@@ -22,6 +22,7 @@ const (
defaultOpenaiAudioSpeech = "/v1/audio/speech"
defaultOpenaiImageGeneration = "/v1/images/generations"
defaultOpenaiModels = "/v1/models"
defaultOpenaiExtendRerankPath = "/v1/rerank"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面的变量名字都没有 Path 字样,这里可以考虑去掉。

caps := m.DefaultCapabilities()

// 添加新的项
caps[string(ApiNameOpenaiExtendRerank)] = defaultOpenaiExtendRerankPath
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释和空行可以删掉,代码本身已经比较容易理解了

@@ -42,6 +42,7 @@ const (

// TODO: 以下是一些非标准的API名称,需要进一步确认是否支持
ApiNameCohereV1Rerank ApiName = "cohere/v1/rerank"
ApiNameOpenaiExtendRerank ApiName = "openai/v1/rerank"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里要格式化一下

@CH3CHO
Copy link
Collaborator

CH3CHO commented May 9, 2025

麻烦 rebase 一下 main 分支。

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.

ai-proxy中对openai兼容服务 不支持/v1/rerank 接口转发;
2 participants