mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user