{"id":24697,"date":"2025-02-21T09:37:19","date_gmt":"2025-02-21T01:37:19","guid":{"rendered":"https:\/\/aif.amtbbs.org\/?p=24697"},"modified":"2025-02-21T09:37:19","modified_gmt":"2025-02-21T01:37:19","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8java%e8%ae%be%e8%ae%a1%e4%b8%80%e5%a5%97%e5%a4%9a%e6%99%ba%e8%83%bd%e4%bd%93%e7%b3%bb%e7%bb%9f","status":"publish","type":"post","link":"https:\/\/aif.amtbbs.org\/index.php\/2025\/02\/21\/24697\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528Java\u8bbe\u8ba1\u4e00\u5957\u591a\u667a\u80fd\u4f53\u7cfb\u7edf"},"content":{"rendered":"<div class=\"article-desc\">\u6211\u4eec\u5c06\u6784\u5efa\u4e00\u6b3e\u54cd\u5e94\u5f0f\u5e94\u7528\uff08\u5bf9\u6765\u81ea\u7528\u6237\u7684\u8f93\u5165\u505a\u51fa\u54cd\u5e94\uff09\uff0c\u5e2e\u52a9\u4eba\u4eec\u89c4\u5212\u81ea\u5df1\u7684\u5b8c\u7f8e\u5047\u671f\u3002\u6b64\u667a\u80fd\u4f53\u5c06\u6839\u636e\u7528\u6237\u6307\u5b9a\u7684\u9910\u98df\u3001\u6d77\u6ee8\u548c\u6d3b\u52a8\u9700\u6c42\uff0c\u5728\u6307\u5b9a\u7684\u56fd\u5bb6\/\u5730\u533a\u5185\u63a8\u8350\u6700\u4f73\u57ce\u5e02\u3002<\/div>\n<div id=\"postspictures\" class=\"article-content\">\n<div id=\"container\" class=\"container am-engine\" data-v-1d7a5742=\"\" data-element=\"root\">\n<p><img data-dominant-color=\"577a98\" data-has-transparency=\"false\" style=\"--dominant-color: #577a98;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-24699\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/c48fdea056af456c4176788155f71345a1891d-300x167-1.jpg\" width=\"300\" height=\"167\" alt=\"\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/c48fdea056af456c4176788155f71345a1891d-300x167-1.jpg 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/c48fdea056af456c4176788155f71345a1891d-300x167-1-150x84.jpg 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>2025\u5e74\u5c06\u6210\u4e3aAI\u667a\u80fd\u4f53\u4e4b\u5e74\u3002\u5728\u672c\u6587\u7684\u573a\u666f\u4e2d\uff0cAI\u667a\u80fd\u4f53\u662f\u4e00\u5957\u80fd\u591f\u5229\u7528AI\u901a\u8fc7\u4e00\u7cfb\u5217\u6b65\u9aa4\u5b9e\u73b0\u76ee\u6807\u7684\u7cfb\u7edf\uff0c\u4e14\u5177\u5907\u5c31\u7ed3\u679c\u8fdb\u884c\u63a8\u7406\u53ca\u66f4\u6b63\u7684\u80fd\u529b\u3002\u5728\u5b9e\u8df5\u4e2d\uff0c\u667a\u80fd\u4f53\u9075\u5faa\u7684\u6b65\u9aa4\u53ef\u603b\u7ed3\u6210\u56fe\u8868\u5f62\u5f0f\u3002<\/p>\n<p class=\"p\">\u6211\u4eec\u5c06\u6784\u5efa\u4e00\u6b3e\u54cd\u5e94\u5f0f\u5e94\u7528\uff08\u5bf9\u6765\u81ea\u7528\u6237\u7684\u8f93\u5165\u505a\u51fa\u54cd\u5e94\uff09\uff0c\u5e2e\u52a9\u4eba\u4eec\u89c4\u5212\u81ea\u5df1\u7684\u5b8c\u7f8e\u5047\u671f\u3002\u6b64\u667a\u80fd\u4f53\u5c06\u6839\u636e\u7528\u6237\u6307\u5b9a\u7684\u9910\u98df\u3001\u6d77\u6ee8\u548c\u6d3b\u52a8\u9700\u6c42\uff0c\u5728\u6307\u5b9a\u7684\u56fd\u5bb6\/\u5730\u533a\u5185\u63a8\u8350\u6700\u4f73\u57ce\u5e02\u3002<\/p>\n<p class=\"p\">\u667a\u80fd\u4f53\u57fa\u672c\u67b6\u6784\u5982\u4e0b\uff1a<\/p>\n<p><img data-dominant-color=\"f5f4f0\" data-has-transparency=\"false\" style=\"--dominant-color: #f5f4f0;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-24700\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/5822ea564757c833f1547768838020f45d4e3c.png\" width=\"598\" height=\"660\" alt=\"\" title=\"\u5982\u4f55\u4f7f\u7528Java\u8bbe\u8ba1\u4e00\u5957\u591a\u667a\u80fd\u4f53\u7cfb\u7edf-AI.x\u793e\u533a\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/5822ea564757c833f1547768838020f45d4e3c.png 598w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/5822ea564757c833f1547768838020f45d4e3c-272x300.png 272w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/5822ea564757c833f1547768838020f45d4e3c-136x150.png 136w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/p>\n<p class=\"p\">\u5728\u7b2c\u4e00\u9636\u6bb5\uff0c\u667a\u80fd\u4f53\u5c06\u5e76\u884c\u6536\u96c6\u4fe1\u606f\uff0c\u6839\u636e\u5355\u4e00\u7279\u5f81\u5bf9\u5404\u57ce\u5e02\u8fdb\u884c\u6392\u540d\u3002\u6700\u540e\u4e00\u6b65\u4ee3\u8868\u6839\u636e\u4fe1\u606f\u9009\u51fa\u7684\u6700\u4f73\u57ce\u5e02\u3002<\/p>\n<p class=\"p\">\u672c\u7528\u4f8b\u4ec5\u4f7f\u7528ChatGPT\u6267\u884c\u6240\u6709\u6b65\u9aa4\uff0c\u5927\u5bb6\u4e5f\u53ef\u6839\u636e\u9700\u6c42\u914d\u5408\u641c\u7d22\u5f15\u64ce\u3002\u8fd9\u91cc\u4f7f\u7528Fibry\u4e2d\u624b\u52a8\u6dfb\u52a0\u7684Actor\u7cfb\u7edf\u4ee5\u663e\u793a\u56fe\u5f62\u5e76\u7ec6\u5316\u63a7\u5236\u5e76\u884c\u6027\u3002<\/p>\n<p class=\"p\">Fibry\u662f\u4e00\u6b3e\u8f7b\u91cf\u5316Actor\u7cfb\u7edf\uff0c\u5141\u8bb8\u53c2\u4e0e\u8005\u8f7b\u677e\u7b80\u5316\u591a\u7ebf\u7a0b\u4ee3\u7801\uff0c\u4e14\u4e0d\u6d89\u53ca\u4efb\u4f55\u4f9d\u8d56\u9879\u3002Fibry\u8fd8\u63d0\u4f9b\u6709\u9650\u72b6\u6001\u673a\uff0c\u8fd9\u91cc\u6211\u4eec\u5c06\u5bf9\u5176\u6269\u5c55\u4ee5\u5b9e\u73b0Java\u7f16\u7a0b\u3002<\/p>\n<p class=\"p\">\u8fd9\u91cc\u5efa\u8bae\u5927\u5bb6\u4f7f\u7528Fibry 3.0.2\uff0c\u5982\uff1a<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_0\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\n1\r\ncompile group: 'eu.lucaventuri', name: 'fibry', version: '3.0.2'<\/code><\/pre>\n<ul id=\"code_id_0\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2>\u8bbe\u5b9a\u63d0\u793a\u8bcd<\/h2>\n<p class=\"p\">\u7b2c\u4e00\u6b65\u662f\u8bbe\u5b9a\u5927\u6a21\u578b\u6240\u9700\u8981\u7684\u63ed\u793a\u8bcd\uff1a<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_1\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Java\r\npublic static class AiAgentVacations {\r\n  private static final String promptFood = \"You are a foodie from {country}. Please tell me the top 10 cities for food in {country}.\";\r\n  private static final String promptActivity = \"You are from {country}, and know it inside out. Please tell me the top 10 cities in {country} where I can {goal}\";\r\n  private static final String promptSea = \"You are an expert traveler, and you {country} inside out. Please tell me the top 10 cities for sea vacations in {country}.\";\r\n  private static final String promptChoice = \"\"\"\r\n    You enjoy traveling, eating good food and staying at the sea, but you also want to {activity}. Please analyze the following suggestions from your friends for a vacation in {country} and choose the best city to visit, offering the best mix of food and sea and where you can {activity}.\r\n    Food suggestions: {food}.\r\n    Activity suggestions: {activity}.\r\n    Sea suggestions: {sea}.\r\n    \"\"\";\r\n\r\n}<\/code><\/pre>\n<ul id=\"code_id_1\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2>\u8bbe\u5b9a\u72b6\u6001<\/h2>\n<p class=\"p\">\u4e00\u822c\u6211\u4eec\u4f1a\u5728\u56db\u4e2a\u6b65\u9aa4\u4e2d\u5404\u8bbe\u5b9a\u4e00\u4e2a\u72b6\u6001\u3002\u4f46\u7531\u4e8e\u5206\u652f\u5f80\u6765\u6bd4\u8f83\u5e38\u89c1\uff0c\u56e0\u6b64\u8fd9\u91cc\u4e13\u95e8\u6dfb\u52a0\u529f\u80fd\u6765\u4ec5\u4f7f\u7528\u4e00\u4e2a\u72b6\u6001\u5904\u7406\u6b64\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u53ea\u9700\u8981\u7528\u5230\u4e24\u4e2a\u72b6\u6001\uff1aCITIES\uff0c\u5373\u6536\u96c6\u4fe1\u606f\u7684\u57ce\u5e02\uff0c\u4ee5\u53caCHOICE\uff0c\u5373\u6211\u4eec\u9009\u5b9a\u7684\u57ce\u5e02\u3002<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_2\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\n1\r\nenum VacationStates { CITIES, CHOICE }<\/code><\/pre>\n<ul id=\"code_id_2\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2>\u8bbe\u5b9a\u4e0a\u4e0b\u6587<\/h2>\n<p class=\"p\">\u667a\u80fd\u4f53\u4e2d\u7684\u5404\u6b65\u9aa4\u5c06\u6536\u96c6\u5b58\u50a8\u5728\u4ed6\u5904\u7684\u4fe1\u606f\uff0c\u6211\u4eec\u79f0\u4e4b\u4e3a\u4e0a\u4e0b\u6587\u3002\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u6bcf\u4e2a\u6b65\u9aa4\u6700\u597d\u5404\u81ea\u72ec\u7acb\uff0c\u4e14\u5c3d\u53ef\u80fd\u5c11\u89e6\u53ca\u5176\u4ed6\u6b65\u9aa4\u3002\u4f46\u65e2\u8981\u4fdd\u6301\u5b9e\u73b0\u7b80\u5355\u3001\u4f7f\u7528\u7684\u4ee3\u7801\u91cf\u4e0d\u5927\uff0c\u540c\u65f6\u4fdd\u6301\u5c3d\u53ef\u80fd\u591a\u7684\u7c7b\u578b\u5b89\u5168\u6027\u4e0e\u7ebf\u7a0b\u5b89\u5168\uff0c\u663e\u7136\u4e0d\u662f\u4ef6\u5bb9\u6613\u7684\u4e8b\u3002<\/p>\n<p class=\"p\">\u56e0\u6b64\u8fd9\u91cc\u9009\u62e9\u5f3a\u5236\u4e0a\u4e0b\u6587\u8bb0\u5f55\uff0c\u63d0\u4f9b\u90e8\u5206\u529f\u80fd\u4ee5\u66f4\u65b0\u8bb0\u5f55\u7684\u503c\uff08\u4f7f\u7528\u4e0b\u9762\u5217\u51fa\u7684\u53cd\u5c04\uff09\uff0c\u540c\u65f6\u7b49\u5f85JEP 468\uff08\u521b\u5efa\u6d3e\u751f\u8bb0\u5f55\uff09\u7684\u5b9e\u73b0\u3002<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_3\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Java\r\npublic record VacationContext(String country, String goal, String food, String activity, String sea, String proposal) {\r\n  public static VacationContext from(String country, String goal) {\r\n    return new VacationContext(country, goal, null, null, null, null);\r\n  }\r\n}<\/code><\/pre>\n<ul id=\"code_id_3\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2>\u8bbe\u5b9a\u8282\u70b9<\/h2>\n<p class=\"p\">\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u8bbe\u5b9a\u667a\u80fd\u4f53\u7684\u903b\u8f91\u3002\u672c\u7528\u4f8b\u5141\u8bb8\u7528\u6237\u4f7f\u7528\u4e24\u79cd\u4e0d\u540c\u7684\u5927\u8bed\u8a00\u6a21\u578b\uff0c\u5982\u7528\u4e8e\u641c\u7d22\u7684\u201c\u666e\u901a\u201d\u6a21\u578b\u548c\u7528\u4e8e\u9009\u62e9\u6b65\u9aa4\u7684\u201c\u63a8\u7406\u201d\u6a21\u578b\u3002<\/p>\n<p class=\"p\">\u5230\u8fd9\u91cc\u5f00\u59cb\u4e0a\u96be\u5ea6\u4e86\uff0c\u56e0\u4e3a\u4fe1\u606f\u5bc6\u5ea6\u5f88\u5927\uff1a<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_4\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Java\r\nAgentNode&lt;VacationStates, VacationContext&gt; nodeFood = state -&gt; state.setAttribute(\"food\", modelSearch.call(\"user\", replaceField(promptFood, state.data(), \"country\")));\r\nAgentNode&lt;VacationStates, VacationContext&gt; nodeActivity = state -&gt; state.setAttribute(\"activity\", modelSearch.call(\"user\", replaceField(promptActivity, state.data(), \"country\")));\r\nAgentNode&lt;VacationStates, VacationContext&gt; nodeSea = state -&gt; state.setAttribute(\"sea\", modelSearch.call(\"user\", replaceField(promptSea, state.data(), \"country\")));\r\nAgentNode&lt;VacationStates, VacationContext&gt; nodeChoice = state -&gt; {\r\n  var prompt = replaceAllFields(promptChoice, state.data());\r\n  System.out.println(\"***** CHOICE PROMPT: \" + prompt);\r\n  return state.setAttribute(\"proposal\", modelThink.call(\"user\", prompt));\r\n};<\/code><\/pre>\n<ul id=\"code_id_4\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u5927\u5bb6\u80af\u5b9a\u5df2\u7ecf\u731c\u5230\uff0cmodelSearch\u4ee3\u8868\u7528\u4e8e\u641c\u7d22\u7684\u6a21\u578b\uff08\u5982ChatGPT 40\uff09\uff0c<\/p>\n<p>modelThink\u4ee3\u8868\u201c\u63a8\u7406\u6a21\u578b\u201d\uff08\u5982ChatGPT o1\uff09\u3002Fibry\u63d0\u4f9b\u4e00\u4e2a\u7b80\u5355\u7684\u5927\u6a21\u578b\u63a5\u53e3\u548c\u4e00\u4e2a\u7b80\u5355\u7684ChatGPT\u5b9e\u73b0\uff0c\u5e76\u901a\u8fc7ChatGpt\u7c7b\u8fdb\u884c\u516c\u5f00\u3002<\/p>\n<p class=\"p\">\u8bf7\u6ce8\u610f\uff0c\u8c03\u7528ChatGPT API\u9700\u8981\u76f8\u5e94\u7684API\u5bc6\u94a5\uff0c\u4f60\u9700\u8981\u4f7f\u7528\u201c-DOPENAI_API_KEY=xxxx\u201d JVM\u53c2\u6570\u6765\u5b9a\u4e49\u6b64\u5bc6\u94a5\u3002<\/p>\n<p class=\"p\">\u8fd8\u6709\u4e00\u4e2a\u8ddfFibry\u7406\u5ff5\u76f8\u5173\u7684\u5c0f\u95ee\u9898\uff0c\u56e0\u4e3a\u5176\u4e0d\u6d89\u53ca\u4efb\u4f55\u4f9d\u8d56\u9879\uff0c\u6240\u4ee5\u8fd9\u5728JSON\u4e2d\u4f1a\u6bd4\u8f83\u9ebb\u70e6\u3002\u8fd9\u91ccFibry\u53ef\u4ee5\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f\u8fd0\u884c\uff1a<\/p>\n<ul data-id=\"u738a58b-H4DkHB9Z\">\n<li data-id=\"ld70c578-mhAXH9Gl\">\u82e5\u68c0\u6d4b\u5230Jackson\uff0cFibry\u5c06\u4f7f\u7528\u5b83\u8fdb\u884c\u53cd\u5c04\u4ee5\u89e3\u6790JSON\u3002<\/li>\n<li data-id=\"ld70c578-fTammMTc\">\u82e5\u672a\u68c0\u6d4b\u5230Jackson\uff0c\u5219\u4f7f\u7528\u7b80\u5355\u7684\u81ea\u5b9a\u4e49\u89e3\u6790\u5668\uff08\u4f3c\u4e4e\u53ef\u4e0eChatGPT\u8f93\u51fa\u642d\u914d\u4f7f\u7528\uff09\u3002\u4f46\u8fd9\u79cd\u65b9\u6cd5\u4ec5\u9002\u7528\u4e8e\u5feb\u901f\u6d4b\u8bd5\uff0c\u4e0d\u63a8\u8350\u5728\u751f\u4ea7\u73af\u5883\u4e0b\u4f7f\u7528\u3002<\/li>\n<li data-id=\"ld70c578-G5cLYng2\">\u6216\u8005\uff0c\u4f60\u4e5f\u53ef\u4ee5\u63d0\u4f9b\u81ea\u5df1\u7684JSON\u5904\u7406\u5668\u5b9e\u73b0\u5e76\u8c03\u7528JsonUtils.setProcessor()\uff0c\u4e5f\u53ef\u67e5\u770bJacksonProcessor\u4ee5\u83b7\u53d6\u7075\u611f\u3002<\/li>\n<li data-id=\"ld70c578-iPQZYEOh\">replaceField()\u00a0\u548c\u00a0replaceAllFields()\u65b9\u6cd5\u7531RecordUtils\u00a0\u5b9a\u4e49\uff0c\u4e14\u53ea\u662f\u66ff\u6362\u63d0\u793a\u8bcd\u4e2d\u6587\u672c\u5185\u5bb9\u7684\u4fbf\u6377\u65b9\u6cd5\uff0c\u4ee5\u4fbf\u6211\u4eec\u5c06\u6570\u636e\u63d0\u4f9b\u7ed9\u5927\u6a21\u578b\u3002\u00a0setAttribute()\u51fd\u6570\u7528\u4e8e\u8bbe\u7f6e\u72b6\u6001\u4e2d\u5c5e\u6027\u7684\u503c\uff0c\u800c\u65e0\u9700\u624b\u52a8\u91cd\u65b0\u521b\u5efa\u8bb0\u5f55\u6216\u5b9a\u4e49\u201cwithers\u201d\u65b9\u6cd5\u3002\u5927\u5bb6\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u65b9\u6cd5\uff0c\u4f8b\u5982\u00a0mergeAttribute(),\u00a0addToList(),\u00a0addToSet()\u548c\u00a0addToMap()\u3002<\/li>\n<\/ul>\n<h2>\u6784\u5efa\u667a\u80fd\u4f53<\/h2>\n<p class=\"p\">\u903b\u8f91\u5df2\u7ecf\u6709\u4e86\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u63cf\u8ff0\u5404\u72b6\u6001\u95f4\u7684\u4f9d\u8d56\u5173\u7cfb\u56fe\u5e76\u6307\u5b9a\u5e0c\u671b\u5b9e\u73b0\u7684\u5e76\u884c\u6027\u3002\u5bf9\u4e8e\u751f\u4ea7\u8fd0\u884c\u72b6\u6001\u4e0b\u7684\u5927\u578b\u591a\u529f\u80fd\u4f53\u7cfb\u7edf\uff0c\u6700\u91cd\u8981\u7684\u5c31\u662f\u65e2\u901a\u8fc7\u5e76\u884c\u6027\u5b9e\u73b0\u6027\u80fd\u6700\u5927\u5316\uff0c\u53c8\u4e0d\u81f4\u8017\u5c3d\u8d44\u6e90\u3001\u8fbe\u5230\u901f\u7387\u9650\u5236\u6216\u8005\u8d85\u8fc7\u5916\u90e8\u7cfb\u7edf\u7684\u627f\u8f7d\u4e0a\u9650\u3002\u8fd9\u5c31\u662fFibry\u7684\u610f\u4e49\u6240\u5728\uff0c\u5b83\u80fd\u8ba9\u6574\u4e2a\u8bbe\u8ba1\u601d\u8def\u975e\u5e38\u660e\u786e\uff0c\u800c\u4e14\u8bbe\u7f6e\u96be\u5ea6\u4e5f\u4e0d\u7b97\u9ad8\u3002<\/p>\n<p class=\"p\">\u9996\u5148\u521b\u5efa\u667a\u80fd\u4f53builder\uff1a<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_5\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nvar builder = AiAgent.&lt;VacationStates, VacationContext&gt;builder(true);<\/code><\/pre>\n<ul id=\"code_id_5\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u5176\u4e2d\u53c2\u6570autoGuards\u00a0\u7528\u4e8e\u5bf9\u72b6\u6001\u8bbe\u7f6e\u81ea\u52a8\u4fdd\u62a4\uff0c\u5176\u4ee5AND\u903b\u8f91\u6267\u884c\uff0c\u4e14\u4ec5\u5728\u5904\u7406\u5b8c\u6240\u6709\u4f20\u5165\u72b6\u6001\u540e\u624d\u4f1a\u6267\u884c\u8be5\u72b6\u6001\u3002<\/p>\n<p class=\"p\">\u82e5\u53c2\u6570\u4e3afalse\uff0c\u5219\u6bcf\u4e2a\u4f20\u5165\u72b6\u6001\u8c03\u7528\u4e00\u6b21\u8be5\u72b6\u6001\u3002<\/p>\n<p><img data-dominant-color=\"f5f4ef\" data-has-transparency=\"false\" style=\"--dominant-color: #f5f4ef;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-24701\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/91effb8805d3361b8e90964a120fe79a99e0a2.png\" width=\"787\" height=\"457\" alt=\"\" title=\"\u5982\u4f55\u4f7f\u7528Java\u8bbe\u8ba1\u4e00\u5957\u591a\u667a\u80fd\u4f53\u7cfb\u7edf-AI.x\u793e\u533a\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/91effb8805d3361b8e90964a120fe79a99e0a2.png 787w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/91effb8805d3361b8e90964a120fe79a99e0a2-300x174.png 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/91effb8805d3361b8e90964a120fe79a99e0a2-150x87.png 150w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/91effb8805d3361b8e90964a120fe79a99e0a2-768x446.png 768w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/p>\n<p class=\"p\">\u5728\u4ee5\u4e0a\u793a\u4f8b\u4e2d\uff0c\u82e5\u76ee\u6807\u662f\u6267\u884c\u4e24\u6b21D\uff0c\u5206\u522b\u5728A\u548cC\u4e4b\u540e\uff0c\u5219autoGuards\u5e94\u5f53\u4e3afalse\u3002\u82e5\u5e0c\u671b\u5728A\u548cC\u4e4b\u540e\u518d\u6267\u884c\u4e00\u6b21D\uff0c\u5219autoGuards\u5e94\u4e3atrue\u3002<\/p>\n<p class=\"p\">\u8fd9\u91cc\u7ee7\u7eed\u8bf4\u56de\u54b1\u4eec\u7684\u5ea6\u5047\u667a\u80fd\u4f53\u3002<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_6\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nbuilder.addState(VacationStates.CHOICE, null, 1, nodeChoice, null);<\/code><\/pre>\n<ul id=\"code_id_6\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u8ba9\u6211\u4eec\u4eceaddState()\u65b9\u6cd5\u5f00\u59cb\u3002\u5b83\u7528\u4e8e\u6307\u5b9a\u67d0\u4e2a\u72b6\u6001\u5e94\u8ddf\u8e2a\u53e6\u4e00\u72b6\u6001\u5e76\u6267\u884c\u67d0\u4e2a\u903b\u8f91\u3002\u6b64\u5916\uff0c\u5927\u5bb6\u8fd8\u53ef\u4ee5\u6307\u5b9a\u5e76\u884c\u6027\uff08\u540e\u6587\u5177\u4f53\u4ecb\u7ecd\uff09\u548cguards\u3002<\/p>\n<p class=\"p\">\u5728\u672c\u793a\u4f8b\u4e2d\uff1a<\/p>\n<ul data-id=\"u738a58b-76SZ90NT\">\n<li data-id=\"ld70c578-n5IglqY0\">\u72b6\u6001\u4e3aCHOICE<\/li>\n<li data-id=\"ld70c578-gZ7JhUFE\">\u65e0\u9ed8\u8ba4\u7684\u540e\u7eed\u72b6\u6001<\/li>\n<li data-id=\"ld70c578-bSpOVNBJ\">\u5e76\u884c\u6027\u4e3a1<\/li>\n<li data-id=\"ld70c578-p1kq9YOZ\">\u65e0guard<\/li>\n<\/ul>\n<p class=\"p\">\u4e0b\u4e00\u72b6\u6001\u4ec5\u4e3a\u9ed8\u8ba4\u72b6\u6001\uff0c\u56e0\u4e3a\u8282\u70b9\u53ef\u80fd\u4f1a\u8986\u76d6\u4e0b\u4e00\u72b6\u6001\uff0c\u56e0\u6b64\u4e0a\u56fe\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u52a8\u6001\u53d8\u66f4\uff0c\u7279\u522b\u662f\u53ef\u4ee5\u6267\u884c\u5faa\u73af\u3002\u4f8b\u5982\u9700\u8981\u91cd\u590d\u67d0\u4e9b\u6b65\u9aa4\u4ee5\u6536\u96c6\u66f4\u591a\u6216\u66f4\u597d\u7684\u4fe1\u606f\u8fd9\u7c7b\u9ad8\u7ea7\u7528\u4f8b\u3002<\/p>\n<p class=\"p\">\u5e76\u884c\u6027\u5728\u8fd9\u91cc\u6ca1\u6709\u6db5\u76d6\uff0c\u56e0\u4e3a\u667a\u80fd\u4f53\u7684\u5355\u6b21\u8fd0\u884c\u4e0d\u592a\u6d89\u53ca\u8fd9\u4e2a\u95ee\u9898\uff0c\u4f46\u5728\u5927\u89c4\u6a21\u751f\u4ea7\u4e2d\u5374\u975e\u5e38\u91cd\u8981\u3002<\/p>\n<p class=\"p\">\u5728Fibry\u4e2d\uff0c\u6bcf\u4e2a\u8282\u70b9\u90fd\u7531\u4e00\u4e2aactor\u652f\u6301\u2014\u2014\u6240\u8c13actor\uff0c\u5176\u5b9e\u5c31\u662f\u4e00\u4e2a\u5305\u542b\u5f85\u5904\u7406\u6d88\u606f\u5217\u8868\u7684\u7ebf\u7a0b\u3002\u6bcf\u6761\u6d88\u606f\u90fd\u4ee3\u8868\u4e00\u4e2a\u6267\u884c\u6b65\u9aa4\u3002\u56e0\u6b64\uff0c\u5e76\u884c\u5ea6\u6307\u53ef\u4ee5\u4e00\u6b21\u6267\u884c\u7684\u6d88\u606f\u6570\u3002\u5177\u4f53\u6765\u8bb2\uff1a<\/p>\n<ul data-id=\"u738a58b-6NDKffkb\">\n<li data-id=\"ld70c578-Qk3F2LE0\">parallelism == 1\u00a0\u4ee3\u8868\u53ea\u6709\u4e00\u4e2a\u7ebf\u7a0b\u7ba1\u7406\u8be5\u6b65\u9aa4\uff0c\u56e0\u6b64\u6bcf\u6b21\u53ea\u80fd\u6267\u884c\u4e00\u6761\u3002<\/li>\n<li data-id=\"ld70c578-TEFaebHC\">parallelism &gt; 1\u00a0\u4ee3\u8868\u6709\u4e00\u4e2a\u7ebf\u7a0b\u6c60\u652f\u6301\u8be5actor\uff0c\u7ebf\u7a0b\u6570\u7531\u7528\u6237\u6307\u5b9a\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f7f\u7528\u865a\u62df\u7ebf\u7a0b\u3002<\/li>\n<li data-id=\"ld70c578-kv2iOpIS\">parallelism == 0\u00a0\u4ee3\u8868\u6bcf\u6761\u6d88\u606f\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u7531\u865a\u62df\u7ebf\u7a0b\u652f\u6301\u7684\u65b0actor\uff0c\u56e0\u6b64\u5e76\u884c\u5ea6\u53ef\u6839\u636e\u9700\u6c42\u5c3d\u91cf\u8c03\u9ad8\u3002<\/li>\n<\/ul>\n<p class=\"p\">\u6bcf\u4e2a\u6b65\u9aa4\u5747\u53ef\u72ec\u7acb\u914d\u7f6e\uff0c\u56e0\u6b64\u5927\u5bb6\u53ef\u4ee5\u7075\u6d3b\u914d\u7f6e\u6027\u80fd\u548c\u8d44\u6e90\u4f7f\u7528\u60c5\u51b5\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679cparallelism != 1\u5219\u53ef\u80fd\u5b58\u5728\u591a\u7ebf\u7a0b\uff0c\u56e0\u4e3a\u4e0eactor\u76f8\u5173\u7684\u7ebf\u7a0b\u9650\u5236\u7ecf\u5e38\u4f1a\u4e22\u5931\u3002<\/p>\n<h2>\u72b6\u6001\u538b\u7f29<\/h2>\n<p class=\"p\">\u5982\u524d\u6240\u8ff0\uff0c\u591a\u4e2a\u72b6\u6001\u5f7c\u6b64\u5173\u8054\u4e5f\u662f\u5e38\u89c1\u60c5\u51b5\uff0c\u6bd4\u5982\u9700\u8981\u5e76\u884c\u6267\u884c\u548c\u52a0\u5165\uff0c\u800c\u540e\u624d\u80fd\u8f6c\u5411\u516c\u5171\u72b6\u6001\u3002\u8fd9\u65f6\u5019\u6211\u4eec\u4e0d\u9700\u8981\u8bbe\u5b9a\u591a\u4e2a\u72b6\u6001\uff0c\u800c\u53ea\u4f7f\u7528\u5176\u4e00\uff1a<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_7\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nbuilder.addStateParallel(VacationStates.CITIES, VacationStates.CHOICE, 1, List.of(nodeFood, nodeActivity, nodeSea), null);<\/code><\/pre>\n<ul id=\"code_id_7\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u770b\u5230CITIES\u00a0\u72b6\u6001\u7531\u4e09\u4e2a\u8282\u70b9\u5b9a\u4e49\uff0c\u5176\u4e2daddStateParallel()\u8d1f\u8d23\u5e76\u884c\u6267\u884c\u5404\u8282\u70b9\u5e76\u7b49\u5f85\u6240\u6709\u8282\u70b9\u6267\u884c\u5b8c\u6210\u3002\u8fd9\u65f6\u5019\u5e94\u8be5\u5728\u6bcf\u4e2a\u8282\u70b9\u4e0a\u5e94\u7528\u5e76\u884c\u6027\uff0c\u501f\u6b64\u83b7\u53d6\u4e09\u4e2a\u5355\u7ebf\u7a0bactor\u3002<\/p>\n<p class=\"p\">\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u4e0d\u4f7f\u7528autoGuards\uff0c\u5219\u53ef\u5c06OR\u00a0\u4e0e\u00a0AND\u903b\u8f91\u6df7\u5408\u8d77\u6765\u3002<\/p>\n<p class=\"p\">\u5982\u679c\u5e0c\u671b\u5408\u5e76\u4e00\u4e9b\u5904\u4e8e\u76f8\u540c\u72b6\u6001\u7684\u8282\u70b9\uff0c\u4f46\u8981\u6c42\u5176\u6309\u987a\u5e8f\u6267\u884c\uff08\u4f8b\u5982\u9700\u8981\u4f7f\u7528\u524d\u4e00\u4e2a\u8282\u70b9\u751f\u6210\u7684\u4fe1\u606f\uff09\uff0c\u5219\u53ef\u4f7f\u7528\u00a0addStateSerial()\u65b9\u6cd5\u3002<\/p>\n<p class=\"p\">AI\u667a\u80fd\u4f53\u7684\u521b\u5efa\u5f88\u7b80\u5355\uff0c\u4f46\u9700\u8981\u6307\u5b9a\u76f8\u5173\u53c2\u6570\uff1a<\/p>\n<ul data-id=\"u738a58b-aQDMiRaE\">\n<li data-id=\"ld70c578-SKlKKBfp\">\u521d\u59cb\u72b6\u6001<\/li>\n<li data-id=\"ld70c578-jENofZb0\">\u6700\u7ec8\u72b6\u6001\uff08\u53ef\u4ee5\u4e3anull\uff09<\/li>\n<li data-id=\"ld70c578-GQfTl5fK\">\u5c3d\u91cf\u5e76\u884c\u6267\u884c\u7684\u72b6\u6001\u6807\u8bb0<\/li>\n<\/ul>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_8\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nvar vacationAgent = builder.build(VacationStates.CITIES, null, true);<\/code><\/pre>\n<ul id=\"code_id_8\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u6709\u4e86\u667a\u80fd\u4f53\uff0c\u8c03\u7528\u8fdb\u7a0b\u5373\u53ef\u4f7f\u7528\uff1a<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_9\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nvacationsAgent.process(AiAgentVacations.VacationContext.from(\"Italy\", \"Dance Salsa and Bachata\"), (state, info) -&gt; System.out.println(state + \": \" + info));<\/code><\/pre>\n<ul id=\"code_id_9\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u6b64\u7248\u672c\u7684\u00a0process()\u00a0\u9700\u8981\u4e24\u4e2a\u53c2\u6570\uff1a<\/p>\n<ul data-id=\"u738a58b-YYVbHA0Q\">\n<li data-id=\"ld70c578-iB9S1q2O\">\u521d\u59cb\u72b6\u6001\uff0c\u5176\u4e2d\u5305\u542b\u667a\u80fd\u4f53\u6267\u884c\u64cd\u4f5c\u6240\u9700\u8981\u7684\u4fe1\u606f<\/li>\n<li data-id=\"ld70c578-d3nyWkuM\">\u53ef\u9009\u76d1\u542c\u5668\uff0c\u652f\u6301\u5982\u6253\u5370\u5404\u6b65\u9aa4\u8f93\u51fa\u7b49\u9700\u6c42<\/li>\n<\/ul>\n<p class=\"p\">\u82e5\u9700\u8981\u542f\u52a8\u64cd\u4f5c\u5e76\u68c0\u67e5\u5176\u540e\u7eed\u8fd4\u56de\u503c\uff0c\u53ef\u4ee5\u4f7f\u7528\u00a0processAsync()\u3002<\/p>\n<p class=\"p\">\u5982\u679c\u5927\u5bb6\u5173\u6ce8\u5e76\u884c\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u5efa\u8bae\u5404\u4f4d\u67e5\u770b\u5355\u5143\u6d4b\u8bd5\u00a0TestAIAgent\u3002\u5b83\u4f1a\u6a21\u62df\u8282\u70b9\u4f11\u7720\u4e00\u6bb5\u65f6\u95f4\u540e\u7684\u667a\u80fd\u4f53\uff0c\u501f\u6b64\u67e5\u770b\u5404\u9009\u9879\u7684\u5b9e\u9645\u5f71\u54cd\uff1a<\/p>\n<p><img data-dominant-color=\"383c41\" data-has-transparency=\"false\" style=\"--dominant-color: #383c41;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-24702\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/344d572570a2e7af9a4005166941b10536806f.png\" width=\"604\" height=\"438\" alt=\"\" title=\"\u5982\u4f55\u4f7f\u7528Java\u8bbe\u8ba1\u4e00\u5957\u591a\u667a\u80fd\u4f53\u7cfb\u7edf-AI.x\u793e\u533a\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/344d572570a2e7af9a4005166941b10536806f.png 604w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/344d572570a2e7af9a4005166941b10536806f-300x218.png 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/344d572570a2e7af9a4005166941b10536806f-150x109.png 150w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/p>\n<h2>\u6269\u5c55\u81f3\u591a\u667a\u80fd\u4f53<\/h2>\n<p class=\"p\">\u6211\u4eec\u521a\u521a\u521b\u5efa\u7684\u662f\u4e00\u4e2aactor\u667a\u80fd\u4f53\uff0c\u5b83\u4f1a\u5728\u81ea\u5df1\u7684\u7ebf\u7a0b\u4e0a\uff08\u52a0\u4e0a\u5404\u8282\u70b9\u4f7f\u7528\u7684\u6240\u6709\u7ebf\u7a0b\uff09\u8fd0\u884c\uff0c\u5e76\u5b9e\u73b0\u4e86Function\u63a5\u53e3\u4ee5\u5907\u4e0d\u65f6\u4e4b\u9700\u3002<\/p>\n<p class=\"p\">\u591a\u667a\u80fd\u4f53\u5176\u5b9e\u6ca1\u4ec0\u4e48\u7279\u522b\uff0c\u57fa\u672c\u903b\u8f91\u5c31\u662f\u4e00\u4e2a\u667a\u80fd\u4f53\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u8282\u70b9\u8981\u6c42\u53e6\u4e00\u667a\u80fd\u4f53\u6267\u884c\u64cd\u4f5c\u3002\u6211\u4eec\u53ef\u4ee5\u6784\u5efa\u4e00\u5957\u667a\u80fd\u4f53\u5e93\u4ee5\u5c06\u5b83\u4eec\u826f\u597d\u7ec4\u5408\u8d77\u6765\uff0c\u4ece\u800c\u7b80\u5316\u6574\u4e2a\u7cfb\u7edf\u3002<\/p>\n<p class=\"p\">\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u8981\u5229\u7528\u4e4b\u524d\u7684\u667a\u80fd\u4f53\u8f93\u51fa\u8ba1\u7b97\u5ea6\u5047\u8d39\u7528\uff0c\u4ee5\u4fbf\u7528\u6237\u5224\u65ad\u662f\u5426\u7b26\u5408\u9700\u6c42\u3002\u5230\u8fd9\u91cc\uff0c\u662f\u4e0d\u662f\u5c31\u8ddf\u771f\u6b63\u7684\u65c5\u884c\u793e\u5f88\u50cf\u4e86\uff1f<\/p>\n<p class=\"p\">\u4e0b\u56fe\u4e3a\u6784\u5efa\u6d41\u7a0b\uff1a<\/p>\n<p><img data-dominant-color=\"f4f5f1\" data-has-transparency=\"false\" style=\"--dominant-color: #f4f5f1;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-24703\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/818210987d4156a086d7182f4229dd246b4fec.png\" width=\"824\" height=\"670\" alt=\"\" title=\"\u5982\u4f55\u4f7f\u7528Java\u8bbe\u8ba1\u4e00\u5957\u591a\u667a\u80fd\u4f53\u7cfb\u7edf-AI.x\u793e\u533a\" srcset=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/818210987d4156a086d7182f4229dd246b4fec.png 824w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/818210987d4156a086d7182f4229dd246b4fec-300x244.png 300w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/818210987d4156a086d7182f4229dd246b4fec-150x122.png 150w, https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2025\/02\/818210987d4156a086d7182f4229dd246b4fec-768x624.png 768w\" sizes=\"auto, (max-width: 824px) 100vw, 824px\" \/><\/p>\n<p class=\"p\">\u9996\u5148\u7528\u63d0\u793a\u8bcd\u6765\u63d0\u53d6\u76ee\u7684\u5730\u5e76\u8ba1\u7b97\u6210\u672c\u3002<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_10\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Java\r\nprivate static final String promptDestination = \"Read the following text describing a destination for a vacation and extract the destination as a simple city and country, no preamble. Just the city and the country. {proposal}\";\r\nprivate static final String promptCost = \"You are an expert travel agent. A customer asked you to estimate the cost of travelling from {startCity}, {startCountry} to {destination}, for {adults} adults and {kids} kids}\";<\/code><\/pre>\n<ul id=\"code_id_10\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u8fd9\u91cc\u53ea\u9700\u4e24\u4e2a\u72b6\u6001\uff0c\u4e00\u4e2a\u7528\u4e8e\u7814\u7a76\u57ce\u5e02\uff08\u7531\u4e0a\u4e00\u667a\u80fd\u4f53\u5b8c\u6210\uff09\uff0c\u53e6\u4e00\u4e2a\u7528\u4e8e\u8ba1\u7b97\u8d39\u7528\u3002<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_11\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nenum TravelStates { SEARCH, CALCULATE }<\/code><\/pre>\n<ul id=\"code_id_11\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u6211\u4eec\u8fd8\u9700\u8981\u4e0a\u4e0b\u6587\uff0c\u6b64\u4e0a\u4e0b\u6587\u8d1f\u8d23\u4fdd\u5b58\u4e0a\u4e00\u667a\u80fd\u4f53\u7684\u63d0\u8bae\u3002<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_12\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\npublic record TravelContext(String startCity, String startCountry, int adults, int kids, String destination, String cost, String proposal) { }<\/code><\/pre>\n<ul id=\"code_id_12\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u4e4b\u540e\u53ef\u4ee5\u5b9a\u4e49\u667a\u80fd\u4f53\u903b\u8f91\uff0c\u8be5\u903b\u8f91\u9700\u8981\u53e6\u4e00\u667a\u80fd\u4f53\u4f5c\u4e3a\u53c2\u6570\u3002\u9996\u8282\u70b9\u8c03\u7528\u4e0a\u4e00\u667a\u80fd\u4f53\u4ee5\u83b7\u53d6\u63d0\u8bae\u3002<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_13\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Java\r\nvar builder = AiAgent.&lt;TravelStates, TravelContext&gt;builder(false);\r\nAgentNode&lt;TravelStates, TravelContext&gt; nodeSearch = state -&gt; {\r\n  var vacationProposal = vacationsAgent.process(AiAgentVacations.VacationContext.from(country, goal), 1, TimeUnit.MINUTES, (st, info) -&gt; System.out.print(debugSubAgentStates ? st + \": \" + info : \"\"));\r\n  return state.setAttribute(\"proposal\", vacationProposal.proposal())\r\n  .setAttribute(\"destination\", model.call(promptDestination.replaceAll(\"\\\\{proposal\\\\}\", vacationProposal.proposal())));\r\n};<\/code><\/pre>\n<ul id=\"code_id_13\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u7b2c\u4e8c\u8282\u70b9\u8d1f\u8d23\u8ba1\u7b97\u6210\u672c\uff1a<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_14\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nAgentNode&lt;TravelStates, TravelContext&gt; nodeCalculateCost = state -&gt; state.setAttribute(\"cost\", model.call(replaceAllFields(promptCost, state.data())));<\/code><\/pre>\n<ul id=\"code_id_14\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u4e4b\u540e\u662f\u5b9a\u4e49\u56fe\u8868\u5e76\u6784\u5efa\u667a\u80fd\u4f53\uff1a<\/p>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_15\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Java\r\nbuilder.addState(TravelStates.SEARCH, TravelStates.CALCULATE, 1, nodeSearch, null);\r\nbuilder.addState(TravelStates.CALCULATE, null, 1, nodeCalculateCost, null);\r\n\r\nvar agent = builder.build(TravelStates.SEARCH, null, false);\r\nNow we can instantiate the two agents (I chose to use ChatGPT 4o and ChatGPT 01-mini) and use them:<\/code><\/pre>\n<ul id=\"code_id_15\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_16\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Java\r\ntry (var vacationsAgent = AiAgentVacations.buildAgent(ChatGPT.GPT_MODEL_4O, ChatGPT.GPT_MODEL_O1_MINI)) {\r\n  try (var travelAgent = AiAgentTravelAgency.buildAgent(ChatGPT.GPT_MODEL_4O, vacationsAgent, \"Italy\", \"Dance Salsa and Bachata\", true)) {\r\n    var result = travelAgent.process(new AiAgentTravelAgency.TravelContext(\"Oslo\", \"Norway\", 2, 2, null, null, null), (state, info) -&gt; System.out.println(state + \": \" + info));\r\n\r\n    System.out.println(\"*** Proposal: \" + result.proposal());\r\n    System.out.println(\"\\n\\n\\n*** Destination: \" + result.destination());\r\n    System.out.println(\"\\n\\n\\n*** Cost: \" + result.cost());\r\n  }\r\n}<\/code><\/pre>\n<ul id=\"code_id_16\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2>\u6700\u7ec8\u8f93\u51fa<\/h2>\n<p class=\"p\">\u5047\u8bbe\u6211\u4eec\u8bf4\u81ea\u5df1\u60f3\u8df3\u8428\u5c14\u8428\u821e\u548c\u5df4\u6070\u5854\u821e\uff0c\u5f97\u5230\u7684\u957f\u8f93\u51fa\u5982\u4e0b\uff1a<\/p>\n<h3>\u76ee\u7684\u5730<\/h3>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_17\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nNaples, Italy<\/code><\/pre>\n<ul id=\"code_id_17\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>\u63d0\u8bae<\/h3>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_18\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nBased on the comprehensive analysis of your friends' suggestions, **Naples** emerges as the ideal city for your vacation in Italy. Here's why Naples stands out as the best choice, offering an exceptional mix of excellent food, beautiful seaside experiences, and a vibrant salsa and bachata dance scene:\r\n\r\n### **1. Vibrant Dance Scene**\r\n- **Dance Venues:** Naples boasts numerous venues and events dedicated to salsa and bachata, ensuring that you can immerse yourself in lively dance nights regularly.\r\n- **Passionate Culture:** The city's passionate and energetic atmosphere enhances the overall dance experience, making it a hotspot for Latin dance enthusiasts.\r\n\r\n### **2. Culinary Excellence**\r\n- **Authentic Neapolitan Pizza:** As the birthplace of pizza, Naples offers some of the best and most authentic pizzerias in the world.\r\n- **Fresh Seafood:** Being a coastal city, Naples provides access to a wide variety of fresh seafood dishes, enhancing your culinary adventures.\r\n- **Delicious Pastries:** Don't miss out on local specialties like **sfogliatella**, a renowned Neapolitan pastry that is a must-try for any foodie.\r\n\r\n### **3. Stunning Seaside Location**\r\n- **Bay of Naples:** Enjoy breathtaking views and activities along the Bay of Naples, including boat tours and picturesque sunsets.\r\n- **Proximity to Amalfi Coast:** Naples serves as a gateway to the famous Amalfi Coast, allowing you to explore stunning coastal towns like Amalfi, Positano, and Sorrento with ease.\r\n- **Beautiful Beaches:** Relax on the city's beautiful beaches or take short trips to nearby seaside destinations for a perfect blend of relaxation and exploration.\r\n\r\n### **4. Cultural Richness**\r\n- **Historical Sites:** Explore Naples' rich history through its numerous museums, historic sites, and UNESCO World Heritage landmarks such as the Historic Centre of Naples.\r\n- **Vibrant Nightlife:** Beyond dancing, Naples offers a lively nightlife scene with a variety of bars, clubs, and entertainment options to suit all tastes.\r\n\r\n### **5. Accessibility and Convenience**\r\n- **Transportation Hub:** Naples is well-connected by air, rail, and road, making it easy to travel to other parts of Italy and beyond.\r\n- **Accommodation Options:** From luxury hotels to charming boutique accommodations, Naples offers a wide range of lodging options to fit your preferences and budget.\r\n\r\n### **Conclusion**\r\nNaples perfectly balances a thriving dance scene, exceptional culinary offerings, and beautiful seaside attractions. Its unique blend of culture, history, and vibrant nightlife makes it the best city in Italy to fulfill your desires for travel, good food, and lively dance experiences. Whether you're dancing the night away, savoring authentic pizza by the sea, or exploring nearby coastal gems, Naples promises an unforgettable vacation.\r\n\r\n### **Additional Recommendations**\r\n- **Day Trips:** Consider visiting nearby attractions such as Pompeii, the Isle of Capri, and the stunning Amalfi Coast to enrich your travel experience.\r\n- **Local Experiences:** Engage with locals in dance classes or attend festivals to dive deeper into Naples' vibrant cultural scene.\r\n\r\nEnjoy your trip to Italy, and may Naples provide you with the perfect blend of everything you're looking for!<\/code><\/pre>\n<ul id=\"code_id_18\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<li>16.<\/li>\n<li>17.<\/li>\n<li>18.<\/li>\n<li>19.<\/li>\n<li>20.<\/li>\n<li>21.<\/li>\n<li>22.<\/li>\n<li>23.<\/li>\n<li>24.<\/li>\n<li>25.<\/li>\n<li>26.<\/li>\n<li>27.<\/li>\n<li>28.<\/li>\n<li>29.<\/li>\n<li>30.<\/li>\n<li>31.<\/li>\n<li>32.<\/li>\n<li>33.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>\u8d39\u7528<\/h3>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_19\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nTo estimate the cost of traveling from Oslo, Norway, to Naples, Italy, for two adults and two kids, we need to consider several key components of the trip: flights, accommodations, local transportation, food, and activities. Here's a breakdown of potential costs:\r\n\r\n1. **Flights**:\r\n   - Round-trip flights from Oslo to Naples typically range from $100 to $300 per person, depending on the time of booking, the season, and the airline. Budget airlines might offer lower prices, while full-service carriers could be on the higher end.\r\n   - For a family of four, the cost could range from $400 to $1,200.\r\n\r\n2. **Accommodations**:\r\n   - Hotels in Naples can vary significantly. Expect to pay approximately $70 to $150 per night for a mid-range hotel room that accommodates a family. Vacation rentals might offer more flexibility and potentially lower costs.\r\n   - For a typical 5-night stay, this would range from $350 to $750.\r\n\r\n3. **Local Transportation**:\r\n   - Public transportation in Naples (buses, metro, trams) is affordable, and daily tickets cost around $4 per person.\r\n   - Assume about $50 to $100 for the family's local transport for the entire trip, depending on usage.\r\n\r\n4. **Food**:\r\n   - Dining costs are highly variable. A budget for meals might be around $10-$20 per person per meal at casual restaurants, while dining at mid-range restaurants could cost $20-$40 per person.\r\n   - A family of four could expect to spend around $50 to $100 per day, reaching a total of $250 to $500 for five days.\r\n\r\n5. **Activities**:\r\n   - Entry fees for attractions can vary. Some museums and archaeological sites charge around $10 to $20 per adult, with discounts for children.\r\n   - Budget around $100 to $200 for family activities and entrance fees.\r\n\r\n6. **Miscellaneous**:\r\n   - Always allow a little extra for souvenirs, snacks, and unexpected expenses. A typical buffer might be $100 to $200.\r\n\r\n**Estimated Total Cost**:\r\n- **Low-end estimate**: $1,250\r\n- **High-end estimate**: $2,950\r\n\r\nThese are general estimates and actual costs can vary based on when you travel, how far in advance you book, and your personal preferences for accommodation and activities. For the most accurate assessment, consider reaching out to airlines for current flight prices, hotels for room rates, and looking into specific attractions you wish to visit.<\/code><\/pre>\n<ul id=\"code_id_19\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<li>16.<\/li>\n<li>17.<\/li>\n<li>18.<\/li>\n<li>19.<\/li>\n<li>20.<\/li>\n<li>21.<\/li>\n<li>22.<\/li>\n<li>23.<\/li>\n<li>24.<\/li>\n<li>25.<\/li>\n<li>26.<\/li>\n<li>27.<\/li>\n<li>28.<\/li>\n<li>29.<\/li>\n<li>30.<\/li>\n<li>31.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u5185\u5bb9\u7740\u5b9e\u4e0d\u5c11\uff0c\u800c\u4e14\u8fd9\u8fd8\u53ea\u662f\u4e24\u4e2a\u201c\u63a8\u7406\u201d\u6a21\u578b\u7684\u8f93\u51fa\uff01<\/p>\n<p class=\"p\">\u4f46\u7ed3\u679c\u975e\u5e38\u6709\u8da3\uff0c\u90a3\u4e0d\u52d2\u65af\u4e5f\u786e\u5b9e\u662f\u4e2a\u4e0d\u9519\u7684\u9009\u9879\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u68c0\u67e5\u4e00\u4e0b\u4e2d\u95f4\u7ed3\u679c\uff0c\u53d1\u73b0\u5f97\u51fa\u7ed3\u8bba\u7684\u8fc7\u7a0b\u76f8\u5f53\u5408\u7406\u3002<\/p>\n<h2>\u4e2d\u95f4\u8f93\u51fa<\/h2>\n<p class=\"p\">\u5982\u679c\u611f\u5174\u8da3\uff0c\u5927\u5bb6\u8fd8\u53ef\u4ee5\u67e5\u770b\u4e2d\u95f4\u7ed3\u679c\u3002<\/p>\n<h3>\u9910\u98df<\/h3>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_20\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nAs a foodie exploring Italy, you're in for a treat, as the country boasts a rich culinary heritage with regional specialties. Here's a list of the top 10 cities in Italy renowned for their food:\r\n1. **Bologna** - Often referred to as the gastronomic heart of Italy, Bologna is famous for its rich Bolognese sauce, tasty mortadella, and fresh tagliatelle.\r\n2. **Naples** - The birthplace of pizza, Naples offers authentic Neapolitan pizza, as well as delicious seafood and pastries like sfogliatella.\r\n3. **Florence** - Known for its Florentine steak, ribollita (a hearty bread and vegetable soup), and delicious wines from the surrounding Tuscany region.\r\n4. **Rome** - Enjoy classic Roman dishes such as carbonara, cacio e pepe, and Roman-style artichokes in the bustling capital city.\r\n5. **Milan** - A city that blends tradition and innovation, Milan offers risotto alla milanese, ossobuco, and an array of high-end dining experiences.\r\n6. **Turin** - Known for its chocolate and coffee culture, as well as traditional dishes like bagna cauda and agnolotti.\r\n7. **Palermo** - Sample the vibrant street food scene with arancini, panelle, and sfincione, as well as fresh local seafood in this Sicilian capital.\r\n8. **Venice** - Famous for its seafood risotto, sarde in saor (sweet and sour sardines), and cicchetti (Venetian tapas) to enjoy with a glass of prosecco.\r\n9. **Parma** - Home to the famous Parmigiano-Reggiano cheese and prosciutto di Parma, it\u2019s a haven for lovers of cured meats and cheeses.\r\n10. **Genoa** - Known for its pesto Genovese, focaccia, and variety of fresh seafood dishes, Genoa offers a unique taste of Ligurian cuisine.\r\n\r\nEach of these cities offers a distinct culinary experience influenced by local traditions and ingredients, making them must-visit destinations for any food enthusiast exploring Italy.<\/code><\/pre>\n<ul id=\"code_id_20\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>\u6d77\u6ee8<\/h3>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_21\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nItaly is renowned for its stunning coastline and beautiful seaside cities. Here are ten top cities and regions perfect for a sea vacation:\r\n\r\n1. **Amalfi** - Nestled in the famous Amalfi Coast, this city is known for its dramatic cliffs, azure waters, and charming coastal villages.\r\n2. **Positano** - Also on the Amalfi Coast, Positano is famous for its colorful buildings, steep streets, and picturesque pebble beachfronts.\r\n3. **Sorrento** - Offering incredible views of the Bay of Naples, Sorrento serves as a gateway to the Amalfi Coast and provides a relaxing seaside atmosphere.\r\n4. **Capri** - The island of Capri is known for its rugged landscape, upscale hotels, and the famous Blue Grotto, a spectacular sea cave.\r\n5. **Portofino** - This quaint fishing village on the Italian Riviera is known for its picturesque harbor, pastel-colored houses, and luxurious coastal surroundings.\r\n6. **Cinque Terre** - Comprising five stunning villages along the Ligurian coast, Cinque Terre is a UNESCO World Heritage site known for its dramatic seaside and hiking trails.\r\n7. **Taormina** - Situated on a hill on the east coast of Sicily, Taormina offers sweeping views of the Ionian Sea and beautiful beaches like Isola Bella.\r\n8. **Rimini** - Located on the Adriatic coast, Rimini is known for its long sandy beaches and vibrant nightlife, making it a favorite for beach-goers and party enthusiasts.\r\n9. **Alghero** - A city on the northwest coast of Sardinia, Alghero is famous for its medieval architecture, stunning beaches, and Catalan culture.\r\n10. **Lerici** - Near the Ligurian Sea, Lerici is part of the stunning Gulf of Poets and is known for its beautiful bay, historic castle, and crystal-clear waters.\r\n\r\nEach of these destinations offers a unique blend of beautiful beaches, cultural sites, and local cuisine, making Italy a fantastic choice for a sea vacation.<\/code><\/pre>\n<ul id=\"code_id_21\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>\u6d3b\u52a8<\/h3>\n<div>\n<div class=\"hljs-cto\">\n<div class=\"hljs-cto\"><button class=\"copy_btn disable\" data-clipboard-target=\"#code_id_22\">\u590d\u5236<\/button><\/p>\n<div class=\"code-toolbar\">\n<pre class=\"has-pre-numbering language-plain\" tabindex=\"0\"><code class=\"language-plain\">Plain Text\r\nItaly has a vibrant dance scene with many cities offering great opportunities to enjoy salsa and bachata. Here are ten cities where you can indulge in these lively dance styles:\r\n\r\n1. **Rome** - The capital city has a bustling dance scene with numerous salsa clubs and events happening regularly.\r\n2. **Milan** - Known for its nightlife, Milan offers various dance clubs and events catering to salsa and bachata enthusiasts.\r\n3. **Florence** - A cultural hub, Florence has several dance studios and clubs where you can enjoy Latin dances.\r\n4. **Naples** - Known for its passionate culture, Naples offers several venues and events for salsa and bachata lovers.\r\n5. **Turin** - This northern city has a growing salsa community with events and social dances.\r\n6. **Bologna** - Known for its lively student population, Bologna has a number of dance clubs and events for salsa and bachata.\r\n7. **Venice** - While famous for its romantic canals, Venice also hosts various dance events throughout the year.\r\n8. **Palermo** - In Sicily, Palermo has a vibrant Latin dance scene reflecting the island's festive culture.\r\n9. **Verona** - Known for its romantic setting, Verona has several dance studios and clubs for salsa and bachata.\r\n10. **Bari** - This coastal city in the south offers dance festivals and clubs perfect for salsa and bachata enthusiasts.\r\n\r\nThese cities offer a mix of cultural experiences and lively dance floors, ensuring you can enjoy salsa and bachata across Italy.<\/code><\/pre>\n<ul id=\"code_id_22\" class=\"pre-numbering\">\n<li>1.<\/li>\n<li>2.<\/li>\n<li>3.<\/li>\n<li>4.<\/li>\n<li>5.<\/li>\n<li>6.<\/li>\n<li>7.<\/li>\n<li>8.<\/li>\n<li>9.<\/li>\n<li>10.<\/li>\n<li>11.<\/li>\n<li>12.<\/li>\n<li>13.<\/li>\n<li>14.<\/li>\n<li>15.<\/li>\n<\/ul>\n<div class=\"toolbar\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"p\">\u6709\u8da3\u7684\u662f\uff0c\u90a3\u4e0d\u52d2\u65af\u5728\u5404\u4e2a\u5206\u6bb5\u6392\u540d\u4e0a\u90fd\u6ca1\u767b\u9876\uff0c\u4f46\u7efc\u5408\u4e0b\u6765\u5374\u662f\u6700\u4f18\u9009\u9879\u3002<\/p>\n<h2>\u8bb8\u53ef\u7ec6\u8282<\/h2>\n<p class=\"p\">\u8fd9\u91cc\u518d\u804a\u51e0\u53e5\u5173\u4e8eFibry\u8bb8\u53ef\u8bc1\u7684\u60c5\u51b5\u3002FIbry\u76ee\u524d\u5df2\u7ecf\u4e0d\u518d\u4ee5\u7eafMIT\u8bb8\u53ef\u8bc1\u7684\u5f62\u5f0f\u53d1\u5e03\u3002\u6700\u5927\u7684\u53d8\u66f4\u662f\uff0c\u5982\u679c\u5927\u5bb6\u60f3\u8981\u6025\u96e8 \u5957\u7cfb\u7edf\u6765\u4e3a\u7b2c\u4e09\u65b9\uff08\u5982\u8f6f\u4ef6\u5de5\u7a0b\u5e08\u667a\u80fd\u4f53\uff09\u5927\u89c4\u6a21\u751f\u6210\u4ee3\u7801\uff0c\u5219\u9700\u8981\u7533\u8bf7\u5546\u4e1a\u8bb8\u53ef\u8bc1\u3002\u6b64\u5916\uff0c\u5b83\u8fd8\u7981\u6b62\u7528\u6237\u5c06\u5176\u4f5c\u4e3a\u6570\u636e\u96c6\u6765\u8bad\u7ec3\u7cfb\u7edf\u751f\u6210\u4ee3\u7801\uff08\u4f8b\u5982ChatGPT\u4e0d\u5f97\u5728Fibry\u7684\u6e90\u4ee3\u7801\u4e0a\u8fdb\u884c\u8bad\u7ec3\uff09\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6240\u6709\u7528\u9014\u90fd\u4e0d\u53d7\u5f71\u54cd\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p class=\"p\">\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u52a9\u5927\u5bb6\u4e86\u89e3\u5982\u4f55\u4f7f\u7528Fibry\u7f16\u5199AI\u667a\u80fd\u4f53\u3002\u5176\u5b9e\u5bf9\u4e8e\u5206\u5e03\u5728\u591a\u4e2a\u8282\u70b9\u4e0a\u7684\u591a\u667a\u80fd\u4f53\u7cfb\u7edf\uff0cFibry\u4e5f\u4e0d\u5728\u8bdd\u4e0b\uff01\u4f46\u53d7\u7bc7\u5e45\u6240\u9650\uff0c\u8fd9\u91cc\u4e0d\u8fc7\u591a\u5c55\u5f00\u3002<\/p>\n<p class=\"p\">\u5728Fibry\u4e2d\uff0c\u901a\u8fc7\u7f51\u7edc\u7684\u6d88\u606f\u53d1\u9001\u548c\u63a5\u6536\u4f1a\u88ab\u62bd\u8c61\u51fa\u6765\uff0c\u56e0\u6b64\u65e0\u9700\u4fee\u6539\u667a\u80fd\u4f53\u903b\u8f91\u5373\u53ef\u5b9e\u73b0\u5206\u53d1\u3002\u8fd9\u4f7f\u5f97Fibry\u80fd\u591f\u8f7b\u677e\u5b9e\u73b0\u8de8\u8282\u70b9\u6269\u5c55\uff0c\u6838\u5fc3\u903b\u8f91\u5b8c\u5168\u4e0d\u53d7\u5f71\u54cd\u3002<\/p>\n<p class=\"p\">\u795d\u5927\u5bb6\u7f16\u7801\u6109\u5feb\uff01<\/p>\n<p>\u6587\u7ae0\u6765\u81ea\uff1a51CTO<\/p>\n<\/div>\n<\/div>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_24697\" class=\"pvc_stats total_only  \" data-element-id=\"24697\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u4eec\u5c06\u6784\u5efa\u4e00\u6b3e\u54cd\u5e94\u5f0f\u5e94\u7528\uff08\u5bf9\u6765\u81ea\u7528\u6237\u7684\u8f93\u5165\u505a\u51fa\u54cd\u5e94\uff09\uff0c\u5e2e\u52a9\u4eba\u4eec\u89c4\u5212\u81ea\u5df1\u7684\u5b8c\u7f8e\u5047\u671f\u3002\u6b64\u667a\u80fd\u4f53\u5c06\u6839\u636e\u7528\u6237\u6307\u5b9a\u7684\u9910\u98df [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_24697\" class=\"pvc_stats total_only  \" data-element-id=\"24697\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/aif.amtbbs.org\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":56,"featured_media":24699,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,20,80],"tags":[1448,666,903],"class_list":["post-24697","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-23","category-20","category-80","tag-ai","tag-chatgpt","tag-java"],"_links":{"self":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/24697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/comments?post=24697"}],"version-history":[{"count":1,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/24697\/revisions"}],"predecessor-version":[{"id":24704,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/posts\/24697\/revisions\/24704"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media\/24699"}],"wp:attachment":[{"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/media?parent=24697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/categories?post=24697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aif.amtbbs.org\/index.php\/wp-json\/wp\/v2\/tags?post=24697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}