This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git
The following commit(s) were added to refs/heads/develop by this push:
new e90760c2 refactor(ai-gateway): delete static config providers, this
ability should not be supported on the gateway side (#764)
e90760c2 is described below
commit e90760c2ab45731c197054a42e495b2a9fcfb5fa
Author: Xuetao Li <[email protected]>
AuthorDate: Thu Sep 25 20:03:33 2025 +0800
refactor(ai-gateway): delete static config providers, this ability should
not be supported on the gateway side (#764)
* refactor: delete static config providers, this ability should not be
supported on the gateway side
* refactor: delete static config providers, this ability should not be
supported on the gateway side
* delete redundant
---
docs/ai/endpoint.md | 23 ++++++++++++----------
docs/ai/endpoint_CN.md | 24 ++++++++++++-----------
pkg/model/llm.go | 45 -------------------------------------------
pkg/model/llmprovider.yaml | 38 ------------------------------------
pkg/server/cluster_manager.go | 12 ------------
5 files changed, 26 insertions(+), 116 deletions(-)
diff --git a/docs/ai/endpoint.md b/docs/ai/endpoint.md
index 57b1bb9c..1852ca13 100644
--- a/docs/ai/endpoint.md
+++ b/docs/ai/endpoint.md
@@ -14,12 +14,16 @@ clusters:
- name: "my_llm_cluster"
endpoints:
- id: "provider-1-main"
+ socket_address:
+ domains:
+ - api.deepseek.com
llm_meta:
- provider: "deepseek"
# ... other LLM-specific configuration goes here ...
- id: "provider-2-fallback"
+ socket_address:
+ domains:
+ - api.openai.com/v1
llm_meta:
- provider: "openai"
# ... other LLM-specific configuration goes here ...
```
@@ -27,11 +31,6 @@ clusters:
The llm_meta block holds all the configuration specific to how the gateway
should treat this LLM endpoint.
-`provider`
-
-- Type: `string`
-- Description: A name to identify the LLM provider check [here]() for all
supported llm providers. This is primarily for routing for specific llm
provider.
-
`fallback`
- Type: `boolean`
@@ -126,8 +125,10 @@ clusters:
endpoints:
# --- Primary Endpoint ---
- id: deepseek-primary
+ socket_address:
+ domains:
+ - api.deepseek.com
llm_meta:
- provider: deepseek
# If all retries fail, move to the next endpoint.
fallback: true
# Use a robust retry strategy for the primary endpoint.
@@ -140,9 +141,11 @@ clusters:
multiplier: 2.5
# --- Fallback Endpoint ---
- - id: deepseek-fallback
+ - id: openai-fallback
+ socket_address:
+ domains:
+ - api.openai.com/v1
llm_meta:
- provider: deepseek
# This is the last resort; do not fall back further.
fallback: false
# Use a simpler, faster retry for the fallback.
diff --git a/docs/ai/endpoint_CN.md b/docs/ai/endpoint_CN.md
index 8d3295c3..b0b07e54 100644
--- a/docs/ai/endpoint_CN.md
+++ b/docs/ai/endpoint_CN.md
@@ -13,12 +13,16 @@ clusters:
- name: "my_llm_cluster"
endpoints:
- id: "provider-1-main"
+ socket_address:
+ domains:
+ - api.deepseek.com
llm_meta:
- provider: "deepseek"
# ... 其他特定于 LLM 的配置在此处 ...
- id: "provider-2-fallback"
+ socket_address:
+ domains:
+ - api.openai.com/v1
llm_meta:
- provider: "openai"
# ... 其他特定于 LLM 的配置在此处 ...
```
@@ -26,12 +30,6 @@ clusters:
`llm_meta` 块包含所有与网关应如何处理此 LLM endpoint 相关的特定配置。
-`provider`
-
-- **类型**: `string`
-- **描述**: 用于识别 LLM 提供商的名称,请查看[此处]()了解所有支持的 LLM
- 提供商。这主要用于访问对应的 LLM 提供商。
-
`fallback`
- **类型**: `boolean`
@@ -130,8 +128,10 @@ clusters:
endpoints:
# --- 主endpoint ---
- id: deepseek-primary
+ socket_address:
+ domains:
+ - api.deepseek.com
llm_meta:
- provider: deepseek
# 如果所有重试都失败,则移至下一个 endpoint。
fallback: true
# 为主 endpoint 使用稳健的重试策略。
@@ -144,9 +144,11 @@ clusters:
multiplier: 2.5
# --- fallback endpoint ---
- - id: deepseek-fallback
+ - id: openai-fallback
+ socket_address:
+ domains:
+ - api.openai.com/v1
llm_meta:
- provider: openai
# 这是最后的选择;不要再进一步 fallback。
fallback: false
# 为 fallback endpoint 使用更简单、更快速的重试。
diff --git a/pkg/model/llm.go b/pkg/model/llm.go
index d229f398..c5cedd0b 100644
--- a/pkg/model/llm.go
+++ b/pkg/model/llm.go
@@ -17,18 +17,6 @@
package model
-import (
- "sync"
-)
-
-import (
- perrors "github.com/pkg/errors"
-)
-
-import (
- "github.com/apache/dubbo-go-pixiu/pkg/common/yaml"
-)
-
type (
// LLMMeta LLM metadata for llm call
LLMMeta struct {
@@ -38,37 +26,4 @@ type (
Fallback bool `yaml:"fallback"
json:"fallback" mapstructure:"fallback"`
// Fallback to the next provider if failed
HealthCheckInterval int64 `yaml:"health_check_interval"
json:"health_check_interval" mapstructure:"health_check_interval"
default:"5000"` // HealthCheckInterval the interval for health check
}
-
- LLMProviderDomains struct {
- Providers map[string]LLMProvider `yaml:"providers"
mapstructure:"providers"`
- }
-
- LLMProvider struct {
- Name string `yaml:"name" json:"name"` //
provider' name
- Description string `yaml:"description"
json:"description"`
- BaseUrl string `yaml:"base_url" json:"base_url"`
// Target domain
- Endpoints map[string]string `yaml:"endpoints"
json:"endpoints" mapstructure:"endpoints"` // Endpoints for the provider
- }
-)
-
-var (
- loadLLMProviderDomains sync.Once
- domains *LLMProviderDomains
- err error
)
-
-// GetLLMProviderDomains get llm provider domains
-func GetLLMProviderDomains(id string) (*LLMProvider, error) {
- loadLLMProviderDomains.Do(func() {
- domains = &LLMProviderDomains{}
- err = yaml.UnmarshalYMLConfig("pkg/model/llmprovider.yaml",
domains)
- })
- if err != nil {
- return nil, perrors.Wrap(err, "failed to load llm provider
domains")
- }
-
- if p, ok := domains.Providers[id]; ok {
- return &p, nil
- }
- return nil, perrors.Errorf("provider %s not found", id)
-}
diff --git a/pkg/model/llmprovider.yaml b/pkg/model/llmprovider.yaml
deleted file mode 100644
index 5b913b95..00000000
--- a/pkg/model/llmprovider.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-providers:
- deepseek:
- name: DeepSeek
- description: DeepSeek uses advanced llms to improve search accuracy and
relevance, seamlessly integrating AI into existing search systems for smarter
information retrieval across various fields.
- base_url: api.deepseek.com
- endpoints:
- chatComplete: /chat/completions
- openai:
- name: OpenAI
- description: OpenAI is an AI research and deployment company. Their
mission is to ensure that artificial general intelligence benefits all of
humanity.
- base_url: api.openai.com/v1
- endpoints:
- chatComplete: /chat/completions
- dashscope:
- name: Dashscope
- description: Alibaba Cloud's Tongyi Generative AI Platform (BaiLian)
offers official APIs for the Tongyi series of large models. This
high-performance, cost-effective model service helps you focus on business
innovation, freeing you from the burden of technical operations and maintenance.
- base_url: dashscope.aliyuncs.com/compatible-mode/v1
- endpoints:
- chatComplete: /chat/completions
\ No newline at end of file
diff --git a/pkg/server/cluster_manager.go b/pkg/server/cluster_manager.go
index e4ceeff7..599730d6 100644
--- a/pkg/server/cluster_manager.go
+++ b/pkg/server/cluster_manager.go
@@ -27,7 +27,6 @@ import (
import (
"github.com/apache/dubbo-go-pixiu/pkg/cluster"
"github.com/apache/dubbo-go-pixiu/pkg/cluster/loadbalancer"
- "github.com/apache/dubbo-go-pixiu/pkg/common/constant"
"github.com/apache/dubbo-go-pixiu/pkg/common/yaml"
"github.com/apache/dubbo-go-pixiu/pkg/logger"
"github.com/apache/dubbo-go-pixiu/pkg/model"
@@ -286,17 +285,6 @@ func (s *ClusterStore) AssembleClusterEndpoints(c
*model.ClusterConfig) {
} else if endpoint.Name == "" && endpoint.LLMMeta == nil {
endpoint.Name = fmt.Sprintf("endpoint-%d", i+1)
}
-
- // If the endpoint address and domain are not set, set them
based on the LLM provider.
- // If the endpoint address or domain is set, do not modify them.
- if endpoint.LLMMeta != nil && endpoint.Address.Address ==
constant.PprofDefaultAddress && endpoint.Address.Domains == nil {
- domain, err :=
model.GetLLMProviderDomains(endpoint.LLMMeta.Provider)
- if err != nil {
- logger.Errorf("failed to get llm provider
domains, err: %v", err)
- continue
- }
- endpoint.Address.Domains = []string{domain.BaseUrl}
- }
}
}