重构项目为LLM 驱动
This commit is contained in:
26
src/doc/prompt.py
Normal file
26
src/doc/prompt.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
LLM 提示词模板
|
||||
|
||||
从 src/prompts/ 目录加载 .md 文件作为提示词模板。
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
_PROMPTS_DIR = os.path.join(os.path.dirname(__file__), "prompts")
|
||||
|
||||
|
||||
def _load_prompt(filename: str) -> str:
|
||||
"""从 prompts 目录加载提示词文件内容。"""
|
||||
path = os.path.join(_PROMPTS_DIR, filename)
|
||||
with open(path, encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def build_invoice_system_prompt() -> str:
|
||||
"""构建发票提取系统提示词。"""
|
||||
return _load_prompt("invoice_system.md")
|
||||
|
||||
|
||||
def build_card_info_system_prompt() -> str:
|
||||
"""构建支付截图信息提取系统提示词。"""
|
||||
return _load_prompt("card_info_system.md")
|
||||
Reference in New Issue
Block a user