Model config: add tools (#16371)

### What problem does this PR solve?

```
{
      "name": "glm-4-flash",
      "max_tokens": 128000,
      "model_types": [
        "chat"
      ],
      "tools": {
        "support": true
      }
}
```

```
RAGFlow(admin)> list provider 'zhipu-ai' models;
+------------+---------------+------------+---------------+----------------+-----------+-----------+
| dimensions | max_dimension | max_tokens | model_type    | name           | thinking  | tools     |
+------------+---------------+------------+---------------+----------------+-----------+-----------+
|            |               | 204800     | [chat]        | glm-5          | supported | supported |
|            |               | 204800     | [chat]        | glm-5-turbo    | supported | supported |
```

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-06-26 11:37:51 +08:00
committed by GitHub
parent 70250ec88c
commit 65afaa1292
3 changed files with 113 additions and 12 deletions

View File

@@ -6652,14 +6652,20 @@
"max_tokens": 128000,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4-flash-250414",
"max_tokens": 128000,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4-long",
@@ -6709,7 +6715,10 @@
"max_tokens": 128000,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4.5-x",
@@ -6731,6 +6740,9 @@
"model_types": [
"chat"
],
"tools": {
"support": true
},
"thinking": {
"default_value": true,
"clear_thinking": true
@@ -37357,6 +37369,9 @@
"glm-5.2",
"glm-5-2"
],
"tools": {
"support": true
},
"model_types": [
"chat"
]
@@ -37371,6 +37386,9 @@
"Z-AI/GLM 5.1",
"GLM 5.1 FP4"
],
"tools": {
"support": true
},
"model_types": [
"chat"
],

View File

@@ -26,6 +26,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -37,6 +40,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -48,6 +54,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -59,6 +68,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -70,6 +82,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -81,6 +96,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -93,6 +111,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -104,6 +125,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -115,6 +139,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -126,6 +153,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -137,6 +167,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -148,6 +181,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -159,6 +195,9 @@
"thinking": {
"default_value": true,
"clear_thinking": true
},
"tools": {
"support": true
}
},
{
@@ -166,56 +205,80 @@
"max_tokens": 131072,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4-0520",
"max_tokens": 131072,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4",
"max_tokens": 131072,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4-airx",
"max_tokens": 8000,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4-air",
"max_tokens": 131072,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4-flash",
"max_tokens": 131072,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4-flashx",
"max_tokens": 131072,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4-long",
"max_tokens": 1000000,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "glm-4v",
@@ -229,7 +292,10 @@
"max_tokens": 8192,
"model_types": [
"chat"
]
],
"tools": {
"support": true
}
},
{
"name": "embedding-2",

View File

@@ -153,12 +153,17 @@ type ModelThinking struct {
ClearThinking bool `json:"clear_thinking"`
}
type ModelTools struct {
Support bool `json:"support"`
}
// Model represents a single LLM model
type Model struct {
Name string `json:"name"`
MaxTokens *int `json:"max_tokens"`
ModelTypes []string `json:"model_types"`
Thinking *ModelThinking `json:"thinking"`
Tools *ModelTools `json:"tools"`
Class *string `json:"class"`
MaxDimension *int `json:"max_dimension"` // used by embedding models
Dimensions []int `json:"dimensions"`
@@ -406,6 +411,12 @@ func (pm *ProviderManager) ListAllModels() ([]map[string]interface{}, error) {
if len(model.Dimensions) > 0 {
modelData["dimensions"] = model.Dimensions
}
if model.Thinking != nil {
modelData["thinking"] = "supported"
}
if model.Tools != nil {
modelData["tools"] = "supported"
}
modelList = append(modelList, modelData)
}
@@ -473,6 +484,12 @@ func (pm *ProviderManager) ListModels(providerName string) ([]map[string]interfa
"max_dimension": model.MaxDimension,
"dimensions": model.Dimensions,
}
if model.Thinking != nil {
modelData["thinking"] = "supported"
}
if model.Tools != nil {
modelData["tools"] = "supported"
}
modelList = append(modelList, modelData)
}