Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Refactor model type to model class (#14426)

Jin Haif670913bb435
diff --git a/conf/models/aliyun.json b/conf/models/aliyun.json
index 521732c75d..b0cad72e4d 100644
--- a/conf/models/aliyun.json
+++ b/conf/models/aliyun.json
@@ -10,7 +10,6 @@
"embedding": "compatible-mode/v1/embeddings",
"models": "api/v1/deployments/models"
},
- "series": "deepseek",
"models": [
{
"name": "qwen-flash",
diff --git a/conf/models/deepseek.json b/conf/models/deepseek.json
index c8789690b2..5fdce2ac9f 100644
--- a/conf/models/deepseek.json
+++ b/conf/models/deepseek.json
@@ -7,7 +7,7 @@
"chat": "chat/completions",
"models": "models"
},
- "series": "deepseek",
+ "class": "deepseek",
"models": [
{
"name": "deepseek-v4-flash",
diff --git a/conf/models/google.json b/conf/models/google.json
index 9e47f152d5..2e4cf30525 100644
--- a/conf/models/google.json
+++ b/conf/models/google.json
@@ -6,7 +6,7 @@
"url_suffix": {
"models": "v1beta/models"
},
- "series": "gemini",
+ "class": "gemini",
"models": [
{
"name": "gemini-2.5-flash",
diff --git a/conf/models/minimax.json b/conf/models/minimax.json
index 801de73dad..9480ac2c06 100644
--- a/conf/models/minimax.json
+++ b/conf/models/minimax.json
@@ -9,7 +9,7 @@
"tts": "v1/t2a_v2",
"files": "v1/files/list"
},
- "series": "minimax",
+ "class": "minimax",
"models": [
{
"name": "minimax-m2.7",
diff --git a/conf/models/moonshot.json b/conf/models/moonshot.json
index 0fc396e733..b9df95e0c2 100644
--- a/conf/models/moonshot.json
+++ b/conf/models/moonshot.json
@@ -8,7 +8,7 @@
"models": "models",
"balance": "users/me/balance"
},
- "series": "kimi",
+ "class": "kimi",
"models": [
{
"name": "kimi-k2.6",
diff --git a/conf/models/openai.json b/conf/models/openai.json
index db78cdc81e..f4c3bdc9b1 100644
--- a/conf/models/openai.json
+++ b/conf/models/openai.json
@@ -6,7 +6,7 @@
"url_suffix": {
"chat": "chat/completions"
},
- "series": "gpt",
+ "class": "gpt",
"models": [
{
"name": "gpt-5.2-pro",
diff --git a/conf/models/volcengine.json b/conf/models/volcengine.json
index 3c16adc88c..c260154c9c 100644
--- a/conf/models/volcengine.json
+++ b/conf/models/volcengine.json
@@ -7,7 +7,7 @@
"chat": "chat/completions",
"files": "files"
},
- "series": "volcengine",
+ "class": "volcengine",
"models": [
{
"name": "doubao-seed-2-0-pro-260215",
diff --git a/conf/models/xai.json b/conf/models/xai.json
index 4b36fb378f..41fe7978f1 100644
--- a/conf/models/xai.json
+++ b/conf/models/xai.json
@@ -6,7 +6,7 @@
"url_suffix": {
"chat": "chat/completions"
},
- "series": "grok",
+ "class": "grok",
"models": [
{
"name": "grok-4",
diff --git a/conf/models/zhipu-ai.json b/conf/models/zhipu-ai.json
index 1027dc5273..52f4a8396a 100644
--- a/conf/models/zhipu-ai.json
+++ b/conf/models/zhipu-ai.json
@@ -11,7 +11,7 @@
"rerank": "rerank",
"files": "files"
},
- "series": "glm",
+ "class": "glm",
"models": [
{
"name": "glm-5",
diff --git a/internal/entity/model.go b/internal/entity/model.go
index 79954e3673..54a28cc08b 100644
--- a/internal/entity/model.go
+++ b/internal/entity/model.go
@@ -159,7 +159,7 @@ type Model struct {
MaxTokens int `json:"max_tokens"`
ModelTypes []string `json:"model_types"`
Thinking *ModelThinking `json:"thinking"`
- Type *string `json:"type"`
+ Class *string `json:"class"`
ModelTypeMap map[string]bool
}
@@ -170,7 +170,7 @@ type Provider struct {
URLSuffix models.URLSuffix `json:"url_suffix"`
Models []*Model `json:"models"`
Features Features `json:"features"`
- Type string `json:"type"`
+ Class string `json:"class"`
ModelDriver models.ModelDriver
}
@@ -228,12 +228,12 @@ func NewProviderManager(dirPath string) (*ProviderManager, error) {
for _, model := range provider.Models {
// if the prefix of mode.Name is matched with keys of modelSupportThinking
- if provider.Type == "" {
+ if provider.Class == "" {
pos := strings.Index(model.Name, "-")
- modelType := model.Name[0:pos]
- model.Type = &modelType
+ modelClass := model.Name[0:pos]
+ model.Class = &modelClass
} else {
- model.Type = &provider.Name
+ model.Class = &provider.Name
}
model.ModelTypeMap = make(map[string]bool)
diff --git a/internal/entity/models/gitee.go b/internal/entity/models/gitee.go
index 2ea88a450a..d1ceee5f5a 100644
--- a/internal/entity/models/gitee.go
+++ b/internal/entity/models/gitee.go
@@ -172,7 +172,7 @@ func (z *GiteeModel) Chat(modelName, message *string, apiConfig *APIConfig, chat
return nil, fmt.Errorf("invalid content format")
}
- thinking, answer := GetThinkingAndAnswer(chatModelConfig.ModelType, &content)
+ thinking, answer := GetThinkingAndAnswer(chatModelConfig.ModelClass, &content)
chatResponse := &ChatResponse{
Answer: answer,
diff --git a/internal/entity/models/siliconflow.go b/internal/entity/models/siliconflow.go
index 5938d23782..6b6d63d07b 100644
--- a/internal/entity/models/siliconflow.go
+++ b/internal/entity/models/siliconflow.go
@@ -56,7 +56,6 @@ func (z *SiliconflowModel) Name() string {
return "siliconflow"
}
-
// SiliconflowRerankRequest represents SILICONFLOW rerank request
type SiliconflowRerankRequest struct {
Model string `json:"model"`
@@ -192,7 +191,7 @@ func (z *SiliconflowModel) Chat(modelName, message *string, apiConfig *APIConfig
return nil, fmt.Errorf("invalid content format")
}
- thinking, answer := GetThinkingAndAnswer(chatModelConfig.ModelType, &content)
+ thinking, answer := GetThinkingAndAnswer(chatModelConfig.ModelClass, &content)
chatResponse := &ChatResponse{
Answer: answer,
diff --git a/internal/entity/models/types.go b/internal/entity/models/types.go
index 30c3c8cec3..cb9cbec3e7 100644
--- a/internal/entity/models/types.go
+++ b/internal/entity/models/types.go
@@ -60,7 +60,7 @@ type ChatConfig struct {
TopP *float64
DoSample *bool
Stop *[]string
- ModelType *string
+ ModelClass *string
Effort *string
Verbosity *string
}
diff --git a/internal/service/model_service.go b/internal/service/model_service.go
index 97686a94e1..3387cbb9f5 100644
--- a/internal/service/model_service.go
+++ b/internal/service/model_service.go
@@ -643,7 +643,7 @@ func (m *ModelProviderService) ChatToModel(providerName, instanceName, modelName
return nil, common.CodeNotFound, errors.New(fmt.Sprintf("provider %s model %s not found", providerName, modelName))
}
- modelConfig.ModelType = model.Type
+ modelConfig.ModelClass = model.Class
var extra map[string]string
err = json.Unmarshal([]byte(instance.Extra), &extra)