Thoracic-Radiology-RAG-System / config /default_config.yaml
ZhangNy's picture
Add Space app files
75db650
# Default configuration for the Hugging Face Spaces deployment (API-first).
# IMPORTANT: do NOT put any real API keys in this file. Use Spaces Secrets instead.
# Prebuilt index (vector DB + doc store) stored as a Hugging Face dataset repo.
index:
repo_id: "${RAG_INDEX_REPO_ID:ZhangNy/radiology-index-qwen3-embedding-0.6b}"
revision: "${RAG_INDEX_REVISION:main}"
# Embedding configuration (query-time embeddings must match the index embedding model).
embedding:
type: "api" # Options: "api" or "local" (local requires requirements-dev.txt)
api_base_url: "${EMBED_API_BASE_URL:https://api.siliconflow.cn/v1}"
api_key: "${EMBED_API_KEY:}"
model_name: "${EMBED_MODEL_NAME:Qwen/Qwen3-Embedding-0.6B}"
batch_size: 32
# Reranker configuration (recommended; can be disabled if no key is provided).
reranker:
enabled: true
type: "api" # Options: "api" or "local" (local requires requirements-dev.txt)
api_base_url: "${RERANK_API_BASE_URL:https://api.siliconflow.cn/v1}"
api_key: "${RERANK_API_KEY:}"
model_name: "${RERANK_MODEL_NAME:BAAI/bge-reranker-v2-m3}"
top_k: 10
# LLM configuration (OpenAI-compatible API).
llm:
base_url: "${LLM_BASE_URL:https://poloai.top/v1}"
api_key: "${LLM_API_KEY:}"
model_name: "${LLM_MODEL_NAME:gemini-3-flash-preview}"
temperature: 0.7
max_tokens: 2000
# Storage paths (prefer /data on Spaces; app.py will default RAG_STORAGE_DIR to /data/radiology_rag when available).
storage:
vector_db_path: "${RAG_STORAGE_DIR:./storage}/chroma_db"
doc_store_path: "${RAG_STORAGE_DIR:./storage}/doc_store.db"
# Text splitting parameters (used for index build scripts; kept here for transparency).
processing:
chunk_size: 1024
chunk_overlap: 200
separators:
- "\n\n#### "
- "\n\n### "
- "\n\n## "
- "\n\n"
- "\n"
- " "
- ""
keep_separator: true
# Retrieval configuration
retrieval:
# Default strategy for this Space:
# - balanced_multi_source: includes Wikipedia (encyclopedia) by default
strategy: "balanced_multi_source"
top_k: 20
source_filters:
- "article"
- "case"
- "tutorial"
- "encyclopedia"
search_type: "similarity" # "similarity" or "mmr"
chunk_fetch_multiplier: 3
# MMR parameters (only if search_type == "mmr")
mmr_lambda: 0.5
mmr_fetch_k: 50
# Balanced multi-source retrieval policy
multi_source:
total_top_k: 8
sources_priority: ["article", "case", "encyclopedia", "tutorial"]
article:
candidate_k: 80
max_k: 3
min_score: 0.15
required: true
case:
candidate_k: 80
max_k: 3
min_score: 0.15
required: true
encyclopedia:
candidate_k: 8
max_k: 2
min_score: 0.15
required: true
tutorial:
candidate_k: 20
max_k: 2
min_score: 0.50
required: false
# Encyclopedia configuration (Wikipedia)
encyclopedia:
wikipedia:
language: "en"
user_agent: "RadiologyRAG-Space/1.0"
timeout_s: 10
max_chars_per_doc: 2000
# Citation configuration (no images in this Space; references link to original pages)
citation:
format: "numbered"
max_content_length: 900
# Gradio UI configuration
ui:
title: "Thoracic Radiology RAG System"
description: "Ask questions about thoracic radiology and get answers with citations (articles, cases, tutorials + Wikipedia)."
theme: "soft"
show_retrieved_docs: true
# Logging configuration
logging:
level: "INFO"
format: "%(asctime)s - %(levelname)s - %(message)s"