-
Notifications
You must be signed in to change notification settings - Fork 663
ai-proxy中对openai兼容服务 不支持/v1/rerank 接口转发; #2168
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
Comments
cc @pepesi |
@liseri openai 似乎没有提供reranker的服务。你有相关文档介绍吗? |
@pepesi 还真是, openai 没有标准的rerank接口; 不过业界普遍使用/rerank; 兼容openai形式就是/v1/rerank; 现在的决策点就来到了,higress中的openai自定义配置中 ,要不要有rerank接口, 如果要有,是使用openai/v1/rerank呢还是使用cohere/v1/rerank呢, 感觉两者都不太合适, 但前者更合适; |
我说的呢,call了半天全是404,,,有解决方法么? |
@liseri openai如果没有rerank接口,在openai这个provider下加这个不是很合适。 目前 ai-proxy 里对于不识别的api是直接透传的,404是因为model-router里没有默认配置这个路径。可以先手动配置下enableOnPathSuffix字段,加上rerank的路径,参考: |
@johnlanni apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
annotations:
higress.io/wasm-plugin-description: Implements the functionality of routing based
on the `model` parameter in the LLM protocol.
higress.io/wasm-plugin-icon: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
higress.io/wasm-plugin-title: AI Model Router
creationTimestamp: "2025-05-07T07:40:18Z"
labels:
higress.io/resource-definer: higress
higress.io/wasm-plugin-built-in: "true"
higress.io/wasm-plugin-category: ai
higress.io/wasm-plugin-name: model-router
higress.io/wasm-plugin-version: 1.0.0
managedFields:
- apiVersion: extensions.higress.io/v1alpha1
fieldsType: FieldsV1
manager: Kubernetes Java Client
operation: Update
time: "2025-05-07T07:40:18Z"
name: model-router-1.0.0
namespace: higress-system
spec:
defaultConfig:
addProviderHeader: x-higress-llm-provider
enable: true
enableOnPathSuffix:
- '/completions'
- '/embeddings'
- '/images/generations'
- '/audio/speech'
- '/fine_tuning/jobs'
- '/moderations'
- '/rerank'
modelToHeader: x-higress-llm-model
defaultConfigDisable: false
failStrategy: FAIL_OPEN
phase: AUTHN
priority: 900
url: oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/model-router:1.0.0
status: {} |
请教下在哪里配置, wasmplugins.model-router.internal配置文件中? 这个文件中我看没有 配 enableOnPathSuffix字段呢 |
@liseri 是的,要改inner这个,增加 enableOnPathSuffix 配置字段,把所有路径后缀都加上 |
@johnlanni 我配置之后没有自动生成wasmplugins.model-router.internal文件,现在只能搜到一个wasmplugins.model-router-1.0.0,这对么? wasmplugins.__names__文件中内容: |
可以的。 |
我都加上了,如下图: docker-standalone模式重启整个Higress后(不只gateway),rerank路由还是404,可能是我对这个配置的理解有偏差,麻烦帮忙瞅一眼(路由配置细节 在下面截图中有体现): rerank失败调用的截图: |
这个 rewrite 我记得是要 ai-proxy 插件支持的请求才会做的。这里我们是不是可以考虑针对 OpenAI 这个类型的请求,如果发现 path 里有 |
个人觉得,内部写死反而搞复杂了,还不如放开让用户可修改(修改思维方式与普通路由rewrite保持一致),提供一个默认推荐值就好; |
因为目前 ai-proxy 支持的就是 openai/v1 的通信协议,识别 /v1 是相对简单的,例如 http://example.com/my/context/path/v1/embedding 转发到后端会自动移除 /my/context/path/v1 这段前缀。 当然插件也可以支持配置一个前缀重写,这个问题不大。 |
我发现代码里有rerank, 是不是可以在ai-proxy中改配置的方式映射过去? |
这个名字不重要的,只是一个内部的的字符串常量,并不会用于请求匹配。 |
这个里核心的问题就如前面 @johnlanni 所说,OpenAI 本身并没有提供 rerank 接口,直接加到 OpenAI 的 provider 里不是很合适。目前相对简单的做法就是加个 rewrite 了。 |
也可以这么想, higress中的openai其实是: 官方openai+兼容性openai, 既然是兼容性 只要该是Openai的与openai一样就行
|
可以的,你可以提个PR @liseri |
我提了一个PR #2205,但我手动进行测试没有成功
|
Why do you need it?
openai兼容服务 支持openai兼容的常用接口,但唯独缺一个rerank接口
How could it be?
openai兼容服务支持/v1/rerank/* ai路由转发
Other related information
简单看了一下代码
rerank貌似只支持cohere
The text was updated successfully, but these errors were encountered: