Implementation:Infiniflow Ragflow DialogService Update LLM Settings
Appearance
| Knowledge Sources | |
|---|---|
| Domains | RAG, Conversational_AI |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
Concrete tool for configuring LLM model and generation parameters on a chat application provided by RAGFlow DialogService.
Description
Uses DialogService.update_by_id to set llm_id and llm_setting fields. The LLM catalog (conf/llm_factories.json, 5646 lines) defines 66+ providers including OpenAI, DeepSeek, Moonshot, Tongyi-Qianwen, ZHIPU-AI, and many more.
Usage
Called via REST API to configure or change the LLM for a chat application.
Code Reference
Source Location
- Repository: ragflow
- File: api/apps/dialog_app.py (L34-144), conf/llm_factories.json
Signature
DialogService.update_by_id(pid: str, data: dict) -> int
# data = {
# "llm_id": "gpt-4-turbo",
# "llm_setting": {
# "temperature": 0.1,
# "top_p": 0.3,
# "frequency_penalty": 0.7,
# "presence_penalty": 0.4,
# "max_tokens": 512
# }
# }
Import
from api.db.services.dialog_service import DialogService
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| llm_id | str | No | Model ID (defaults to tenant default) |
| llm_setting.temperature | float | No | Default 0.1 |
| llm_setting.top_p | float | No | Default 0.3 |
| llm_setting.frequency_penalty | float | No | Default 0.7 |
| llm_setting.presence_penalty | float | No | Default 0.4 |
| llm_setting.max_tokens | int | No | Default 512 |
Outputs
| Name | Type | Description |
|---|---|---|
| num | int | Rows updated |
Usage Examples
from api.db.services.dialog_service import DialogService
DialogService.update_by_id("dialog-uuid-123", {
"llm_id": "deepseek-chat",
"llm_setting": {
"temperature": 0.3,
"max_tokens": 1024
}
})
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment