{"id":19355,"date":"2024-03-25T19:59:12","date_gmt":"2024-03-25T11:59:12","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=19355"},"modified":"2025-01-25T20:06:59","modified_gmt":"2025-01-25T12:06:59","slug":"intents","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/pt\/intents\/","title":{"rendered":"Intents \u610f\u56fe \uff1a\u7528zep\u89e3\u91ca\u5982\u4f55\u8ba9\u5927\u6a21\u578b\u7406\u89e3\u5ba2\u6237\u610f\u56fe"},"content":{"rendered":"<p>\u5728\u81ea\u7136\u8bed\u8a00\u5904\u7406(NLP)\u4e2d,\u610f\u56fe\u6307\u7528\u6237\u8868\u8fbe\u67d0\u79cd\u76ee\u7684,\u60f3\u505a\u6216\u60f3\u8981\u7684\u4e8b\u60c5\u3002\u901a\u8fc7\u5206\u6790\u7528\u6237\u53d1\u51fa\u7684\u4fe1\u606f,\u8bc6\u522b\u5176\u80cc\u540e\u7684\u610f\u56fe,\u4ece\u800c\u56de\u590d\u76f8\u5173\u7684\u5185\u5bb9\u3002\u4f8b\u5982\uff0c\u201c\u8ba2\u9910\u201d\u3001\u201c\u67e5\u770b\u5929\u6c14\u201d\u3001\u201c\u6211\u60f3\u53bb\u5df4\u9ece\u201d\u7b49\u90fd\u662f\u6709\u6548\u7684\u610f\u56fe\u3002<\/p>\n<p>\u4e3a\u4e86\u8ba9\u804a\u5929\u673a\u5668\u4eba\u80fd\u591f\u51c6\u786e\u5730\u8bc6\u522b\u7528\u6237\u7684\u610f\u56fe\uff0c\u6211\u4eec\u9700\u8981\u4e3a\u6bcf\u4e2a\u610f\u56fe\u5b9a\u4e49\u4e00\u4e2a\u540d\u79f0\u548c\u4e00\u7ec4\u793a\u4f8b\u3002\u540d\u79f0\u662f\u7528\u6765\u6807\u8bc6\u610f\u56fe\u7684\u552f\u4e00\u6807\u7b7e\uff0c\u793a\u4f8b\u662f\u7528\u6765\u8bad\u7ec3\u804a\u5929\u673a\u5668\u4eba\u8bc6\u522b\u610f\u56fe\u7684\u6837\u672c\u8bed\u53e5\u3002\u540d\u79f0\u5e94\u8be5\u7b80\u6d01\u3001\u660e\u786e\u3001\u4e00\u81f4\uff0c\u793a\u4f8b\u5e94\u8be5\u591a\u6837\u3001\u5178\u578b\u3001\u8986\u76d6\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u4e3a\u201c\u8ba2\u9910\u201d\u8fd9\u4e2a\u610f\u56fe\u5b9a\u4e49\u5982\u4e0b\uff1a<\/p>\n<p>\u540d\u79f0\uff1aorder_food<br \/>\n\u793a\u4f8b\uff1a<\/p>\n<ul>\n<li>\u6211\u60f3\u70b9\u4e00\u4efd\u62ab\u8428<\/li>\n<li>\u8bf7\u7ed9\u6211\u6765\u4e00\u7897\u725b\u8089\u9762<\/li>\n<li>\u4f60\u4eec\u6709\u4ec0\u4e48\u7279\u8272\u83dc\uff1f<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u5b9a\u4e49\u4e0d\u540c\u7684\u610f\u56fe\uff0c\u6211\u4eec\u53ef\u4ee5\u8ba9\u804a\u5929\u673a\u5668\u4eba\u80fd\u591f\u5904\u7406\u591a\u79cd\u7c7b\u578b\u7684\u7528\u6237\u8bf7\u6c42\uff0c\u5e76\u6839\u636e\u4e0d\u540c\u7684\u573a\u666f\u63d0\u4f9b\u5408\u9002\u7684\u56de\u590d\u6216\u52a8\u4f5c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u7528\u6237\u8f93\u5165\u201c\u6211\u60f3\u53bb\u5df4\u9ece\u201d\uff0c\u804a\u5929\u673a\u5668\u4eba\u53ef\u4ee5\u8bc6\u522b\u51fa\u8fd9\u662f\u4e00\u4e2a\u201c\u65c5\u6e38\u201d\u610f\u56fe\uff0c\u5e76\u6839\u636e\u7528\u6237\u7684\u504f\u597d\u548c\u9884\u7b97\u63d0\u4f9b\u5df4\u9ece\u7684\u65c5\u6e38\u4fe1\u606f\u548c\u5efa\u8bae\u3002\u8fd9\u6837\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u66f4\u667a\u80fd\u3001\u66f4\u7075\u6d3b\u3001\u66f4\u4eba\u6027\u5316\u7684\u804a\u5929\u673a\u5668\u4eba\u3002<\/p>\n<p>&nbsp;<\/p>\n<h1>\u4ecb\u7ecd\u610f\u56fe<\/h1>\n<p><a href=\"https:\/\/www.kdjingpai.com\/zep\/\">Zep<\/a> \u7684\u610f\u56fe\u63d0\u53d6\u5668\u8bc6\u522b\u6d88\u606f\u7684\u610f\u56fe\uff0c\u5e76\u5c06\u5176\u6301\u4e45\u5316\u5230\u6d88\u606f\u5143\u6570\u636e\u4e2d\u3002\ud83d\udca1 \u501f\u52a9\u610f\u56fe\u6570\u636e\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u6784\u5efa\u66f4\u4e30\u5bcc\u3001\u66f4\u4e2a\u6027\u5316\u7684\u667a\u80fd\u4f53\u4ea4\u4e92\u3002\ud83d\udd25<\/p>\n<p>\u5728\u81ea\u7136\u8bed\u8a00\u5904\u7406 (NLP) \u9886\u57df\uff0c\u4ece\u6df7\u4e71\u7684\u4eba\u7c7b\u6c9f\u901a\u4e2d\u63d0\u53d6\u610f\u4e49\u4f3c\u4e4e\u4ee4\u4eba\u671b\u800c\u751f\u754f\u3002\u4eca\u5929\uff0c\u6211\u4eec\u5f88\u9ad8\u5174\u63a8\u51fa\u4e00\u9879\u91cd\u8981\u529f\u80fd\u2014\u2014\u201c\u610f\u56fe\u63d0\u53d6\u201d\uff0c\u5b83\u4e3a\u5b9e\u65f6\u7406\u89e3\u63d0\u4f9b\u4e86\u66f4\u6df1\u523b\u7684\u4ef7\u503c\u3002<\/p>\n<p>\u7406\u89e3\u7528\u6237\u7684\u610f\u56fe\u662f\u8bbe\u8ba1\u4efb\u4f55\u5bf9\u8bdd\u5f0f AI \u7cfb\u7edf\u4e2d\uff0c\u6709\u610f\u4e49\u4e14\u4e2a\u6027\u5316\u4ea4\u4e92\u7684\u57fa\u77f3\u3002\u63d0\u53d6\u610f\u56fe\u4e0d\u4ec5\u4ec5\u662f\u8bc6\u522b\u5355\u8bcd\u6216\u77ed\u8bed\uff0c\u66f4\u5728\u4e8e\u7406\u89e3\u7528\u6237\u5728\u7ed9\u5b9a\u8bed\u5883\u4e2d\u7684\u542b\u4e49\u3002\u5927\u8bed\u8a00\u6a21\u578b (LLM) \u5e94\u7528\u7684\u4e2a\u6027\u5316\u9700\u8981\u5728\u6574\u4e2a\u4f1a\u8bdd\u8fc7\u7a0b\u4e2d\u7406\u89e3\u610f\u56fe\u3002<\/p>\n<p>\u6211\u4eec\u65b0\u63a8\u51fa\u7684\u529f\u80fd\uff1a<strong>\u610f\u56fe\u63d0\u53d6<\/strong>\uff0c\u662f\u4f01\u4e1a\u5229\u7528 AI \u9a71\u52a8\u7684\u5ba2\u6237\u4e92\u52a8\u7684\u4e00\u4e2a\u6709\u4ef7\u503c\u7684\u5de5\u5177\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u4ec0\u4e48\u662f\u610f\u56fe\u63d0\u53d6\uff1f<\/h2>\n<p>\u610f\u56fe\u63d0\u53d6\u7684\u6838\u5fc3\u662f\u4e00\u4e2a NLP \u4efb\u52a1\uff0c\u5b83\u6d89\u53ca\u4ece\u7528\u6237\u7684\u8f93\u5165\u4e2d\u8bc6\u522b\u7528\u6237\u7684\u76ee\u6807\u6216\u76ee\u7684\u2014\u2014\u4ed6\u4eec\u60f3\u8981\u505a\u4ec0\u4e48\u3002\u4f8b\u5982\uff0c\u7528\u6237\u53ef\u80fd\u4f1a\u8bf4\uff0c\u201c\u64ad\u653e\u4e00\u4e9b\u6b22\u5feb\u7684\u97f3\u4e50\u201d\u3002\u8fd9\u91cc\u7684\u610f\u56fe\u4e0d\u4ec5\u4ec5\u662f\u201c\u64ad\u653e\u97f3\u4e50\u201d\uff0c\u800c\u662f\u6307\u5b9a\u97f3\u4e50\u7684\u7c7b\u578b\u2014\u2014\u201c\u6b22\u5feb\u7684\u201d\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u610f\u56fe<\/h2>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cZep \u4f1a\u81ea\u52a8\u63d0\u53d6\u6bcf\u6761\u6d88\u606f\u7684\u610f\u56fe\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91 config.yaml \u6765\u5207\u6362\u542f\u7528\u6216\u7981\u7528\u6b64\u529f\u80fd\uff1a<\/p>\n<pre><code>...\r\nextractors:\r\nsummarizer:\r\nenabled: true\r\nentities:\r\nenabled: true\r\nintent:\r\nenabled: true\r\nembeddings:\r\nenabled: true\r\ndimensions: 1536\r\nmodel: \"AdaEmbeddingV2\"\r\n...\r\n<\/code><\/pre>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6240\u6709\u5bf9\u8bdd\u90fd\u5c06\u5305\u542b\u4e00\u4e2a\u201csystem\u201d\u5143\u6570\u636e\uff0c\u5176\u4e2d\u4e3a\u5b58\u50a8\u5728 Zep \u4e2d\u7684\u6bcf\u6761\u6d88\u606f\u8bbe\u7f6e\u4e86\u201cintent\u201d\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u610f\u56fe \u9a71\u52a8\u4e2a\u6027\u5316<\/h2>\n<p><strong>\u4ee5\u4e0b\u793a\u4f8b\u8bf4\u660e\u4e86\u201c\u610f\u56fe\u201d\u5982\u4f55\u4e0e\u5ba2\u6237\u504f\u597d\u76f8\u7ed3\u5408\uff0c\u4ee5\u5e2e\u52a9\u5728\u7535\u5b50\u5546\u52a1\u73af\u5883\u4e2d\u63a8\u52a8\u4e0e\u7528\u6237\u7684\u4e2a\u6027\u5316\u4e92\u52a8\uff1a<\/strong><\/p>\n<pre><code>Human: I'm looking for a new skincare product.\r\nZepMemory:\r\n{\r\n\"uuid\": \"6026b3b7-3755-4d00-89d8-243ecfc45931\",\r\n\"created_at\": \"2023-06-21T02:19:45.577522Z\",\r\n\"role\": \"human\",\r\n\"content\": \"I'm looking for a new skincare product.\",\r\n\"metadata\": {\r\n\"system\": {\r\n\"intent\": \"The subject is expressing a need or want for a new skincare product.\"\r\n}\r\n\"customer_firstname\": \"Alice\",\r\n\"customer_id\": \"KDSJFJDSF\",\r\n\"member_since\": \"03-01-2009\",\r\n\"product_pref_tags\": \"eco-friendly, vegan\"\r\n},\r\n\"token_count\": 11\r\n}\r\nAI: Of course, Alice. Based on your preference for eco-friendly and vegan products, I can recommend a few options. Are you looking for a specific type of skincare product like a cleanser, moisturizer, or serum?\r\nZepMemory:\r\n{\r\n\"uuid\": \"30eb918d-4b3a-42a9-a64b-c79e01f87ec4\",\r\n\"created_at\": \"2023-06-21T02:19:45.577522Z\",\r\n\"role\": \"ai\",\r\n\"content\": \"Of course, Alice. Based on your preference for eco-friendly and vegan products, I can recommend a few options. Are you looking for a specific type of skincare product like a cleanser, moisturizer, or serum?\",\r\n\"metadata\": {\r\n\"system\": {\r\n\"intent\": \"The subject is offering recommendations for eco-friendly and vegan skincare options and inquiring about the specific type of product the person is looking for.\"\r\n}\r\n},\r\n\"token_count\": 46\r\n}\r\nHuman: I'm looking for a good face moisturizer.\r\nZepMemory:\r\n{\r\n\"uuid\": \"f8ec855b-fd59-4084-a3d1-2b81857d5dcd\",\r\n\"created_at\": \"2023-06-21T02:19:45.577522Z\",\r\n\"role\": \"human\",\r\n\"content\": \"I'm looking for a good face moisturizer.\",\r\n\"metadata\": {\r\n\"system\": {\r\n\"intent\": \"The subject is searching for a specific type of facial skincare product.\"\r\n}\r\n},\r\n\"token_count\": 12\r\n}\r\nAI: I recommend the 'Green Goddess' vegan moisturizer. It's a highly rated, eco-friendly product and is particularly effective for dry skin. Would you like to add this to your cart?\r\nZepMemory:\r\n{\r\n\"uuid\": \"4e3d0fe8-5242-4c9c-8891-34636af1e576\",\r\n\"created_at\": \"2023-06-21T02:19:45.577522Z\",\r\n\"role\": \"ai\",\r\n\"content\": \"I recommend the 'Green Goddess' vegan moisturizer. It's a highly rated, eco-friendly product and is particularly effective for dry skin. Would you like to add this to your cart?\",\r\n\"metadata\": {\r\n\"system\": {\r\n\"intent\": \"The subject is making a product recommendation and asking if the listener would like to add it to their cart.\"\r\n}\r\n},\r\n\"token_count\": 40\r\n}\r\nHuman: Great, that should work!\r\nZepMemory:\r\n{\r\n\"uuid\": \"5ec6a546-eec9-4b9d-b03d-11b142600a0a\",\r\n\"created_at\": \"2023-06-21T02:19:45.577522Z\",\r\n\"role\": \"human\",\r\n\"content\": \"Great, that should work!\",\r\n\"metadata\": {\r\n\"system\": {\r\n\"intent\": \"None.\"\r\n}\r\n},\r\n\"token_count\": 8\r\n}\r\n]\r\n}\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h2>\u4e3a\u4ec0\u4e48\u610f\u56fe\u63d0\u53d6\u5982\u6b64\u91cd\u8981\uff1f<\/h2>\n<p><strong>\u968f\u7740 AI \u804a\u5929\u673a\u5668\u4eba\u5728\u5404\u4e2a\u9886\u57df\u7684\u4f7f\u7528\u4e0d\u65ad\u589e\u957f\uff0c\u8fd9\u4e9b\u7cfb\u7edf\u7406\u89e3\u5e76\u6070\u5f53\u54cd\u5e94\u7528\u6237\u610f\u56fe\u7684\u9700\u6c42\u53d8\u5f97\u7a7a\u524d\u91cd\u8981\u3002\u610f\u56fe\u63d0\u53d6\u6709\u52a9\u4e8e\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u589e\u5f3a\u7528\u6237\u4f53\u9a8c\uff1a<\/strong>\u00a0\u901a\u8fc7\u7406\u89e3\u7528\u6237\u7684\u610f\u56fe\uff0cAI \u7cfb\u7edf\u53ef\u4ee5\u63d0\u4f9b\u76f8\u5173\u4e14\u4e2a\u6027\u5316\u7684\u54cd\u5e94\uff0c\u4ece\u800c\u63d0\u9ad8\u7528\u6237\u6ee1\u610f\u5ea6\u3002<\/li>\n<li><strong>\u7b80\u5316\u4e92\u52a8\uff1a<\/strong>\u00a0\u5b83\u901a\u8fc7\u5728\u4ea4\u6d41\u7684\u65e9\u671f\u8bc6\u522b\u7528\u6237\u7684\u76ee\u6807\u6765\u5e2e\u52a9\u7b80\u5316\u5bf9\u8bdd\u3002<\/li>\n<li><strong>\u63d0\u9ad8\u6548\u7387\uff1a<\/strong>\u00a0\u901a\u8fc7\u51c6\u786e\u8bc6\u522b\u7528\u6237\u7684\u610f\u56fe\uff0cAI \u7cfb\u7edf\u53ef\u4ee5\u5f00\u59cb\u4ee3\u8868\u7528\u6237\u6267\u884c\u64cd\u4f5c\uff08\u4f8b\u5982\u8c03\u7528 API\u3001\u66f4\u65b0\u7cfb\u7edf\u7b49\uff09\uff0c\u4ece\u800c\u63d0\u9ad8\u8fd9\u4e9b\u7cfb\u7edf\u7684\u6574\u4f53\u6548\u7387\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u5b9e\u9645\u5e94\u7528<\/h2>\n<p><strong>\u5982\u4eca\u7684\u5927\u8bed\u8a00\u6a21\u578b\u5728\u00a0\u7406\u89e3\u00a0\u3001\u00a0\u63a8\u7406\u00a0\u548c\u00a0\u63a8\u65ad\u00a0\u65b9\u9762\u975e\u5e38\u5f3a\u5927\u3002\u90a3\u4e48\uff0c\u5982\u4f55\u5728\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5229\u7528\u610f\u56fe\u7684\u529b\u91cf\u5462\uff1f<\/strong><\/p>\n<p><strong>\u8ba9\u6211\u4eec\u770b\u4e00\u4e0b\u4e0a\u9762\u7684\u793a\u4f8b\u5982\u4f55\u5728\u5b9e\u9645\u751f\u4ea7\u73af\u5883\u4e2d\u771f\u6b63\u4f7f\u7528\uff1a<\/strong><\/p>\n<pre><code>Human intents that we captured in this conversation:\r\n1: \"The subject is expressing a need or want for a new skincare product.\"\r\n2: \"The subject is searching for a specific type of facial skincare product.\"\r\n<\/code><\/pre>\n<p>\u73b0\u5728\u6211\u4eec\u77e5\u9053\u4e86\u610f\u56fe\uff0c\u6211\u4eec\u53ef\u4ee5\u5206\u6790\u5ba2\u6237\u8fc7\u53bb\u662f\u5982\u4f55\u8fdb\u884c\u8fd9\u4e9b\u5bf9\u8bdd\u7684\uff0c\u5e76\u4f7f\u7528\u5b83\u6765\u5efa\u6a21\u672a\u6765\u4e0e\u5ba2\u6237\u4e92\u52a8\u7684\u51e0\u79cd\u53ef\u80fd\u65b9\u5f0f\uff1a<\/p>\n<ul>\n<li>\u8fc7\u53bb 7 \u5929\u5185\u5bfb\u627e\u62a4\u80a4\u4ea7\u54c1\u7684\u5ba2\u6237<\/li>\n<li>\u8fc7\u53bb\u4e00\u4e2a\u6708\u5185\u641c\u7d22\u9762\u90e8\u62a4\u80a4\u54c1\u7684\u5ba2\u6237<\/li>\n<li>\u5728\u62a4\u80a4\u54c1\u7c7b\u522b\u4e2d\u5bfb\u627e\u7279\u5b9a\u7c7b\u578b\u4ea7\u54c1\u7684\u5ba2\u6237<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u56e0\u6b64\uff0c\u5982\u679c\u6211\u4eec\u60f3\u5c06\u8fc7\u53bb\u4e03\u5929\u5185\u6240\u6709\u5bfb\u627e\u62a4\u80a4\u4ea7\u54c1\u7684\u5ba2\u6237\u805a\u96c6\u5728\u4e00\u8d77\uff0c\u6211\u4eec\u73b0\u5728\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u00a0\u5ba2\u6237\u7fa4\uff0c\u5176\u4e2d\u5305\u62ec\u6240\u6709\u610f\u56fe\u7b26\u5408\u8fd9\u4e9b\u6807\u51c6\u7684\u5ba2\u6237\u3002<\/p>\n<pre><code># Use Zep SDK\r\nsearch_results = await client.asearch_memory(\r\nsession_id=session_id,\r\nsearch_payload=MemorySearchPayload(\r\nmetadata={\r\n\"start_date\": \"2023-06-02\",\r\n\"end_date\": \"2023-06-09\",\r\n\"where\": {\"jsonpath\": \"$[*]['metadata']['system']['intent'] == 'customers looking for skincare'\"},\r\n},\r\n),\r\n)\r\n# You can also use Langchain\r\nsearch_results = retriever.get_relevant_documents(\r\nmetadata={\r\n\"start_date\": \"2023-06-02\",\r\n\"end_date\": \"2023-06-09\",\r\n\"where\": {\"jsonpath\": \"$[*]['metadata']['system']['intent'] == 'customers looking for skincare'\"},\r\n},\r\n)\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u6b64\u5916\uff0c\u60a8\u53ef\u4ee5\u7ee7\u7eed\u8fdb\u884c\u6b64\u5206\u6790\uff0c\u4ee5\u8bc4\u4f30\u6709\u591a\u5c11\u5177\u6709\u8d2d\u4e70\u62a4\u80a4\u4fdd\u6e7f\u971c\u00a0\u610f\u56fe\u00a0\u7684\u5ba2\u6237\u6700\u7ec8\u8d2d\u4e70\u4e86\u5b83\uff0c\u800c\u4e0d\u662f\u4e0d\u540c\u7684\u4f46\u76f8\u5173\u7684\u4ea7\u54c1\uff08\u53ef\u80fd\u662f\u9632\u6652\u971c\uff09\u3002\u8fd9\u53ef\u80fd\u6700\u7ec8\u6210\u4e3a\u73b0\u6709\u5ba2\u6237\u7fa4\u7684\u6539\u8fdb\uff0c\u6216\u8005\u53ef\u80fd\u662f\u989d\u5916\u7684\u5ba2\u6237\u7fa4\u3002<\/p>\n<p>\u7136\u540e\uff0c\u53ef\u4ee5\u5c06\u8fd9\u4e9b\u5ba2\u6237\u7fa4\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6620\u5c04\u5230 Prompt \u65c5\u7a0b\u4e2d\uff0c\u7136\u540e\u53ef\u4ee5\u9488\u5bf9\u7528\u6237\u4e2a\u6027\u5316\u3001\u54c1\u724c\u5fe0\u8bda\u5ea6\u3001\u54cd\u5e94\u4e00\u81f4\u6027\u6216\u5176\u4ed6\u4e1a\u52a1\u6210\u679c\u8fdb\u884c\u4f18\u5316\u3002<\/p>\n<pre><code>from langchain.prompts import PromptTemplate, StringPromptTemplate\r\nfrom langchain.chains import LLMChain\r\n...\r\nprompt = \"\"\"you are a helpful shopping assistant. Use the User preferences and Recommendations to write back responses based on the following rules:\r\n1. If the user has preference for {user_pref} then suggest {recommend_sku} products.\r\n2. Make a helpful {prompt_journey_append} suggestion.\r\n\"\"\"\r\nprompt_journey.prompt = prompt\r\n...\r\n#\r\n# an example of how a prompt_journey may be used\r\n# prompt_journey may be implemented as a structure that\r\n# contains different prompts that can be used and chained <a href=\"https:\/\/www.kdjingpai.com\/together\/\">together<\/a>\r\n# for different customer segments\r\n#\r\nif customer_segment.tag == \"ecofriendly\":\r\nprompt_journey.type = customer_segment.type\r\nprompt_journey.append(\"eco-friendly face cream\")\r\nprompt_journey.suggest_top(eco_sku)\r\nelif customer_segment.tag == \"newcustomer\":\r\nprompt_journey.append(\"face cream with built in sun-protection?)\r\nprompt_journey.suggest_top(spf_facecream)\r\n# Now you can use the chosen prompt\r\nprompt = PromptTemplate.from_template(prompt_journey.prompt)\r\nchain = LLMChain(llm=ChatOpenAI(), prompt=prompt)\r\nchain.run(input=input)\r\n<\/code><\/pre>\n<p>\u4e00\u4e2a\u76f8\u5173\u7684\u81ea\u52a8\u5316\u7cfb\u7edf\u53ef\u80fd\u4f1a\u6839\u636e\u5b66\u4e60\u5230\u7684\u610f\u56fe\u4ee5\u53ca\u60a8\u53ef\u80fd\u5e0c\u671b\u5982\u4f55\u5b9a\u4f4d\u4ea7\u54c1\uff0c\u4e0d\u65ad\u5730\u5bf9\u4e0d\u540c\u7684 Prompt \u8def\u5f84\u8fdb\u884c A\/B \u6d4b\u8bd5\u3002<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u5f00\u59cb\u770b\u5230\u610f\u56fe\u5728\u5206\u7c7b\u5ba2\u6237\u5982\u4f55\u4e0e\u4ea7\u54c1\u4e92\u52a8\u4ee5\u53ca\u6784\u5efa Prompt \u65c5\u7a0b\u65b9\u9762\u7684\u529b\u91cf\uff0cPrompt \u65c5\u7a0b\u53ef\u4ee5\u5728\u8fd9\u4e9b\u4e92\u52a8\u4e2d\u63d0\u4f9b\u66f4\u6df1\u5c42\u6b21\u7684\u4e2a\u6027\u5316\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u667a\u80fd\u4f53\u672a\u6765<\/h2>\n<p>\u610f\u56fe\u7684\u6709\u8da3\u4e4b\u5904\u5728\u4e8e\u5176\u5728\u81ea\u4e3b AI \u667a\u80fd\u4f53\u4e2d\u7684\u6f5c\u529b\u3002\u6211\u4eec\u5f88\u9ad8\u5174\u5c06\u6df1\u5ea6\u4e2a\u6027\u5316\u4e0e\u5de5\u4f5c\u6d41\u7a0b\u76f8\u7ed3\u5408\uff0c\u8fd9\u4e9b\u5de5\u4f5c\u6d41\u7a0b\u53ef\u80fd\u4f1a\u6839\u636e\u5bf9\u8bdd\u4e2d\u8bc6\u522b\u7684\u64cd\u4f5c\u89e6\u53d1 API \u6216\u8c03\u7528\u5916\u90e8\u7cfb\u7edf\u3002\u610f\u56fe\u8fd8\u53ef\u4ee5\u7528\u4e8e\u8c03\u8bd5\u6b65\u9aa4\u3001\u4fee\u526a\u4e0d\u5fc5\u8981\u7684\u667a\u80fd\u4f53\u6267\u884c\u5faa\u73af\u4ee5\u53ca\u4f18\u5316\u5feb\u901f\u667a\u80fd\u4f53\u6267\u884c\u3002<\/p>\n<p>\u7406\u89e3\u610f\u56fe\u662f\u8fd9\u4e9b\u7cfb\u7edf\u4e2d\u4eba\u7c7b\u53ef\u89e3\u91ca\u6027\u3001\u51c6\u786e\u6027\u548c\u53ef\u91cd\u590d\u6027\u7684\u6838\u5fc3\u3002\u8fd9\u4ecd\u7136\u662f\u4e00\u4e2a\u65b0\u5174\u9886\u57df\uff0c\u6211\u4eec\u770b\u5230\u56e2\u961f\u6b63\u5728\u8fc5\u901f\u5730\u8fdb\u884c\u5b9e\u9a8c\u548c\u521b\u65b0\u3002\u6211\u4eec\u5e0c\u671b\u6b64\u529f\u80fd\u5c06\u6709\u52a9\u4e8e\u5404\u79cd\u7528\u4f8b\u3002<\/p>\n<p>\u968f\u7740\u610f\u56fe\u63d0\u53d6\u7684\u63a8\u51fa\uff0c\u6211\u4eec\u7684\u76ee\u6807\u662f\u4f7f\u5bf9\u8bdd\u5f0f AI \u66f4\u52a0\u4e2a\u6027\u5316\u3001\u6709\u610f\u4e49\u548c\u9ad8\u6548\u3002\u7acb\u5373\u8bd5\u7528\uff0c\u8ba9\u6211\u4eec\u77e5\u9053\u60a8\u7684\u60f3\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u81ea\u7136\u8bed\u8a00\u5904\u7406(NLP)\u4e2d,\u610f\u56fe\u6307\u7528\u6237\u8868\u8fbe\u67d0\u79cd\u76ee\u7684,\u60f3\u505a\u6216\u60f3\u8981\u7684\u4e8b\u60c5\u3002\u901a\u8fc7\u5206\u6790\u7528\u6237\u53d1\u51fa\u7684\u4fe1\u606f,\u8bc6\u522b\u5176\u80cc\u540e\u7684\u610f\u56fe,\u4ece\u800c\u56de\u590d\u76f8\u5173\u7684\u5185\u5bb9\u3002\u4f8b\u5982\uff0c\u201c\u8ba2\u9910\u201d\u3001\u201c\u67e5\u770b\u5929\u6c14\u201d\u3001\u201c\u6211\u60f3\u53bb\u5df4\u9ece\u201d\u7b49\u90fd\u662f\u6709\u6548\u7684\u610f\u56fe\u3002 \u4e3a\u4e86\u8ba9\u804a\u5929\u673a\u5668\u4eba\u80fd\u591f\u51c6\u786e\u5730\u8bc6\u522b\u7528\u6237\u7684\u610f\u56fe\uff0c\u6211&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-19355","post","type-post","status-publish","format-standard","hentry","category-knowledge"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/19355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/comments?post=19355"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/19355\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media?parent=19355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/categories?post=19355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/tags?post=19355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}