mirror of
https://github.com/alibaba/higress.git
synced 2026-05-23 20:27:29 +08:00
feat(ai-proxy): support Qwen reranks and conversations paths (#3724)
This commit is contained in:
@@ -71,6 +71,7 @@ const (
|
||||
ApiNameQwenAsyncAIGC ApiName = "qwen/v1/services/aigc"
|
||||
ApiNameQwenAsyncTask ApiName = "qwen/v1/tasks"
|
||||
ApiNameQwenV1Rerank ApiName = "qwen/v1/rerank"
|
||||
ApiNameQwenV1Conversations ApiName = "qwen/v1/conversations"
|
||||
ApiNameGeminiGenerateContent ApiName = "gemini/v1beta/generatecontent"
|
||||
ApiNameGeminiStreamGenerateContent ApiName = "gemini/v1beta/streamgeneratecontent"
|
||||
ApiNameAnthropicMessages ApiName = "anthropic/v1/messages"
|
||||
@@ -118,6 +119,10 @@ const (
|
||||
// Cohere
|
||||
PathCohereV1Rerank = "/v1/rerank"
|
||||
|
||||
// Qwen
|
||||
PathQwenV1Reranks = "/v1/reranks"
|
||||
PathQwenV1Conversations = "/v1/conversations"
|
||||
|
||||
providerTypeMoonshot = "moonshot"
|
||||
providerTypeAzure = "azure"
|
||||
providerTypeAi360 = "ai360"
|
||||
|
||||
@@ -27,9 +27,11 @@ const (
|
||||
qwenChatCompletionPath = "/api/v1/services/aigc/text-generation/generation"
|
||||
qwenTextEmbeddingPath = "/api/v1/services/embeddings/text-embedding/text-embedding"
|
||||
qwenTextRerankPath = "/api/v1/services/rerank/text-rerank/text-rerank"
|
||||
qwenCompatibleTextRerankPath = "/compatible-api/v1/reranks"
|
||||
qwenCompatibleChatCompletionPath = "/compatible-mode/v1/chat/completions"
|
||||
qwenCompatibleCompletionsPath = "/compatible-mode/v1/completions"
|
||||
qwenCompatibleTextEmbeddingPath = "/compatible-mode/v1/embeddings"
|
||||
qwenCompatibleConversationsPath = "/compatible-mode/v1/conversations"
|
||||
qwenCompatibleResponsesPath = "/compatible-mode/v1/responses"
|
||||
qwenCompatibleFilesPath = "/compatible-mode/v1/files"
|
||||
qwenCompatibleRetrieveFilePath = "/compatible-mode/v1/files/{file_id}"
|
||||
@@ -78,7 +80,8 @@ func (m *qwenProviderInitializer) DefaultCapabilities(qwenEnableCompatible bool)
|
||||
string(ApiNameRetrieveBatch): qwenCompatibleRetrieveBatchPath,
|
||||
string(ApiNameQwenAsyncAIGC): qwenAsyncAIGCPath,
|
||||
string(ApiNameQwenAsyncTask): qwenAsyncTaskPath,
|
||||
string(ApiNameQwenV1Rerank): qwenTextRerankPath,
|
||||
string(ApiNameQwenV1Rerank): qwenCompatibleTextRerankPath,
|
||||
string(ApiNameQwenV1Conversations): qwenCompatibleConversationsPath,
|
||||
string(ApiNameAnthropicMessages): qwenAnthropicMessagesPath,
|
||||
}
|
||||
} else {
|
||||
@@ -715,8 +718,11 @@ func (m *qwenProvider) GetApiName(path string) ApiName {
|
||||
return ApiNameQwenAsyncAIGC
|
||||
case strings.Contains(path, qwenAsyncTaskPath):
|
||||
return ApiNameQwenAsyncTask
|
||||
case strings.Contains(path, qwenTextRerankPath):
|
||||
case strings.Contains(path, qwenTextRerankPath),
|
||||
strings.Contains(path, qwenCompatibleTextRerankPath):
|
||||
return ApiNameQwenV1Rerank
|
||||
case strings.Contains(path, qwenCompatibleConversationsPath):
|
||||
return ApiNameQwenV1Conversations
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user