您的位置:首页 > 手游攻略 > 2026 技术信号:Prompt 工程进入版本化阶段:提示词管理成为大模型应用新基础设施

2026 技术信号:Prompt 工程进入版本化阶段:提示词管理成为大模型应用新基础设施

作者:互联网  时间: 2026-07-20 09:04:54  

2026 技术信号:Prompt 工程进入版本化阶段,提示词管理成为大模型应用新基础设施

{"type":"doc","content":[{"type":"heading","attrs":{"id":"e16331b0-6303-4790-a109-839db577409e","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"概述"}]},{"type":"paragraph","attrs":{"id":"67de67f3-88d2-4254-b93a-3ca62b17bfe3","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"2026 年,Prompt 工程正在从“手工调提示词”走向“版本化管理”。"}]},{"type":"paragraph","attrs":{"id":"a09cb580-4b8c-4eb8-b220-a2b47b5e1570","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"过去,很多团队开发大模型应用时,提示词往往写在代码里。开发者根据效果不断修改 Prompt,觉得某个版本回答更好,就直接替换原内容。"}]},{"type":"paragraph","attrs":{"id":"7d641a05-02e0-4f94-a943-c34ce46ed91d","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"这种方式在早期 Demo 中没有问题,但进入生产环境后,很快会暴露风险。"}]},{"type":"paragraph","attrs":{"id":"ea6b59fc-6e8e-4d8e-983b-6f1bc37d1ccf","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"提示词改了以后,回答效果为什么变差?"}]},{"type":"paragraph","attrs":{"id":"9dde8cc3-f7b7-4b29-af4c-4f23853f8561","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"哪个版本的 Prompt 对应哪次线上发布?"}]},{"type":"paragraph","attrs":{"id":"d2386cac-d881-412a-9f31-2e534db3eb3b","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"不同业务线是否正在使用不同 Prompt?"}]},{"type":"paragraph","attrs":{"id":"1e165a08-c9a1-4a6e-bb2e-ed8f3ebbfde4","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"某次回答异常,是模型问题、数据问题,还是 Prompt 版本问题?"}]},{"type":"paragraph","attrs":{"id":"1105cabd-8168-4d36-9a8d-b481be8aa618","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"如果没有版本管理,这些问题很难追踪。"}]},{"type":"paragraph","attrs":{"id":"42958d17-35b2-428b-9b78-814aad75cb87","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"因此,Prompt 正在从一段文本变成一种可管理资产。它需要有版本号、适用场景、变量模板、测试集、上线状态和效果记录。"}]},{"type":"paragraph","attrs":{"id":"672ace50-f69e-49c4-bbde-d3b0eb3fe7a3","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"这意味着,Prompt 工程正在进入基础设施阶段。"}]},{"type":"horizontalRule","attrs":{"id":"4acc2783-79a2-4c70-ac3f-8f681f79a30f","isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"aa74f276-0cbf-46fc-910b-34a9804935a5","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"一、为什么 Prompt 需要版本管理?"}]},{"type":"paragraph","attrs":{"id":"5d7a9f30-5daa-48a6-bfa2-89addb707ecb","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"大模型应用的输出,往往由三部分共同决定:"}]},{"type":"orderedList","attrs":{"id":"b6b8f7b8-6722-44a9-af00-30197d5c43db","start":1,"isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"4d400fe8-b77c-471f-ada1-2aedc8fadcd5"},"content":[{"type":"paragraph","attrs":{"id":"e12f1163-7887-4d45-83f8-f881c66d973d","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"模型能力;"}]}]},{"type":"listItem","attrs":{"id":"a18ff25d-51e6-4fc4-9cb3-3bf80ff88ed8"},"content":[{"type":"paragraph","attrs":{"id":"975763b6-0b71-4381-8d64-311a14a4d954","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"输入数据;"}]}]},{"type":"listItem","attrs":{"id":"87798fe1-f218-4597-8471-fe6ceec8b561"},"content":[{"type":"paragraph","attrs":{"id":"7c856813-2565-4428-9c93-ff27449d4284","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Prompt 设计。"}]}]}]},{"type":"paragraph","attrs":{"id":"6a88e1c0-9173-4111-b3d3-a913d145a860","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"很多时候,模型没有变,数据也没有变,但 Prompt 改了一句话,输出效果就可能明显变化。"}]},{"type":"paragraph","attrs":{"id":"2edb99d4-36fb-4cf2-ae61-211398ebae0c","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"这说明 Prompt 本身就是生产系统的一部分。"}]},{"type":"paragraph","attrs":{"id":"7dc68b50-dd0d-48ae-8ef2-2eb00be38b07","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"如果它没有版本、没有测试、没有灰度、没有回滚,就会让大模型应用变得不可控。"}]},{"type":"paragraph","attrs":{"id":"d392ef93-7fa9-420c-a05d-25cf02d5bced","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"下面用 Python 写一个简化版 Prompt 版本管理系统。"}]},{"type":"horizontalRule","attrs":{"id":"4b06a8d1-57c2-45f4-a886-6f449017c0ce","isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"2e7fe94d-14ea-4e81-862a-32062a9d557c","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"二、基础结构:定义 Prompt 模板"}]},{"type":"paragraph","attrs":{"id":"4ecbeaba-9497-4503-b960-bddcf9b994b1","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"第一步是定义 Prompt 模板结构。"}]},{"type":"paragraph","attrs":{"id":"9bd3e8ef-0d14-4731-b7de-34041212f9db","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"每个 Prompt 都需要包含名称、版本、场景、模板内容、变量列表和状态。"}]},{"type":"codeBlock","attrs":{"id":"9a7b613d-3bb8-4085-9371-3e90c8bfe316","language":"javascript","theme":"atom-one-dark","runtimes":0,"isHoverDragHandle":false,"key":"","languageByAi":"javascript"},"content":[{"type":"text","text":"import jsonnimport hashlibnfrom datetime import datetimenfrom typing import Dict, Listnnnclass PromptTemplate:ndef __init__(nself,nname: str,nversion: str,nscene: str,ntemplate: str,nvariables: List[str],nstatus: str = "draft"n):nself.name = namenself.version = versionnself.scene = scenenself.template = templatenself.variables = variablesnself.status = statusnself.created_at = datetime.now().isoformat()nself.template_id = self.build_id()nndef build_id(self):nraw = f"{self.name}-{self.version}-{self.scene}"nnreturn hashlib.md5(nraw.encode("utf-8")n).hexdigest()nndef to_dict(self):nreturn {n"template_id": self.template_id,n"name": self.name,n"version": self.version,n"scene": self.scene,n"template": self.template,n"variables": self.variables,n"status": self.status,n"created_at": self.created_atn}n"}]},{"type":"paragraph","attrs":{"id":"39901f6a-77dc-4110-ae09-5dd7dd14ff7e","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"这一步的意义,是让 Prompt 从普通字符串变成结构化对象。"}]},{"type":"paragraph","attrs":{"id":"4d1cc94a-1366-4fe9-86c3-457cea397228","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"只有结构化之后,才能做版本管理、测试和发布。"}]},{"type":"horizontalRule","attrs":{"id":"56f9a3b4-5991-4778-8544-3db6ed8e1465","isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"656fd142-4763-4cca-82d8-a3b2bfa6a1f8","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"三、Prompt 仓库:保存多个版本"}]},{"type":"paragraph","attrs":{"id":"8e29a342-53a0-4ed6-ab5f-cb79116111c8","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"第二步是定义 Prompt 仓库。"}]},{"type":"paragraph","attrs":{"id":"5a0897a0-c8b1-498d-861f-ade5fa7e6280","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"它负责保存模板、查询模板、更新状态,并找到某个场景下正在运行的正式版本。"}]},{"type":"codeBlock","attrs":{"id":"a6ae3d56-98cd-4425-a08a-8ecc0545c53f","language":"javascript","theme":"atom-one-dark","runtimes":0,"isHoverDragHandle":false,"key":"","languageByAi":"javascript"},"content":[{"type":"text","text":"class PromptRepository:ndef __init__(self):nself.templates = {}nndef add_template(self, prompt_template: PromptTemplate):nkey = prompt_template.template_idnself.templates[key] = prompt_template.to_dict()nnreturn keynndef list_templates(self):nreturn list(self.templates.values())nndef get_template(self, template_id):nreturn self.templates.get(template_id)nndef update_status(self, template_id, status):nif template_id not in self.templates:nraise ValueError("template not found")nnself.templates[template_id]["status"] = statusnself.templates[template_id]["updated_at"] = datetime.now().isoformat()nndef get_active_template(self, name, scene):ncandidates = []nnfor item in self.templates.values():nif item["name"] == name and item["scene"] == scene:nif item["status"] == "active":ncandidates.append(item)nnif not candidates:nreturn Nonenncandidates.sort(nkey=lambda item: item.get("updated_at", item["created_at"]),nreverse=Truen)nnreturn candidates[0]n"}]},{"type":"paragraph","attrs":{"id":"65bafedf-f78c-4532-8dd6-80053999891f","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Prompt 仓库相当于提示词的配置中心。"}]},{"type":"paragraph","attrs":{"id":"ae1ebd61-14e6-489f-b9a4-1b66aa466bf4","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"业务系统不再把 Prompt 写死在代码里,而是从仓库读取当前有效版本。"}]},{"type":"horizontalRule","attrs":{"id":"b2f7d87c-01eb-4f6e-b123-3b36d3a929a3","isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"0b62f546-b1b3-4946-9084-ecdc2ce0408e","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"四、变量渲染:把模板变成最终 Prompt"}]},{"type":"paragraph","attrs":{"id":"e36b3b21-cf8f-48b0-9fa4-bd8090030805","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"第三步是模板渲染。"}]},{"type":"paragraph","attrs":{"id":"26d3bb95-d8a8-49a6-a0d0-ee7b31de1c89","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Prompt 通常不是固定文本,而是包含变量,例如用户问题、上下文、输出格式和限制条件。"}]},{"type":"codeBlock","attrs":{"id":"1b6a3a96-0603-4e42-8984-88fc5aa2e55b","language":"javascript","theme":"atom-one-dark","runtimes":0,"isHoverDragHandle":false,"key":"","languageByAi":"javascript"},"content":[{"type":"text","text":"def render_prompt(template_item, variables: Dict[str, str]):ntemplate = template_item["template"]nrequired_variables = template_item["variables"]nnmissing = [30656.t.kuaisou.com]nnfor var in required_variables:nif var not in variables:nmissing.append(var)nnif missing:nraise ValueError(f"missing variables: {missing}")nnrendered = templatennfor key, value in variables.items():nrendered = rendered.replace(n"{{" key "}}",nvaluen)nnreturn renderedn"}]},{"type":"paragraph","attrs":{"id":"fcca6a65-9119-45b9-916d-5a20bb9874b6","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"变量渲染让 Prompt 可以复用。"}]},{"type":"paragraph","attrs":{"id":"afaf5e03-6fe6-4640-8fda-a85267ea0951","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"同一个模板可以适用于不同用户问题、不同知识库内容和不同业务场景。"}]},{"type":"horizontalRule","attrs":{"id":"8dca4c56-1b76-41d5-9fc2-530cf43a88e6","isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"9e872a62-ceb1-4a11-b1af-2c4adca4688a","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"五、Prompt 测试集:验证版本效果"}]},{"type":"paragraph","attrs":{"id":"89137448-5831-4e2b-90a6-7ffa172374c4","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"第四步是建立测试集。"}]},{"type":"paragraph","attrs":{"id":"e32c1ac0-8322-4859-9a03-ab5cb52478c8","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"一个 Prompt 版本上线前,应该先通过固定问题测试,避免出现明显退化。"}]},{"type":"codeBlock","attrs":{"id":"0f3a5169-984b-4298-9b5a-6a0b92de6610","language":"javascript","theme":"atom-one-dark","runtimes":0,"isHoverDragHandle":false,"key":"","languageByAi":"javascript"},"content":[{"type":"text","text":"TEST_CASES = [n{n"case_id": "case_001",n"scene": "tech_summary",n"variables": {n"content": "RAG 系统正在从静态知识库走向实时更新系统。",n"style": "技术新闻风格"n},n"expected_keywords": ["RAG", "实时更新", "知识库"]n},n{n"case_id": "case_002",n"scene": "tech_summary",n"variables": {n"content": "Serverless Agent 适合短任务和事件驱动场景。",n"style": "开发者社区风格"n},n"expected_keywords": ["Serverless", "Agent", "事件驱动"]n}n]nnndef fake_llm_call(prompt):nreturn f"模拟回答:{prompt[:120]}"nnndef evaluate_output(output, expected_keywords):nhit_count = 0nnfor keyword in expected_keywords:nif keyword in output:nhit_count = 1nnreturn {n"hit_count": hit_count,n"total_keywords": len(expected_keywords),n"score": round(nhit_count / len(expected_keywords) * 100,n2n)n}n"}]},{"type":"paragraph","attrs":{"id":"f09a3eff-7f91-4404-b55a-80dfe9a3fe8e","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"测试集可以帮助团队判断 Prompt 修改是否有效。"}]},{"type":"paragraph","attrs":{"id":"0c4ccb47-eb4a-4b2c-9d8d-01f7e8eeca83","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"它不能完全替代人工评估,但可以减少低级问题进入线上。"}]},{"type":"horizontalRule","attrs":{"id":"7c85800f-0a1d-405a-9944-e2ec3e8a1851","isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"c2b43699-55bf-48ff-bff0-ffc2a9a41b03","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"六、批量评测:比较 Prompt 版本"}]},{"type":"paragraph","attrs":{"id":"663110f4-0cdd-426d-8f93-759f325a1076","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"第五步是批量评测。"}]},{"type":"paragraph","attrs":{"id":"e3ad2fd0-f5cf-43ce-ba44-2f5f4b2bcb13","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"系统会对指定 Prompt 运行测试集,并输出命中率和详细结果。"}]},{"type":"codeBlock","attrs":{"id":"e07d4e5b-d14e-46a1-be7a-7dad150ecbae","language":"javascript","theme":"atom-one-dark","runtimes":0,"isHoverDragHandle":false,"key":"","languageByAi":"javascript"},"content":[{"type":"text","text":"def evaluate_prompt_template(template_item, test_cases):ndetails = []nnfor case in test_cases:nif case["scene"] != template_item["scene"]:ncontinuenntry:nprompt = render_prompt(ntemplate_item,ncase["variables"]n)nnoutput = fake_llm_call(prompt)nneval_result = evaluate_output(noutput,ncase["expected_keywords"]n)nndetails.append({n"case_id": case["case_id"],n"output": output,n"score": eval_result["score"],n"hit_count": eval_result["hit_count"],n"total_keywords": eval_result["total_keywords"]n})nnexcept Exception as error:ndetails.append({n"case_id": case["case_id"],n"error": str(error),n"score": 0n})nnif not details:navg_score = 0nelse:navg_score = round(nsum(item["score"] for item in details) / len(details),n2n)nnreturn {n"template_id": template_item["template_id"],n"name": template_item["name"],n"version": template_item["version"],n"scene": template_item["scene"],n"avg_score": avg_score,n"details": otterly.cnn"evaluate_time": datetime.now().isoformat()n}n"}]},{"type":"paragraph","attrs":{"id":"b6748ef8-13f8-4ad6-9afa-b7e189469286","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"批量评测可以让 Prompt 修改从“凭感觉”变成“有数据”。"}]},{"type":"paragraph","attrs":{"id":"e8f2f967-3e5f-4f3e-ba0e-1b33a81585b4","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"这也是 Prompt 工程化的重要标志。"}]},{"type":"horizontalRule","attrs":{"id":"2260ff94-0856-4c66-9a80-d89e756c6a8a","isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"6e33e7da-901e-4fe2-b46b-9fd3d16f291a","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"七、发布控制:只有通过测试才能上线"}]},{"type":"paragraph","attrs":{"id":"c61d20ae-cc72-4c6b-8565-32a36a4b29c3","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"第六步是发布控制。"}]},{"type":"paragraph","attrs":{"id":"c50dcb2c-ff5f-41cb-84b3-0008691c57b3","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"如果一个 Prompt 版本测试分数过低,就不允许直接设为正式版本。"}]},{"type":"codeBlock","attrs":{"id":"5a6aff5e-443c-4395-a512-4683d27a5c95","language":"javascript","theme":"atom-one-dark","runtimes":0,"isHoverDragHandle":false,"key":"","languageByAi":"javascript"},"content":[{"type":"text","text":"def publish_prompt(repository, template_id, min_score=70):ntemplate_item = repository.get_template(template_id)nnif not template_item:nraise ValueError("template not found")nneval_report = evaluate_prompt_template(ntemplate_item,nTEST_CASESn)nnif eval_report["avg_score"] < min_score:nrepository.update_status(template_id, "rejected")nnreturn {n"status": "rejected",n"reason": "evaluation score too low",n"eval_report": eval_reportn}nnfor item in repository.list_templates():nif item["name"] == template_item["name"]:nif item["scene"] == template_item["scene"]:nif item["status"] == "active":nrepository.update_status(nitem["template_id"],n"archived"n)nnrepository.update_status(template_id, "active")nnreturn {n"status": "published",n"eval_report": eval_report,n"publish_time": datetime.now().isoformat()n}n"}]},{"type":"paragraph","attrs":{"id":"eb1d68d1-4182-4f2e-b0eb-3449fe71e38a","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"发布控制可以降低 Prompt 修改带来的线上风险。"}]},{"type":"paragraph","attrs":{"id":"c6010ffa-f0d1-4483-a19d-c9234eeeea03","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"当新版本上线后,旧版本不会被删除,而是进入归档状态,方便后续回滚和对比。"}]},{"type":"horizontalRule","attrs":{"id":"6a513f51-e634-4888-afe0-e3c7af1734fe","isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"77621c5c-e56d-402c-aca6-a74e33059311","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"八、运行示例:创建、评测和发布 Prompt"}]},{"type":"paragraph","attrs":{"id":"b6aa50a1-1b13-4a2a-a0eb-5e717cc0b9b0","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"最后写一个运行入口。"}]},{"type":"paragraph","attrs":{"id":"f7b10a05-48b4-459a-89db-6bb2aeeedc23","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"这里创建两个 Prompt 版本,并尝试发布新版本。"}]},{"type":"codeBlock","attrs":{"id":"b9bb44a7-b547-4075-96af-57cbe1ef1e43","language":"javascript","theme":"atom-one-dark","runtimes":0,"isHoverDragHandle":false,"key":"","languageByAi":"javascript"},"content":[{"type":"text","text":"if __name__ == "__main__":nrepository = PromptRepository()nntemplate_v1 = PromptTemplate(nname="news_summary_prompt",nversion="v1",nscene="tech_summary",ntemplate="""n请根据以下内容生成技术新闻摘要。nn内容:n{{content}}nn风格:n{{style}}nn要求:n1. 保留核心技术点;n2. 输出简洁;n3. 不要编造信息。n""",nvariables=["content", "style"]n)nntemplate_v2 = PromptTemplate(nname="news_summary_prompt",nversion="v2",nscene="tech_summary",ntemplate="""n你是技术新闻编辑。n请基于以下材料生成一段开发者社区风格的技术摘要。nn材料:n{{content}}nn写作风格:n{{style}}nn请突出:n1. 技术趋势;n2. 工程价值;n3. 未来判断。n""",nvariables=["content", "style"]n)nnid_v1 = repository.add_template(template_v1)nid_v2 = repository.add_template(template_v2)nnresult_v1 = publish_prompt(nrepository,nid_v1,nmin_score=50n)nnresult_v2 = publish_prompt(nrepository,nid_v2,nmin_score=50n)nnactive = repository.get_active_template(nname="news_summary_prompt",nscene="tech_summary"n)nnfinal_report = {n"publish_v1": result_v1,n"publish_v2": result_v2,n"active_template": active,n"all_templates": repository.list_templates(),n"generate_time": datetime.now().isoformat()n}nnprint(json.dumps(nfinal_report,nensure_ascii=False,nindent=2n))n"}]},{"type":"horizontalRule","attrs":{"id":"7cb8db1c-6e51-4d05-bbb0-98edd37abd0a","isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"2d61fe77-1c8a-42bd-a8c8-65a97ed0d843","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"九、趋势判断"}]},{"type":"paragraph","attrs":{"id":"7dc51993-5a9a-42ee-ab9c-73e3c15ccb9b","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"从这套流程可以看到,Prompt 正在从“经验调参”变成“工程资产”。"}]},{"type":"paragraph","attrs":{"id":"29fae87c-fe6b-4813-99ae-a96fe2bf8efe","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"过去,提示词更多依赖个人经验;未来,提示词会像代码一样被管理。"}]},{"type":"paragraph","attrs":{"id":"38ceaaf2-2c81-458d-927c-73288650245e","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"它需要版本号、测试集、发布流程、效果评估和回滚机制。"}]},{"type":"paragraph","attrs":{"id":"ebb9fc6f-2284-49bc-a158-909801d82a82","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"随着大模型应用进入生产环境,Prompt 不再只是写在代码里的几句话,而会成为模型应用稳定性的关键组成部分。"}]},{"type":"paragraph","attrs":{"id":"e9b3013d-d8fe-4942-aa81-c7ebd51edcfc","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"谁能更早建立 Prompt 管理体系,谁就更容易把大模型应用从试点推向长期运行。"}]}]}","createTime":1782898219,"ext":{"closeTextLink":0,"comment_ban":0,"description":"","focusRead":0},"favNum":0,"html":"","isOriginal":0,"likeNum":0,

最新游戏

更多

Copyright©2010-2019. All rights reserved | 波波三国游戏官网|[email protected]

备案编号:湘ICP备2022015115号-4