Add LLM token

This commit is contained in:
wangwei
2026-07-02 22:03:39 +08:00
parent e3afb8a07a
commit 52e67b0e7b
36 changed files with 2392 additions and 394 deletions
+36
View File
@@ -133,6 +133,42 @@ class Settings(BaseSettings):
reranker_api_key: str = Field(default="", description="Reranker API 密钥")
reranker_top_k: int = Field(default=5, description="精排后保留的最终结果数量")
# ── HyDE (Hypothetical Document Embeddings) ──────────────────────────────
# When enabled, the agentic and standard RAG pipelines generate a short
# hypothetical answer before retrieval, then embed that text instead of the
# raw query. This closes the vocabulary gap between terse queries and longer
# document passages, typically improving recall by 15-30% on vague queries.
hyde_enabled: bool = Field(default=True, description="启用 HyDE 查询增强(假设文档嵌入)")
hyde_max_tokens: int = Field(default=200, description="HyDE 假设段落最大 token 数")
# Use a lightweight model for HyDE to reduce latency and cost.
# HyDE only needs a short plausible passage — a fast cheap model is sufficient.
# Leave empty to fall back to the main llm_provider / llm_model.
hyde_llm_provider: str = Field(default="", description="HyDE 专用 LLM 提供商(空则复用主 LLM)")
hyde_llm_model: str = Field(default="", description="HyDE 专用 LLM 模型(空则复用主 LLM)")
# ── Agentic RAG (P0-1) ───────────────────────────────────────────────────
# Controls the multi-step reasoning pipeline exposed at /agent/agentic/stream.
agentic_max_sub_queries: int = Field(
default=4,
description="Agentic 模式最大子查询分解数量(compare / multi_hop 意图触发)",
)
agentic_grounding_threshold: float = Field(
default=0.65,
description=(
"引文锚定 fast-path 阈值:avg_score > 此值且 chunks ≥ 3 时跳过 LLM grounding check"
"直接判定为充分;降低此值可让更多问题触发 LLM 二次验证。"
),
)
agentic_intent_max_tokens: int = Field(
default=200, description="意图分析步骤 LLM 最大 token 数"
)
agentic_plan_max_tokens: int = Field(
default=400, description="查询分解步骤 LLM 最大 token 数"
)
agentic_grounding_max_tokens: int = Field(
default=250, description="引文锚定步骤 LLM 最大 token 数"
)
# Keep configuration setup explicit so runtime behavior is easy to reason about.
milvus_index_type: str = Field(default="IVF_FLAT", description="Milvus索引类型")
milvus_nlist: int = Field(default=128, description="Milvus nlist参数")