{"id":443,"date":"2026-01-13T23:08:03","date_gmt":"2026-01-13T15:08:03","guid":{"rendered":"http:\/\/ai.taichi-maker.com\/?page_id=443"},"modified":"2026-01-13T23:19:49","modified_gmt":"2026-01-13T15:19:49","slug":"tools","status":"publish","type":"page","link":"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/tools\/","title":{"rendered":"OpenAI API\u517c\u5bb9\u683c\u5f0f\u8bf7\u6c42\u53c2\u6570 \u2013 tools"},"content":{"rendered":"\n<div class=\"wp-block-columns alignfull is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p>\u5bfc\u822a\u680f\uff1a<a href=\"http:\/\/ai.taichi-maker.com\/\">\u9996\u9875<\/a> \/ <a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/\">AI\u5f00\u53d1\u53c2\u8003\u8d44\u6599<\/a> \/ <a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/\">OpenAI API \u517c\u5bb9\u683c\u5f0f\u53c2\u8003\u8d44\u6599<\/a> \/ <a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/\">\u8bf7\u6c42\u53c2\u6570\u8be6\u89e3<\/a> \/ tools<\/p>\n\n\n\n<p style=\"border-width:1px;border-top-left-radius:6px;border-top-right-radius:6px;border-bottom-left-radius:6px;border-bottom-right-radius:6px\">\u5982\u679c\u60a8\u60f3\u6df1\u5165\u4e86\u89e3\u5982\u4f55\u501f\u52a9 OpenAI API \u6253\u9020\u4eba\u5de5\u667a\u80fd\u786c\u4ef6\uff0c\u6b22\u8fce\u8bbf\u95ee<a href=\"http:\/\/ai.taichi-maker.com\/index.php\/homepage\/ai-tutorial-index\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u672c\u7ad9\u6559\u7a0b\u76ee\u5f55\u9875<\/a>\uff0c\u67e5\u770b\u592a\u6781\u521b\u5ba2\u56e2\u961f\u4e3a\u60a8\u7cbe\u5fc3\u51c6\u5907\u7684\u7cfb\u5217\u6559\u7a0b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u53c2\u6570\u8bf4\u660e<\/h2>\n\n\n\n<p><code>tools<\/code>\u53c2\u6570\u5141\u8bb8\u4f60\u4ee5\u7279\u5b9a\u7684\u6570\u636e\u7ed3\u6784\uff08\u5982\u5217\u8868\u5d4c\u5957\u5b57\u5178\u7684\u5f62\u5f0f\uff09\u5411\u6a21\u578b\u63d0\u4f9b\u4e00\u7cfb\u5217\u53ef\u8c03\u7528\u7684\u5de5\u5177\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6a21\u578b\u4f1a\u57fa\u4e8e\u5bf9\u8bdd\u4e0a\u4e0b\u6587\u4ee5\u53ca\u7528\u6237\u8bf7\u6c42\uff0c\u667a\u80fd\u5730\u5224\u65ad\u662f\u5426\u8c03\u7528\u8fd9\u4e9b\u5de5\u5177\u4ee5\u53ca\u5177\u4f53\u7684\u4f7f\u7528\u65b9\u5f0f<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u53c2\u6570\u6781\u5927\u5730\u6269\u5c55\u4e86\u6a21\u578b\u7684\u80fd\u529b\u8303\u56f4\uff0c\u4f7f\u5176\u80fd\u591f\u6267\u884c\u8d85\u8d8a\u7eaf\u6587\u672c\u751f\u6210\u7684\u591a\u6837\u5316\u4efb\u52a1\uff0c\u50cf\u67e5\u8be2\u5b9e\u65f6\u6570\u636e\u3001\u6267\u884c\u5404\u7c7b\u8ba1\u7b97\u3001\u8c03\u7528\u5916\u90e8\u670d\u52a1\u7b49\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4e0d\u540c\u7c7b\u578b\u7684\u5de5\u5177\u5728\u8c03\u7528\u65f6\uff0c\u53ef\u80fd\u4f1a\u53d7\u5230\u5de5\u5177\u81ea\u8eab\u63a5\u53e3\u9650\u5236\u3001\u6570\u636e\u8bbf\u95ee\u6743\u9650\u3001\u8c03\u7528\u9891\u7387\u9650\u5236\u7b49\u56e0\u7d20\u7684\u7ea6\u675f\u3002\u5728\u4f7f\u7528 tools \u53c2\u6570\u65f6\uff0c\u8981\u5145\u5206\u4e86\u89e3\u8fd9\u4e9b\u6f5c\u5728\u7684\u9650\u5236\u6761\u4ef6\uff0c\u4ee5\u786e\u4fdd\u5de5\u5177\u7684\u6709\u6548\u8c03\u7528\u548c\u6a21\u578b\u529f\u80fd\u7684\u6b63\u5e38\u53d1\u6325\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5fc5\u9700\u6027<\/h2>\n\n\n\n<p><code>tools<\/code>\u662fAPI\u8bf7\u6c42\u4e2d\u7684<strong>\u53ef\u9009\u53c2\u6570<\/strong>\u3002\u5982\u679c\u4e0d\u8bbe\u7f6e\u6b64\u53c2\u6570\uff0c\u6a21\u578b\u5c06\u65e0\u6cd5\u8c03\u7528\u4efb\u4f55\u5de5\u5177\uff0c\u53ea\u80fd\u57fa\u4e8e\u5176\u8bad\u7ec3\u6570\u636e\u751f\u6210\u54cd\u5e94\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5de5\u4f5c\u539f\u7406<\/h2>\n\n\n\n<p>\u5f53\u8bbe\u7f6e<code>tools<\/code>\u53c2\u6570\u65f6\uff0c\u6a21\u578b\u4f1a\u5728\u751f\u6210\u8fc7\u7a0b\u4e2d\u8bc4\u4f30\u662f\u5426\u9700\u8981\u8c03\u7528\u5de5\u5177\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5de5\u5177\u8bc6\u522b<\/strong>\uff1a\u6a21\u578b\u4f1a\u5206\u6790\u7528\u6237\u8bf7\u6c42\uff0c\u5224\u65ad\u662f\u5426\u9700\u8981\u8c03\u7528\u63d0\u4f9b\u7684\u5de5\u5177<\/li>\n\n\n\n<li><strong>\u53c2\u6570\u63d0\u53d6<\/strong>\uff1a\u6a21\u578b\u4f1a\u4ece\u7528\u6237\u8f93\u5165\u4e2d\u63d0\u53d6\u8c03\u7528\u5de5\u5177\u6240\u9700\u7684\u53c2\u6570<\/li>\n\n\n\n<li><strong>\u5de5\u5177\u8c03\u7528<\/strong>\uff1a\u6a21\u578b\u4f1a\u751f\u6210\u5de5\u5177\u8c03\u7528\u8bf7\u6c42\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u56de\u7b54\u7528\u6237<\/li>\n\n\n\n<li><strong>\u7ed3\u679c\u5904\u7406<\/strong>\uff1a\u6a21\u578b\u4f1a\u6839\u636e\u5de5\u5177\u8fd4\u56de\u7684\u7ed3\u679c\u7ee7\u7eed\u5bf9\u8bdd<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u53c2\u6570\u683c\u5f0f<\/h2>\n\n\n\n<p><code>tools<\/code>\u662f\u4e00\u4e2a\u6570\u7ec4\uff0c\u6bcf\u4e2a\u5143\u7d20\u662f\u4e00\u4e2a\u5de5\u5177\u5b9a\u4e49\u5bf9\u8c61\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>type<\/strong>\uff1a\u5de5\u5177\u7c7b\u578b\uff0c\u76ee\u524d\u4e3b\u8981\u652f\u6301&#8221;function&#8221;<\/li>\n\n\n\n<li><strong>function<\/strong>\uff1a\u51fd\u6570\u5b9a\u4e49\u5bf9\u8c61\uff0c\u5305\u542bname\u3001description\u3001parameters\u7b49\u5b57\u6bb5<\/li>\n\n\n\n<li><strong>name<\/strong>\uff1a\u51fd\u6570\u540d\u79f0\uff0c\u7528\u4e8e\u6807\u8bc6\u548c\u8c03\u7528\u5de5\u5177<\/li>\n\n\n\n<li><strong>description<\/strong>\uff1a\u51fd\u6570\u63cf\u8ff0\uff0c\u8be5\u5b57\u6bb5\u7684\u4f5c\u7528\u662f\u5e2e\u52a9\u6a21\u578b\u51c6\u786e\u7406\u89e3\u5de5\u5177\u7684\u7528\u9014\u3002<\/li>\n\n\n\n<li><strong>parameters<\/strong>\uff1a\u91c7\u7528 JSON Schema \u5b9a\u4e49\u51fd\u6570\u53c2\u6570\u3002\u4e00\u822c\u6765\u8bf4\uff0cparameters\u662f\u4e00\u4e2a\u5bf9\u8c61\uff0c\u6bcf\u4e2a\u5c5e\u6027\u5bf9\u5e94\u4e00\u4e2a\u51fd\u6570\u53c2\u6570<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5728\u8bf7\u6c42\u4f53\u4e2d\u7684\u4f7f\u7528<\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u8bf7\u6c42\u4f53\u793a\u4f8b\uff0c\u5c55\u793a\u4e86<code>tools<\/code>\u53c2\u6570\u7684\u4f4d\u7f6e\u548c\u7528\u6cd5\uff1a<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(2 * 0.6 * .875rem);--cbp-line-highlight-color:rgba(201, 218, 248, 0.2);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>{\n  \"model\": \"gpt-5.2\",\n  \"messages\": &#91;\n    {\n      \"role\": \"user\",\n      \"content\": \"\u5317\u4eac\u4eca\u5929\u7684\u5929\u6c14\u600e\u4e48\u6837\uff1f\"\n    }\n  &#93;,\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"function\": {\n        \"name\": \"get_weather\",\n        \"description\": \"\u83b7\u53d6\u6307\u5b9a\u57ce\u5e02\u7684\u5929\u6c14\u4fe1\u606f\",\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"city\": {\n              \"type\": \"string\",\n              \"description\": \"\u57ce\u5e02\u540d\u79f0\"\n            },\n            \"date\": {\n              \"type\": \"string\",\n              \"format\": \"date\",\n              \"description\": \"\u67e5\u8be2\u65e5\u671f\"\n            }\n          },\n          \"required\": &#91;\"city\"&#93;\n        }\n      }\n    }\n  ]\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">model<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">gpt-5.2<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">messages<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">role<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">user<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">content<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u5317\u4eac\u4eca\u5929\u7684\u5929\u6c14\u600e\u4e48\u6837\uff1f<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&#93;,<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">tools<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">[<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">name<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">get_weather<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u83b7\u53d6\u6307\u5b9a\u57ce\u5e02\u7684\u5929\u6c14\u4fe1\u606f<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">parameters<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">object<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">properties<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">city<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">string<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u57ce\u5e02\u540d\u79f0<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">date<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">string<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">format<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">date<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u67e5\u8be2\u65e5\u671f<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">required<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">city<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>\"tools\": [...]<\/code> \u5b9a\u4e49\u4e86\u4e00\u4e2a\u5de5\u5177\u5217\u8868\uff0c\u5305\u542b\u4e00\u4e2a\u5929\u6c14\u67e5\u8be2\u51fd\u6570<\/li>\n\n\n\n<li>\u5de5\u5177\u7c7b\u578b\u4e3a&#8221;function&#8221;\uff0c\u8868\u793a\u8fd9\u662f\u4e00\u4e2a\u53ef\u8c03\u7528\u7684\u51fd\u6570<\/li>\n\n\n\n<li>function\u5bf9\u8c61\u5305\u542b\u4e86\u51fd\u6570\u7684\u5b8c\u6574\u5b9a\u4e49\uff0c\u5305\u62ec\u540d\u79f0\u3001\u63cf\u8ff0\u548c\u53c2\u6570schema<\/li>\n\n\n\n<li>\u6a21\u578b\u4f1a\u6839\u636e\u7528\u6237\u8bf7\u6c42&#8221;\u5317\u4eac\u4eca\u5929\u7684\u5929\u6c14&#8221;\u51b3\u5b9a\u662f\u5426\u8c03\u7528get_weather\u51fd\u6570<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u54cd\u5e94\u683c\u5f0f<\/h2>\n\n\n\n<p>\u5f53\u6a21\u578b\u51b3\u5b9a\u8c03\u7528\u5de5\u5177\u65f6\uff0cAPI\u54cd\u5e94\u4e2d\u7684<code>message<\/code>\u5bf9\u8c61\u4f1a\u5305\u542b<code>tool_calls<\/code>\u5b57\u6bb5\uff0c\u800c\u4e0d\u662f\u5e38\u89c4\u7684<code>content<\/code>\u5b57\u6bb5\u3002\u4ee5\u4e0b\u662f\u54cd\u5e94\u7ed3\u6784\u7684\u793a\u4f8b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>{\n  \"id\": \"chatcmpl-123\",\n  \"object\": \"chat.completion\",\n  \"created\": 1677652288,\n  \"model\": \"gpt-5.2\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": null,\n        \"tool_calls\": &#91;\n          {\n            \"id\": \"call_abc123\",\n            \"type\": \"function\",\n            \"function\": {\n              \"name\": \"get_weather\",\n              \"arguments\": \"{\\\"city\\\": \\\"\u5317\u4eac\\\", \\\"date\\\": \\\"2024-01-15\\\"}\"\n            }\n          }\n        &#93;\n      },\n      \"finish_reason\": \"tool_calls\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 82,\n    \"completion_tokens\": 17,\n    \"total_tokens\": 99\n  }\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">id<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">chatcmpl-123<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">object<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">chat.completion<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">created<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1677652288<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">model<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">gpt-5.2<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">choices<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">index<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">message<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">role<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">assistant<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">content<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">null<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">tool_calls<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">id<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">call_abc123<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">name<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">get_weather<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">arguments<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">{<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">city<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">: <\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">\u5317\u4eac<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">, <\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">date<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">: <\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">2024-01-15<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">}<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">finish_reason<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">tool_calls<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">],<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">usage<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">prompt_tokens<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">82<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">completion_tokens<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">17<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">total_tokens<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">99<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u54cd\u5e94\u4e2d\u7684\u5173\u952e\u5b57\u6bb5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>content<\/strong>\uff1a\u5f53\u6a21\u578b\u51b3\u5b9a\u8c03\u7528\u5de5\u5177\u65f6\uff0c\u6b64\u5b57\u6bb5\u4e3anull<\/li>\n\n\n\n<li><strong>tool_calls<\/strong>\uff1a\u5de5\u5177\u8c03\u7528\u6570\u7ec4\uff0c\u5305\u542b\u6a21\u578b\u8bf7\u6c42\u8c03\u7528\u7684\u5de5\u5177\u4fe1\u606f<\/li>\n\n\n\n<li><strong>id<\/strong>\uff1a\u5de5\u5177\u8c03\u7528\u7684\u552f\u4e00\u6807\u8bc6\u7b26\uff0c\u7528\u4e8e\u540e\u7eed\u5c06\u5de5\u5177\u7ed3\u679c\u8fd4\u56de\u7ed9\u6a21\u578b<\/li>\n\n\n\n<li><strong>type<\/strong>\uff1a\u5de5\u5177\u7c7b\u578b\uff0c\u901a\u5e38\u4e3a&#8221;function&#8221;<\/li>\n\n\n\n<li><strong>function.name<\/strong>\uff1a\u8981\u8c03\u7528\u7684\u51fd\u6570\u540d\u79f0<\/li>\n\n\n\n<li><strong>function.arguments<\/strong>\uff1a\u8c03\u7528\u51fd\u6570\u6240\u9700\u7684\u53c2\u6570\uff0cJSON\u5b57\u7b26\u4e32\u683c\u5f0f<\/li>\n\n\n\n<li><strong>finish_reason<\/strong>\uff1a\u7ed3\u675f\u539f\u56e0\uff0c\u5f53\u6a21\u578b\u8c03\u7528\u5de5\u5177\u65f6\u4e3a&#8221;tool_calls&#8221;<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5de5\u5177\u8c03\u7528\u6d41\u7a0b\uff1a<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u7528\u6237\u53d1\u9001\u8bf7\u6c42\uff0c\u5305\u542btools\u53c2\u6570\u5b9a\u4e49<\/li>\n\n\n\n<li>\u6a21\u578b\u5206\u6790\u8bf7\u6c42\uff0c\u51b3\u5b9a\u662f\u5426\u9700\u8981\u8c03\u7528\u5de5\u5177<\/li>\n\n\n\n<li>\u5982\u679c\u9700\u8981\u8c03\u7528\u5de5\u5177\uff0cAPI\u8fd4\u56de\u5305\u542btool_calls\u7684\u54cd\u5e94<\/li>\n\n\n\n<li>\u5ba2\u6237\u7aef\u6267\u884c\u5de5\u5177\u8c03\u7528\uff0c\u83b7\u53d6\u7ed3\u679c<\/li>\n\n\n\n<li>\u5c06\u5de5\u5177\u7ed3\u679c\u4f5c\u4e3a\u65b0\u7684\u6d88\u606f\uff08role: &#8220;tool&#8221;\uff09\u53d1\u9001\u56deAPI<\/li>\n\n\n\n<li>\u6a21\u578b\u57fa\u4e8e\u5de5\u5177\u7ed3\u679c\u7ee7\u7eed\u751f\u6210\u6700\u7ec8\u54cd\u5e94<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5de5\u5177\u7ed3\u679c\u63d0\u4ea4\u793a\u4f8b\uff1a<\/strong><\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>{\n  \"model\": \"gpt-5.2\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"\u5317\u4eac\u4eca\u5929\u7684\u5929\u6c14\u600e\u4e48\u6837\uff1f\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": null,\n      \"tool_calls\": &#91;\n        {\n          \"id\": \"call_abc123\",\n          \"type\": \"function\",\n          \"function\": {\n            \"name\": \"get_weather\",\n            \"arguments\": \"{\\\"city\\\": \\\"\u5317\u4eac\\\", \\\"date\\\": \\\"2024-01-15\\\"}\"\n          }\n        }\n      &#93;\n    },\n    {\n      \"role\": \"tool\",\n      \"tool_call_id\": \"call_abc123\",\n      \"content\": \"{\\\"temperature\\\": 5, \\\"condition\\\": \\\"\u6674\\\", \\\"humidity\\\": 45}\"\n    }\n  ]\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">model<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">gpt-5.2<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">messages<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">role<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">user<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">content<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u5317\u4eac\u4eca\u5929\u7684\u5929\u6c14\u600e\u4e48\u6837\uff1f<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">role<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">assistant<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">content<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">null<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">tool_calls<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">id<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">call_abc123<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">name<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">get_weather<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">arguments<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">{<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">city<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">: <\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">\u5317\u4eac<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">, <\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">date<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">: <\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">2024-01-15<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">}<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">role<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">tool<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">tool_call_id<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">call_abc123<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">content<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">{<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">temperature<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">: 5, <\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">condition<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">: <\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">\u6674<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">, <\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">humidity<\/span><span style=\"color: #EBCB8B\">\\&quot;<\/span><span style=\"color: #A3BE8C\">: 45}<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>\"role\": \"tool\"<\/code> \u8868\u793a\u8fd9\u662f\u4e00\u4e2a\u5de5\u5177\u7ed3\u679c\u6d88\u606f<\/li>\n\n\n\n<li><code>\"tool_call_id\"<\/code> \u5fc5\u987b\u4e0e\u4e4b\u524d\u5de5\u5177\u8c03\u7528\u7684id\u5339\u914d<\/li>\n\n\n\n<li><code>\"content\"<\/code> \u5305\u542b\u5de5\u5177\u6267\u884c\u7684\u7ed3\u679c\u6570\u636e<\/li>\n\n\n\n<li>\u6a21\u578b\u4f1a\u6839\u636e\u8fd9\u4e2a\u5de5\u5177\u7ed3\u679c\u751f\u6210\u6700\u7ec8\u7684\u5929\u6c14\u63cf\u8ff0\u56de\u7b54<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u573a\u666f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5b9e\u65f6\u6570\u636e\u67e5\u8be2<\/strong><\/h3>\n\n\n\n<p><strong>\u573a\u666f\u8bf4\u660e\uff1a<\/strong>\u901a\u8fc7\u5de5\u5177\u8c03\u7528\uff0c\u6a21\u578b\u53ef\u4ee5\u83b7\u53d6\u5b9e\u65f6\u6570\u636e\uff0c\u5982\u5929\u6c14\u3001\u80a1\u7968\u3001\u65b0\u95fb\u7b49\uff0c\u5f25\u8865\u6a21\u578b\u8bad\u7ec3\u6570\u636e\u7684\u65f6\u95f4\u9650\u5236\u3002\u6a21\u578b\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u4e92\u8054\u7f51\u6216\u5b9e\u65f6\u6570\u636e\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u5b9a\u4e49\u7684\u5de5\u5177\u51fd\u6570\u6765\u83b7\u53d6\u8fd9\u4e9b\u4fe1\u606f\u3002<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b9a\u4e49\u4e00\u4e2a\u80fd\u591f\u67e5\u8be2\u5b9e\u65f6\u6570\u636e\u7684\u5de5\u5177\u51fd\u6570\uff08\u5982get_stock_price\uff09<\/li>\n\n\n\n<li>\u5728\u51fd\u6570\u63cf\u8ff0\u4e2d\u660e\u786e\u8bf4\u660e\u5de5\u5177\u7684\u529f\u80fd\u548c\u6570\u636e\u6765\u6e90<\/li>\n\n\n\n<li>\u5b9a\u4e49\u5fc5\u8981\u7684\u53c2\u6570\uff08\u5982\u80a1\u7968\u4ee3\u7801\u3001\u57ce\u5e02\u540d\u79f0\u7b49\uff09<\/li>\n\n\n\n<li>\u6a21\u578b\u4f1a\u8bc6\u522b\u7528\u6237\u8bf7\u6c42\u4e2d\u7684\u5b9e\u65f6\u6570\u636e\u9700\u6c42\u5e76\u8c03\u7528\u76f8\u5e94\u5de5\u5177<\/li>\n\n\n\n<li>\u5de5\u5177\u6267\u884c\u540e\u8fd4\u56de\u5b9e\u65f6\u6570\u636e\uff0c\u6a21\u578b\u57fa\u4e8e\u8fd9\u4e9b\u6570\u636e\u751f\u6210\u56de\u7b54<\/li>\n<\/ul>\n\n\n\n<p><strong>\u6267\u884c\u6d41\u7a0b\uff1a<\/strong>\u7528\u6237\u63d0\u95ee \u2192 \u6a21\u578b\u8bc6\u522b\u9700\u8981\u5b9e\u65f6\u6570\u636e \u2192 \u8c03\u7528\u5de5\u5177\u51fd\u6570 \u2192 \u5de5\u5177\u67e5\u8be2\u5916\u90e8\u6570\u636e\u6e90 \u2192 \u8fd4\u56de\u7ed3\u679c \u2192 \u6a21\u578b\u751f\u6210\u57fa\u4e8e\u5b9e\u65f6\u6570\u636e\u7684\u56de\u7b54<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>{\n  \"model\": \"gpt-5.2\",\n  \"messages\": &#91;\n    {\n      \"role\": \"user\",\n      \"content\": \"\u67e5\u8be2\u82f9\u679c\u516c\u53f8\u4eca\u5929\u7684\u80a1\u4ef7\u3002\"\n    }\n  &#93;,\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"function\": {\n        \"name\": \"get_stock_price\",\n        \"description\": \"\u83b7\u53d6\u6307\u5b9a\u80a1\u7968\u7684\u5b9e\u65f6\u4ef7\u683c\",\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"symbol\": {\n              \"type\": \"string\",\n              \"description\": \"\u80a1\u7968\u4ee3\u7801\"\n            }\n          },\n          \"required\": &#91;\"symbol\"&#93;\n        }\n      }\n    }\n  ]\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">model<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">gpt-5.2<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">messages<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">role<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">user<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">content<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u67e5\u8be2\u82f9\u679c\u516c\u53f8\u4eca\u5929\u7684\u80a1\u4ef7\u3002<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&#93;,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">tools<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">name<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">get_stock_price<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u83b7\u53d6\u6307\u5b9a\u80a1\u7968\u7684\u5b9e\u65f6\u4ef7\u683c<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">parameters<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">object<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">properties<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">symbol<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">string<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u80a1\u7968\u4ee3\u7801<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">required<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">symbol<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5916\u90e8\u7cfb\u7edf\u96c6\u6210<\/strong><\/h3>\n\n\n\n<p><strong>\u573a\u666f\u8bf4\u660e\uff1a<\/strong>\u5c06\u6a21\u578b\u4e0e\u73b0\u6709\u7cfb\u7edf\u96c6\u6210\uff0c\u901a\u8fc7\u5de5\u5177\u8c03\u7528\u6267\u884c\u6570\u636e\u5e93\u67e5\u8be2\u3001API\u8c03\u7528\u3001\u6587\u4ef6\u64cd\u4f5c\u7b49\u4efb\u52a1\u3002\u8fd9\u4f7f\u5f97\u6a21\u578b\u80fd\u591f\u8bbf\u95ee\u548c\u64cd\u4f5c\u4f01\u4e1a\u5185\u90e8\u7cfb\u7edf\uff0c\u5b9e\u73b0\u667a\u80fd\u5316\u7684\u4e1a\u52a1\u6d41\u7a0b\u81ea\u52a8\u5316\u3002<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b9a\u4e49\u4e0e\u5916\u90e8\u7cfb\u7edf\u4ea4\u4e92\u7684\u5de5\u5177\u51fd\u6570\uff08\u5982query_database\uff09<\/li>\n\n\n\n<li>\u5728\u51fd\u6570\u63cf\u8ff0\u4e2d\u8bf4\u660e\u5de5\u5177\u7684\u529f\u80fd\u3001\u6743\u9650\u8303\u56f4\u548c\u6ce8\u610f\u4e8b\u9879<\/li>\n\n\n\n<li>\u5b9a\u4e49\u5fc5\u8981\u7684\u53c2\u6570\uff08\u5982\u7528\u6237ID\u3001\u67e5\u8be2\u6761\u4ef6\u3001\u64cd\u4f5c\u7c7b\u578b\u7b49\uff09<\/li>\n\n\n\n<li>\u5b9e\u73b0\u5de5\u5177\u51fd\u6570\u65f6\u786e\u4fdd\u5b89\u5168\u6027\u548c\u6743\u9650\u63a7\u5236<\/li>\n\n\n\n<li>\u6a21\u578b\u4f1a\u6839\u636e\u7528\u6237\u8bf7\u6c42\u8c03\u7528\u76f8\u5e94\u7684\u5de5\u5177\u51fd\u6570\u4e0e\u5916\u90e8\u7cfb\u7edf\u4ea4\u4e92<\/li>\n\n\n\n<li>\u5de5\u5177\u8fd4\u56de\u5916\u90e8\u7cfb\u7edf\u7684\u6570\u636e\u6216\u64cd\u4f5c\u7ed3\u679c\uff0c\u6a21\u578b\u751f\u6210\u54cd\u5e94<\/li>\n<\/ul>\n\n\n\n<p><strong>\u6267\u884c\u6d41\u7a0b\uff1a<\/strong>\u7528\u6237\u8bf7\u6c42 \u2192 \u6a21\u578b\u8bc6\u522b\u9700\u8981\u8bbf\u95ee\u5916\u90e8\u7cfb\u7edf \u2192 \u8c03\u7528\u5de5\u5177\u51fd\u6570 \u2192 \u5de5\u5177\u4e0e\u5916\u90e8\u7cfb\u7edf\u4ea4\u4e92\uff08\u6570\u636e\u5e93\/API\/\u6587\u4ef6\u7cfb\u7edf\uff09 \u2192 \u8fd4\u56de\u7ed3\u679c \u2192 \u6a21\u578b\u751f\u6210\u57fa\u4e8e\u7cfb\u7edf\u6570\u636e\u7684\u56de\u7b54<\/p>\n\n\n\n<p><strong>\u6ce8\u610f\u4e8b\u9879\uff1a<\/strong>\u786e\u4fdd\u5de5\u5177\u51fd\u6570\u5b9e\u73b0\u9002\u5f53\u7684\u8eab\u4efd\u9a8c\u8bc1\u3001\u6743\u9650\u63a7\u5236\u548c\u9519\u8bef\u5904\u7406\u673a\u5236\uff0c\u4fdd\u62a4\u7cfb\u7edf\u5b89\u5168\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>{\n  \"model\": \"gpt-5.2\",\n  \"messages\": &#91;\n    {\n      \"role\": \"user\",\n      \"content\": \"\u67e5\u8be2\u7528\u6237\u5f20\u4e09\u7684\u8ba2\u5355\u4fe1\u606f\u3002\"\n    }\n  &#93;,\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"function\": {\n        \"name\": \"query_database\",\n        \"description\": \"\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u7684\u7528\u6237\u8ba2\u5355\u4fe1\u606f\",\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"user_id\": {\n              \"type\": \"string\",\n              \"description\": \"\u7528\u6237ID\"\n            }\n          },\n          \"required\": &#91;\"user_id\"&#93;\n        }\n      }\n    }\n  ]\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">model<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">gpt-5.2<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">messages<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">role<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">user<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">content<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u67e5\u8be2\u7528\u6237\u5f20\u4e09\u7684\u8ba2\u5355\u4fe1\u606f\u3002<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&#93;,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">tools<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">name<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">query_database<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u7684\u7528\u6237\u8ba2\u5355\u4fe1\u606f<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">parameters<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">object<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">properties<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">user_id<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">string<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u7528\u6237ID<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">required<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">user_id<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u81ea\u52a8\u5316\u4efb\u52a1\u6267\u884c<\/strong><\/h3>\n\n\n\n<p><strong>\u573a\u666f\u8bf4\u660e\uff1a<\/strong>\u901a\u8fc7\u5de5\u5177\u8c03\u7528\uff0c\u6a21\u578b\u53ef\u4ee5\u6267\u884c\u81ea\u52a8\u5316\u4efb\u52a1\uff0c\u5982\u53d1\u9001\u90ae\u4ef6\u3001\u521b\u5efa\u65e5\u5386\u4e8b\u4ef6\u3001\u66f4\u65b0CRM\u7cfb\u7edf\u7b49\u3002\u8fd9\u4f7f\u5f97\u6a21\u578b\u80fd\u591f\u6210\u4e3a\u667a\u80fd\u52a9\u624b\uff0c\u5e2e\u52a9\u7528\u6237\u5b8c\u6210\u5404\u79cd\u65e5\u5e38\u5de5\u4f5c\u548c\u4e1a\u52a1\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b9a\u4e49\u80fd\u591f\u6267\u884c\u7279\u5b9a\u64cd\u4f5c\u7684\u5de5\u5177\u51fd\u6570\uff08\u5982send_email\u3001create_calendar_event\uff09<\/li>\n\n\n\n<li>\u5728\u51fd\u6570\u63cf\u8ff0\u4e2d\u8be6\u7ec6\u8bf4\u660e\u5de5\u5177\u7684\u529f\u80fd\u3001\u53c2\u6570\u8981\u6c42\u548c\u6267\u884c\u6548\u679c<\/li>\n\n\n\n<li>\u5b9a\u4e49\u6240\u6709\u5fc5\u8981\u7684\u53c2\u6570\uff08\u5982\u6536\u4ef6\u4eba\u3001\u4e3b\u9898\u3001\u6b63\u6587\u3001\u65f6\u95f4\u3001\u5730\u70b9\u7b49\uff09<\/li>\n\n\n\n<li>\u5de5\u5177\u51fd\u6570\u5e94\u9a8c\u8bc1\u53c2\u6570\u5b8c\u6574\u6027\u5e76\u6267\u884c\u5b9e\u9645\u64cd\u4f5c<\/li>\n\n\n\n<li>\u6a21\u578b\u4f1a\u6839\u636e\u7528\u6237\u7684\u81ea\u7136\u8bed\u8a00\u6307\u4ee4\u63d0\u53d6\u53c2\u6570\u5e76\u8c03\u7528\u76f8\u5e94\u5de5\u5177<\/li>\n\n\n\n<li>\u5de5\u5177\u6267\u884c\u64cd\u4f5c\u540e\u8fd4\u56de\u7ed3\u679c\uff0c\u6a21\u578b\u786e\u8ba4\u64cd\u4f5c\u5b8c\u6210\u6216\u62a5\u544a\u9519\u8bef<\/li>\n<\/ul>\n\n\n\n<p><strong>\u6267\u884c\u6d41\u7a0b\uff1a<\/strong>\u7528\u6237\u53d1\u51fa\u6307\u4ee4 \u2192 \u6a21\u578b\u7406\u89e3\u4efb\u52a1\u610f\u56fe \u2192 \u63d0\u53d6\u5fc5\u8981\u53c2\u6570 \u2192 \u8c03\u7528\u5de5\u5177\u51fd\u6570 \u2192 \u5de5\u5177\u6267\u884c\u81ea\u52a8\u5316\u64cd\u4f5c \u2192 \u8fd4\u56de\u6267\u884c\u7ed3\u679c \u2192 \u6a21\u578b\u5411\u7528\u6237\u786e\u8ba4\u4efb\u52a1\u5b8c\u6210<\/p>\n\n\n\n<p><strong>\u5e94\u7528\u573a\u666f\uff1a<\/strong>\u90ae\u4ef6\u53d1\u9001\u3001\u65e5\u7a0b\u7ba1\u7406\u3001CRM\u6570\u636e\u66f4\u65b0\u3001\u4efb\u52a1\u5206\u914d\u3001\u62a5\u544a\u751f\u6210\u3001\u901a\u77e5\u53d1\u9001\u7b49\u65e5\u5e38\u529e\u516c\u81ea\u52a8\u5316\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#d8dee9ff;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>{\n  \"model\": \"gpt-5.2\",\n  \"messages\": &#91;\n    {\n      \"role\": \"user\",\n      \"content\": \"\u7ed9\u674e\u56db\u53d1\u9001\u4e00\u5c01\u4f1a\u8bae\u9080\u8bf7\u90ae\u4ef6\u3002\"\n    }\n  &#93;,\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"function\": {\n        \"name\": \"send_email\",\n        \"description\": \"\u53d1\u9001\u90ae\u4ef6\u7ed9\u6307\u5b9a\u6536\u4ef6\u4eba\",\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"to\": {\n              \"type\": \"string\",\n              \"description\": \"\u6536\u4ef6\u4eba\u90ae\u7bb1\"\n            },\n            \"subject\": {\n              \"type\": \"string\",\n              \"description\": \"\u90ae\u4ef6\u4e3b\u9898\"\n            },\n            \"body\": {\n              \"type\": \"string\",\n              \"description\": \"\u90ae\u4ef6\u6b63\u6587\"\n            }\n          },\n          \"required\": &#91;\"to\", \"subject\", \"body\"&#93;\n        }\n      }\n    }\n  ]\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">model<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">gpt-5.2<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">messages<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">role<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">user<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">content<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u7ed9\u674e\u56db\u53d1\u9001\u4e00\u5c01\u4f1a\u8bae\u9080\u8bf7\u90ae\u4ef6\u3002<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&#93;,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">tools<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">function<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">name<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">send_email<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u53d1\u9001\u90ae\u4ef6\u7ed9\u6307\u5b9a\u6536\u4ef6\u4eba<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">parameters<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">object<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">properties<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">to<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">string<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u6536\u4ef6\u4eba\u90ae\u7bb1<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">subject<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">string<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u90ae\u4ef6\u4e3b\u9898<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">body<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">type<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">string<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">              <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">description<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u90ae\u4ef6\u6b63\u6587<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">          <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">required<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">to<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">subject<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">body<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u5efa\u8bae<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u63d0\u4f9b\u6e05\u6670\u7684\u5de5\u5177\u63cf\u8ff0<\/strong>\uff1a\u4e3a\u6bcf\u4e2a\u5de5\u5177\u63d0\u4f9b\u8be6\u7ec6\u3001\u51c6\u786e\u7684\u63cf\u8ff0\uff0c\u5e2e\u52a9\u6a21\u578b\u7406\u89e3\u5de5\u5177\u7684\u7528\u9014\u548c\u9002\u7528\u573a\u666f<\/li>\n\n\n\n<li><strong>\u5b9a\u4e49\u5b8c\u6574\u7684\u53c2\u6570schema<\/strong>\uff1a\u5728parameters\u5b57\u6bb5\u4e2d\u5b9a\u4e49\u5b8c\u6574\u7684JSON Schema\uff0c\u5305\u62ec\u7c7b\u578b\u3001\u63cf\u8ff0\u3001\u683c\u5f0f\u548c\u5fc5\u9700\u5b57\u6bb5<\/li>\n\n\n\n<li><strong>\u4f7f\u7528\u6709\u610f\u4e49\u7684\u51fd\u6570\u540d<\/strong>\uff1a\u9009\u62e9\u6e05\u6670\u3001\u63cf\u8ff0\u6027\u7684\u51fd\u6570\u540d\u79f0\uff0c\u4fbf\u4e8e\u6a21\u578b\u7406\u89e3\u548c\u8c03\u7528<\/li>\n\n\n\n<li><strong>\u9650\u5236\u5de5\u5177\u6570\u91cf<\/strong>\uff1a\u907f\u514d\u63d0\u4f9b\u8fc7\u591a\u5de5\u5177\uff0c\u8fd9\u53ef\u80fd\u5bfc\u81f4\u6a21\u578b\u9009\u62e9\u56f0\u96be\u3002\u5efa\u8bae\u6839\u636e\u573a\u666f\u63d0\u4f9b3-10\u4e2a\u76f8\u5173\u5de5\u5177<\/li>\n\n\n\n<li><strong>\u5b9e\u73b0\u9519\u8bef\u5904\u7406<\/strong>\uff1a\u8bbe\u8ba1\u53ef\u9760\u7684\u9519\u8bef\u5904\u7406\u673a\u5236\uff0c\u5904\u7406\u6a21\u578b\u53ef\u80fd\u7684\u9519\u8bef\u8c03\u7528\u6216\u53c2\u6570\u4e0d\u5b8c\u6574\u7684\u60c5\u51b5<\/li>\n\n\n\n<li><strong>\u7ed3\u5408tool_choice\u4f7f\u7528<\/strong>\uff1a\u4f7f\u7528tool_choice\u53c2\u6570\u63a7\u5236\u6a21\u578b\u7684\u5de5\u5177\u9009\u62e9\u884c\u4e3a\uff0c\u5982\u5f3a\u5236\u8c03\u7528\u7279\u5b9a\u5de5\u5177\u6216\u7981\u7528\u5de5\u5177\u8c03\u7528<\/li>\n\n\n\n<li><strong>\u6d4b\u8bd5\u5de5\u5177\u8c03\u7528<\/strong>\uff1a\u5728\u5f00\u53d1\u9636\u6bb5\u5145\u5206\u6d4b\u8bd5\u5de5\u5177\u8c03\u7528\u903b\u8f91\uff0c\u786e\u4fdd\u6a21\u578b\u80fd\u591f\u6b63\u786e\u8bc6\u522b\u548c\u4f7f\u7528\u5de5\u5177<\/li>\n\n\n\n<li><strong>\u76d1\u63a7\u8c03\u7528\u9891\u7387<\/strong>\uff1a\u76d1\u63a7\u5de5\u5177\u8c03\u7528\u7684\u9891\u7387\u548c\u6210\u529f\u7387\uff0c\u4f18\u5316\u5de5\u5177\u5b9a\u4e49\u548c\u63d0\u793a\u8bcd\u8bbe\u8ba1<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5e38\u89c1\u95ee\u9898\u89e3\u7b54<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u95ee\uff1a\u6a21\u578b\u5982\u4f55\u51b3\u5b9a\u662f\u5426\u8c03\u7528\u5de5\u5177\uff1f<\/strong><br>\u7b54\uff1a\u6a21\u578b\u4f1a\u6839\u636e\u5bf9\u8bdd\u4e0a\u4e0b\u6587\u548c\u7528\u6237\u8bf7\u6c42\uff0c\u5206\u6790\u662f\u5426\u9700\u8981\u8c03\u7528\u63d0\u4f9b\u7684\u5de5\u5177\u3002\u5982\u679c\u7528\u6237\u8bf7\u6c42\u7684\u4fe1\u606f\u53ef\u4ee5\u901a\u8fc7\u5de5\u5177\u83b7\u53d6\uff0c\u6216\u8005\u7528\u6237\u660e\u786e\u8981\u6c42\u6267\u884c\u67d0\u4e2a\u64cd\u4f5c\uff0c\u6a21\u578b\u4f1a\u503e\u5411\u4e8e\u8c03\u7528\u5de5\u5177\u3002\u6a21\u578b\u4f1a\u8bc4\u4f30\u5de5\u5177\u7684\u63cf\u8ff0\u548c\u53c2\u6570\uff0c\u5224\u65ad\u54ea\u4e2a\u5de5\u5177\u6700\u9002\u5408\u5f53\u524d\u8bf7\u6c42\u3002\u5982\u679c\u4e0d\u9700\u8981\u5de5\u5177\u5c31\u80fd\u56de\u7b54\uff0c\u6a21\u578b\u53ef\u80fd\u4f1a\u76f4\u63a5\u56de\u7b54\u800c\u4e0d\u8c03\u7528\u5de5\u5177\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1a\u53ef\u4ee5\u540c\u65f6\u5b9a\u4e49\u591a\u4e2a\u5de5\u5177\u5417\uff1f<\/strong><br>\u7b54\uff1a\u662f\u7684\uff0c\u53ef\u4ee5\u5728tools\u6570\u7ec4\u4e2d\u5b9a\u4e49\u591a\u4e2a\u5de5\u5177\u3002\u6a21\u578b\u4f1a\u6839\u636e\u7528\u6237\u8bf7\u6c42\u9009\u62e9\u6700\u5408\u9002\u7684\u5de5\u5177\u8fdb\u884c\u8c03\u7528\u3002\u591a\u4e2a\u5de5\u5177\u53ef\u4ee5\u7528\u4e8e\u4e0d\u540c\u7684\u4efb\u52a1\u7c7b\u578b\uff0c\u5982\u5929\u6c14\u67e5\u8be2\u3001\u80a1\u7968\u67e5\u8be2\u3001\u6570\u636e\u5e93\u64cd\u4f5c\u7b49\u3002\u5efa\u8bae\u5c06\u76f8\u5173\u529f\u80fd\u7684\u5de5\u5177\u5206\u7ec4\uff0c\u907f\u514d\u63d0\u4f9b\u8fc7\u591a\u4e0d\u76f8\u5173\u7684\u5de5\u5177\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1a\u5de5\u5177\u8c03\u7528\u7684\u7ed3\u679c\u5982\u4f55\u4f20\u9012\u56de\u6a21\u578b\uff1f<\/strong><br>\u7b54\uff1a\u5de5\u5177\u8c03\u7528\u7684\u7ed3\u679c\u9700\u8981\u4f5c\u4e3a\u65b0\u7684\u6d88\u606f\u6dfb\u52a0\u5230messages\u6570\u7ec4\u4e2d\uff0c\u901a\u5e38\u4f7f\u7528&#8221;tool&#8221;\u89d2\u8272\u3002\u6a21\u578b\u4f1a\u6839\u636e\u5de5\u5177\u8fd4\u56de\u7684\u7ed3\u679c\u7ee7\u7eed\u751f\u6210\u54cd\u5e94\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u591a\u8f6e\u4ea4\u4e92\uff1a\u6a21\u578b\u8c03\u7528\u5de5\u5177\uff0c\u6267\u884c\u5de5\u5177\uff0c\u8fd4\u56de\u7ed3\u679c\uff0c\u6a21\u578b\u5904\u7406\u7ed3\u679c\uff0c\u53ef\u80fd\u518d\u6b21\u8c03\u7528\u5de5\u5177\u6216\u751f\u6210\u6700\u7ec8\u7b54\u6848\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1a\u5982\u4f55\u5904\u7406\u5de5\u5177\u8c03\u7528\u5931\u8d25\u7684\u60c5\u51b5\uff1f<\/strong><br>\u7b54\uff1a\u5f53\u5de5\u5177\u8c03\u7528\u5931\u8d25\u65f6\uff0c\u5e94\u8be5\u5c06\u9519\u8bef\u4fe1\u606f\u4f5c\u4e3a\u5de5\u5177\u7ed3\u679c\u8fd4\u56de\u7ed9\u6a21\u578b\u3002\u6a21\u578b\u4f1a\u6839\u636e\u9519\u8bef\u4fe1\u606f\u8c03\u6574\u7b56\u7565\uff0c\u53ef\u80fd\u5c1d\u8bd5\u5176\u4ed6\u65b9\u6cd5\u6216\u5411\u7528\u6237\u8bf4\u660e\u95ee\u9898\u3002\u5efa\u8bae\u5728\u5de5\u5177\u5b9e\u73b0\u4e2d\u6dfb\u52a0\u8be6\u7ec6\u7684\u9519\u8bef\u5904\u7406\u548c\u65e5\u5fd7\u8bb0\u5f55\uff0c\u4fbf\u4e8e\u8c03\u8bd5\u548c\u76d1\u63a7\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1atools\u53c2\u6570\u4f1a\u5f71\u54cdAPI\u54cd\u5e94\u65f6\u95f4\u5417\uff1f<\/strong><br>\u7b54\uff1atools\u53c2\u6570\u672c\u8eab\u4e0d\u4f1a\u663e\u8457\u5f71\u54cdAPI\u54cd\u5e94\u65f6\u95f4\u3002\u4f46\u662f\uff0c\u5982\u679c\u6a21\u578b\u51b3\u5b9a\u8c03\u7528\u5de5\u5177\uff0c\u6574\u4e2a\u4ea4\u4e92\u8fc7\u7a0b\u4f1a\u5305\u62ec\u5de5\u5177\u8c03\u7528\u548c\u7ed3\u679c\u8fd4\u56de\uff0c\u8fd9\u4f1a\u589e\u52a0\u603b\u4f53\u7684\u54cd\u5e94\u65f6\u95f4\u3002\u5de5\u5177\u672c\u8eab\u7684\u6267\u884c\u65f6\u95f4\u4e5f\u4f1a\u5f71\u54cd\u6574\u4f53\u6027\u80fd\u3002\u5efa\u8bae\u4f18\u5316\u5de5\u5177\u5b9e\u73b0\uff0c\u786e\u4fdd\u5feb\u901f\u54cd\u5e94\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1a\u53ef\u4ee5\u5728\u6d41\u5f0f\u54cd\u5e94\u4e2d\u4f7f\u7528\u5de5\u5177\u5417\uff1f<\/strong><br>\u7b54\uff1a\u662f\u7684\uff0c\u5de5\u5177\u8c03\u7528\u53ef\u4ee5\u5728\u6d41\u5f0f\u54cd\u5e94\u4e2d\u4f7f\u7528\u3002\u5f53\u6a21\u578b\u51b3\u5b9a\u8c03\u7528\u5de5\u5177\u65f6\uff0c\u4f1a\u751f\u6210\u4e00\u4e2a\u7279\u6b8a\u7684\u5de5\u5177\u8c03\u7528\u6d88\u606f\uff0c\u6d41\u5f0f\u4f20\u8f93\u4f1a\u6682\u505c\u3002\u5de5\u5177\u6267\u884c\u5b8c\u6210\u540e\uff0c\u5c06\u7ed3\u679c\u4f5c\u4e3a\u65b0\u6d88\u606f\u53d1\u9001\uff0c\u6a21\u578b\u7ee7\u7eed\u751f\u6210\u54cd\u5e94\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6d41\u5f0f\u54cd\u5e94\u4e2d\u7684\u5de5\u5177\u8c03\u7528\u9700\u8981\u5ba2\u6237\u7aef\u8fdb\u884c\u7279\u6b8a\u5904\u7406\uff0c\u8bc6\u522b\u5de5\u5177\u8c03\u7528\u6d88\u606f\u548c\u666e\u901a\u6587\u672c\u6d88\u606f\u3002<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<h2 class=\"wp-block-heading\">OpenAI API\u517c\u5bb9\u683c\u5f0f\u76ee\u5f55<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-format\/\">\u8bf7\u6c42\u683c\u5f0f\u6982\u89c8<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/\" data-type=\"link\" data-id=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/\">\u8bf7\u6c42\u53c2\u6570\u8be6\u89e3<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/model\/\">model<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/messages\/\">messages<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/temperature\/\">temperature<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/max_tokens\/\">max_tokens<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/stream\/\">stream<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/stop\/\" data-type=\"page\" data-id=\"278\">stop<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/top_p\/\">top_p<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/n\/\">n<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/presence_penalty\/\" data-type=\"page\" data-id=\"347\">presence_penalty<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/frequency_penalty\/\" data-type=\"page\" data-id=\"361\">frequency_penalty<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/user\/\">user<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/response_format\/\" data-type=\"page\" data-id=\"331\">response_format<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/tools\/\">tools<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/tool_choice\/\">tool_choice<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/logit_bias\/\">logit_bias<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/logprobs_description\/\">logprobs<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/top_logprobs\/\">top_logprobs<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/ai.taichi-maker.com\/index.php\/ai-development-referene\/ai-api-references\/openai-api-compatible-format\/openai-api-request-parameters\/seed\/\">seed<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5e38\u89c1\u7ec4\u548c\u7528\u6cd5<\/li>\n\n\n\n<li>\u9644\u5f55<\/li>\n<\/ul>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5bfc\u822a\u680f\uff1a\u9996\u9875 \/ AI\u5f00\u53d1\u53c2\u8003\u8d44\u6599 \/ OpenAI API \u517c\u5bb9\u683c\u5f0f\u53c2\u8003\u8d44\u6599 \/ \u8bf7\u6c42\u53c2\u6570\u8be6\u89e3 \/ tool [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":193,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-443","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/pages\/443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/comments?post=443"}],"version-history":[{"count":11,"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/pages\/443\/revisions"}],"predecessor-version":[{"id":456,"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/pages\/443\/revisions\/456"}],"up":[{"embeddable":true,"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/pages\/193"}],"wp:attachment":[{"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/media?parent=443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}