mirror of
https://github.com/primedigitaltech/market-assistant.git
synced 2026-07-22 08:01:34 +08:00
fix(pipeline): 探针 LLM 禁止逐条粘贴摘录并收紧上下文条数
Made-with: Cursor
This commit is contained in:
parent
f69e02a27a
commit
872874b41e
@ -99,10 +99,10 @@ PROBE_TEXT_MINING_SYSTEM = """你是用户研究与文本挖掘方向的助手
|
||||
|
||||
**任务**:对 ``groups`` 中**每一项**输出对应 Markdown(**顺序与输入一致**):
|
||||
- 对 ``probe_status == "ok"``:以 ``#### `` + 与该条 ``group`` 字段**完全一致**的细类名作为小节标题(勿用 ``##`` 一级标题);每段约 **100~260 字**。
|
||||
- 内容须包含:①用 **1~2 句**概括该细类评论**主要讨论焦点**(综合词频与 TF-IDF,**不要罗列具体数字**);② **1~2 句**说明共现词对**暗示**哪些维度常一起出现(**非因果**);③若 ``lda.topics`` 非空,**1~2 句**说明主题粗分侧重点,并**明确** LDA 无监督、**不**与矩阵细类一一对应;④至少 **一句**与 ``sample_text_snippets`` 或 ``focus_hit_lines`` 中的**原文信息**呼应(可保留 ``【细类…店铺…】`` 前缀);若无可用摘录则写明。
|
||||
- 内容须包含:①用 **1~2 句**概括该细类评论**主要讨论焦点**(综合词频与 TF-IDF,**不要罗列具体数字**);② **1~2 句**说明共现词对**暗示**哪些维度常一起出现(**非因果**);③若 ``lda.topics`` 非空,**1~2 句**说明主题粗分侧重点,并**明确** LDA 无监督、**不**与矩阵细类一一对应;④用 **1~2 句**体现 ``sample_text_snippets`` / ``focus_hit_lines`` 中的**用户语气与关切**(以**转述**为主);若必须引用原文,**全小节合计**仅 **一处**极短引号内容(**≤40 字**,**不要**输出 ``【细类…SKU…店铺…】`` 等长前缀);若无可用摘录则写明。
|
||||
- 对 ``probe_status == "skipped"``:该小节仅 **一句**说明原因。
|
||||
|
||||
**禁止**:编造数据中未出现的品牌、价格、医学功效或疗效承诺;不要把 ``keyword`` 监测词写进「用户原话」;不要输出 Markdown 表格;不要声称本段与「正式报告 §8 末」完全同源——本任务为**探针解读**。
|
||||
**禁止**:编造数据中未出现的品牌、价格、医学功效或疗效承诺;不要把 ``keyword`` 监测词写进「用户原话」;不要输出 Markdown 表格;不要声称本段与「正式报告 §8 末」完全同源——本任务为**探针解读**。**禁止**把输入里的 ``sample_text_snippets`` / ``focus_hit_lines`` **逐条罗列**、**多条整段复制**到输出(那不是归纳,是重复贴评论)。
|
||||
|
||||
全文末可另起一段 **「使用注意」**(简短):点明开放词表统计与人工阅读差异、LDA 局限、小样本细类不可靠。
|
||||
|
||||
@ -404,7 +404,8 @@ def _truncate_probe_payload(payload: dict[str, Any]) -> dict[str, Any]:
|
||||
g2 = dict(g)
|
||||
sn = g2.get("sample_text_snippets")
|
||||
if isinstance(sn, list):
|
||||
g2["sample_text_snippets"] = [str(x)[:260] for x in sn[:12]]
|
||||
# 条数略减,降低模型「照抄罗列」倾向;仍以转述为主见系统提示
|
||||
g2["sample_text_snippets"] = [str(x)[:200] for x in sn[:6]]
|
||||
groups.append(g2)
|
||||
out["groups"] = groups
|
||||
return out
|
||||
@ -444,10 +445,10 @@ def _merge_snippets_from_comment_groups(
|
||||
row["comment_flat_rows"] = src.get("comment_flat_rows")
|
||||
fh = src.get("focus_hit_lines")
|
||||
if isinstance(fh, list):
|
||||
row["focus_hit_lines"] = [str(x) for x in fh[:14]]
|
||||
row["focus_hit_lines"] = [str(x) for x in fh[:8]]
|
||||
sn = src.get("sample_text_snippets")
|
||||
if isinstance(sn, list):
|
||||
row["sample_text_snippets"] = [str(x)[:300] for x in sn[:14]]
|
||||
row["sample_text_snippets"] = [str(x)[:220] for x in sn[:8]]
|
||||
|
||||
|
||||
def _run_probe_text_mining_llm(
|
||||
@ -694,7 +695,7 @@ def build_markdown(
|
||||
"",
|
||||
"## 探针归纳(大模型 · 文本挖掘专用)",
|
||||
"",
|
||||
"> 输入为探针 JSON(``schema_version``=1):每细类含 **word_freq / tfidf / cooccurrence / lda** 及合并后的 **focus_hit_lines、sample_text_snippets**;"
|
||||
"> 输入为探针 JSON(``schema_version``=1):每细类含 **word_freq / tfidf / cooccurrence / lda** 及合并后的 **focus_hit_lines、sample_text_snippets**(供语境,**非**要求逐条复述);"
|
||||
"系统提示为脚本内 ``PROBE_TEXT_MINING_SYSTEM``,**不是** ``COMMENT_GROUPS_SYSTEM``。",
|
||||
"",
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user