Fix SSE route dependency and align architecture docs
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
"""RAG Prompt模板 - 合规问答专用Prompt"""
|
||||
"""Provide service-layer logic for prompt templates."""
|
||||
|
||||
from typing import Dict, Optional
|
||||
from dataclasses import dataclass
|
||||
# Keep service responsibilities explicit so downstream behavior stays predictable.
|
||||
|
||||
|
||||
|
||||
@dataclass
|
||||
class PromptTemplate:
|
||||
"""Prompt模板"""
|
||||
"""Represent the Prompt Template type."""
|
||||
name: str
|
||||
system_prompt: str
|
||||
user_template: str
|
||||
@@ -14,18 +16,9 @@ class PromptTemplate:
|
||||
|
||||
|
||||
class PromptTemplates:
|
||||
"""
|
||||
合规问答Prompt模板库
|
||||
"""Represent the Prompt Templates type."""
|
||||
|
||||
包含多种场景的Prompt模板:
|
||||
- 合规问答(标准)
|
||||
- 条款解读(详细解释)
|
||||
- 合规检查(判断合规状态)
|
||||
- 差异对比(新旧法规对比)
|
||||
- 报告生成(合规报告)
|
||||
"""
|
||||
|
||||
# 合规问答标准模板
|
||||
# Keep service responsibilities explicit so downstream behavior stays predictable.
|
||||
COMPLIANCE_QA = PromptTemplate(
|
||||
name="compliance_qa",
|
||||
system_prompt="""你是合规专家助手,专门解答法规合规问题。
|
||||
@@ -63,7 +56,7 @@ class PromptTemplates:
|
||||
description="标准合规问答模板"
|
||||
)
|
||||
|
||||
# 条款解读模板(详细解释)
|
||||
# Keep service responsibilities explicit so downstream behavior stays predictable.
|
||||
CLAUSE_INTERPRETATION = PromptTemplate(
|
||||
name="clause_interpretation",
|
||||
system_prompt="""你是法规解读专家,负责详细解释法规条款的含义和应用。
|
||||
@@ -96,7 +89,7 @@ class PromptTemplates:
|
||||
description="条款详细解读模板"
|
||||
)
|
||||
|
||||
# 合规检查模板(判断合规状态)
|
||||
# Keep service responsibilities explicit so downstream behavior stays predictable.
|
||||
COMPLIANCE_CHECK = PromptTemplate(
|
||||
name="compliance_check",
|
||||
system_prompt="""你是合规检查专家,负责评估企业行为或产品的合规状态。
|
||||
@@ -140,7 +133,7 @@ class PromptTemplates:
|
||||
description="合规检查评估模板"
|
||||
)
|
||||
|
||||
# 差异对比模板(新旧法规对比)
|
||||
# Keep service responsibilities explicit so downstream behavior stays predictable.
|
||||
COMPARISON = PromptTemplate(
|
||||
name="comparison",
|
||||
system_prompt="""你是法规变更分析专家,负责对比新旧法规版本的差异。
|
||||
@@ -192,7 +185,7 @@ class PromptTemplates:
|
||||
description="法规版本对比模板"
|
||||
)
|
||||
|
||||
# 报告生成模板
|
||||
# Keep service responsibilities explicit so downstream behavior stays predictable.
|
||||
REPORT_GENERATION = PromptTemplate(
|
||||
name="report_generation",
|
||||
system_prompt="""你是合规报告撰写专家,负责生成结构化的合规分析报告。
|
||||
@@ -222,7 +215,7 @@ class PromptTemplates:
|
||||
description="合规报告生成模板"
|
||||
)
|
||||
|
||||
# 文档摘要生成模板
|
||||
# Keep service responsibilities explicit so downstream behavior stays predictable.
|
||||
DOCUMENT_SUMMARY = PromptTemplate(
|
||||
name="document_summary",
|
||||
system_prompt="""你是法规文档摘要专家,负责生成法规文档的核心要点摘要。
|
||||
@@ -263,7 +256,7 @@ class PromptTemplates:
|
||||
|
||||
@classmethod
|
||||
def get_template(cls, name: str) -> Optional[PromptTemplate]:
|
||||
"""获取指定模板"""
|
||||
"""Return template for the Prompt Templates instance."""
|
||||
templates = {
|
||||
"compliance_qa": cls.COMPLIANCE_QA,
|
||||
"clause_interpretation": cls.CLAUSE_INTERPRETATION,
|
||||
@@ -276,7 +269,7 @@ class PromptTemplates:
|
||||
|
||||
@classmethod
|
||||
def list_templates(cls) -> Dict[str, str]:
|
||||
"""列出所有模板"""
|
||||
"""List templates for the Prompt Templates instance."""
|
||||
return {
|
||||
"compliance_qa": cls.COMPLIANCE_QA.description,
|
||||
"clause_interpretation": cls.CLAUSE_INTERPRETATION.description,
|
||||
@@ -288,7 +281,7 @@ class PromptTemplates:
|
||||
|
||||
|
||||
def get_prompt_template(name: str) -> PromptTemplate:
|
||||
"""便捷函数:获取Prompt模板"""
|
||||
"""Return prompt template."""
|
||||
template = PromptTemplates.get_template(name)
|
||||
if not template:
|
||||
raise ValueError(f"不存在的模板: {name}")
|
||||
|
||||
Reference in New Issue
Block a user