Implementation:Infiniflow Ragflow DialogService Update Retrieval Settings
Appearance
| Knowledge Sources | |
|---|---|
| Domains | RAG, Information_Retrieval |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
Concrete tool for configuring retrieval parameters on a chat application provided by RAGFlow DialogService.
Description
Uses DialogService.update_by_id to set retrieval fields on the Dialog model. These parameters are read at chat-time by Dealer.retrieval() to control hybrid search behavior.
Usage
Called via REST API to tune retrieval behavior for a chat application.
Code Reference
Source Location
- Repository: ragflow
- File: api/db/db_models.py (L950-955), api/db/services/dialog_service.py (L560-574)
Signature
DialogService.update_by_id(pid: str, data: dict) -> int
# data = {
# "similarity_threshold": 0.2,
# "vector_similarity_weight": 0.3,
# "top_n": 6,
# "top_k": 1024,
# "rerank_id": "bge-reranker-v2-m3"
# }
Import
from api.db.services.dialog_service import DialogService
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| similarity_threshold | float | No | Minimum similarity (default 0.2) |
| vector_similarity_weight | float | No | Vector vs keyword weight (default 0.3) |
| top_n | int | No | Chunks for LLM context (default 6) |
| top_k | int | No | Initial retrieval pool (default 1024) |
| rerank_id | str | No | Reranking model ID |
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", {
"similarity_threshold": 0.3,
"vector_similarity_weight": 0.5,
"top_n": 10,
"rerank_id": "bge-reranker-v2-m3"
})
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment