{"id":996,"date":"2023-10-28T18:12:15","date_gmt":"2023-10-28T10:12:15","guid":{"rendered":"https:\/\/www.gaoxigang.com\/?p=996"},"modified":"2023-10-28T18:12:15","modified_gmt":"2023-10-28T10:12:15","slug":"%e7%99%be%e5%ba%a6%e6%96%87%e5%bf%83%e4%b8%80%e8%a8%80-ernie-bot-4-api-%e5%bc%80%e5%8f%91%e6%96%87%e6%a1%a3","status":"publish","type":"post","link":"https:\/\/www.gaoxigang.com\/index.php\/2023\/10\/28\/%e7%99%be%e5%ba%a6%e6%96%87%e5%bf%83%e4%b8%80%e8%a8%80-ernie-bot-4-api-%e5%bc%80%e5%8f%91%e6%96%87%e6%a1%a3\/","title":{"rendered":"\u767e\u5ea6\u6587\u5fc3\u4e00\u8a00 ERNIE-Bot-4 API \u5f00\u53d1\u6587\u6863"},"content":{"rendered":"\n<p>ERNIE-Bot-4\u662f\u767e\u5ea6\u81ea\u884c\u7814\u53d1\u7684\u5927\u8bed\u8a00\u6a21\u578b\uff0c\u8986\u76d6\u6d77\u91cf\u4e2d\u6587\u6570\u636e\uff0c\u5177\u6709\u66f4\u5f3a\u7684\u5bf9\u8bdd\u95ee\u7b54\u3001\u5185\u5bb9\u521b\u4f5c\u751f\u6210\u7b49\u80fd\u529b\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u5343\u5e06\u76f8\u5173API\u53ca\u5e94\u7528\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u521b\u5efachat<\/h2>\n\n\n\n<p>\u8c03\u7528\u672c\u63a5\u53e3\uff0c\u53d1\u8d77\u4e00\u6b21\u5bf9\u8bdd\u8bf7\u6c42\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6ce8\u610f\u4e8b\u9879<\/h3>\n\n\n\n<p><strong>\u672c\u6587\u63a5\u53e3\u8fd4\u56de\u4e0d\u652f\u6301\u56fe\u7247\u5185\u5bb9\u3002<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bf7\u6c42\u8bf4\u660e<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u57fa\u672c\u4fe1\u606f<\/h4>\n\n\n\n<p><strong>\u8bf7\u6c42\u5730\u5740\uff1a<\/strong>&nbsp;<code>https:\/\/aip.baidubce.com\/rpc\/2.0\/ai_custom\/v1\/wenxinworkshop\/chat\/completions_pro<\/code><\/p>\n\n\n\n<p><strong>\u8bf7\u6c42\u65b9\u5f0f\uff1a<\/strong>&nbsp;POST<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Header\u53c2\u6570<\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u503c<\/th><\/tr><\/thead><tbody><tr><td>Content-Type<\/td><td>application\/json<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Query\u53c2\u6570<\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u5fc5\u586b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>access_token<\/td><td>string<\/td><td>\u662f<\/td><td>\u901a\u8fc7API Key\u548cSecret Key\u83b7\u53d6\u7684access_token\uff0c\u53c2\u8003<a href=\"https:\/\/cloud.baidu.com\/doc\/WENXINWORKSHOP\/s\/Ilkkrb0i5\">Access Token\u83b7\u53d6<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Body\u53c2\u6570<\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u5fc5\u586b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>messages<\/td><td>List(message)<\/td><td>\u662f<\/td><td>\u804a\u5929\u4e0a\u4e0b\u6587\u4fe1\u606f\u3002\u8bf4\u660e\uff1a<br>\uff081\uff09messages\u6210\u5458\u4e0d\u80fd\u4e3a\u7a7a\uff0c1\u4e2a\u6210\u5458\u8868\u793a\u5355\u8f6e\u5bf9\u8bdd\uff0c\u591a\u4e2a\u6210\u5458\u8868\u793a\u591a\u8f6e\u5bf9\u8bdd<br>\uff082\uff09\u6700\u540e\u4e00\u4e2amessage\u4e3a\u5f53\u524d\u8bf7\u6c42\u7684\u4fe1\u606f\uff0c\u524d\u9762\u7684message\u4e3a\u5386\u53f2\u5bf9\u8bdd\u4fe1\u606f<br>\uff083\uff09\u5fc5\u987b\u4e3a\u5947\u6570\u4e2a\u6210\u5458\uff0c\u6210\u5458\u4e2dmessage\u7684role\u5fc5\u987b\u4f9d\u6b21\u4e3auser(or function)\u3001assistant<br>\uff084\uff09\u6700\u540e\u4e00\u4e2amessage\u7684content\u957f\u5ea6\uff08\u5373\u6b64\u8f6e\u5bf9\u8bdd\u7684\u95ee\u9898\uff09\u4e0d\u80fd\u8d85\u8fc73000 token\uff1b\u5982\u679cmessages\u4e2dcontent\u603b\u957f\u5ea6\u5927\u4e8e3000 token\uff0c\u7cfb\u7edf\u4f1a\u4f9d\u6b21\u9057\u5fd8\u6700\u65e9\u7684\u5386\u53f2\u4f1a\u8bdd\uff0c\u76f4\u5230content\u7684\u603b\u957f\u5ea6\u4e0d\u8d85\u8fc73000 token<\/td><\/tr><tr><td>functions<\/td><td>List(function)<\/td><td>\u5426<\/td><td>\u4e00\u4e2a\u53ef\u89e6\u53d1\u51fd\u6570\u7684\u63cf\u8ff0\u5217\u8868<\/td><\/tr><tr><td>temperature<\/td><td>float<\/td><td>\u5426<\/td><td>\u8bf4\u660e\uff1a<br>\uff081\uff09\u8f83\u9ad8\u7684\u6570\u503c\u4f1a\u4f7f\u8f93\u51fa\u66f4\u52a0\u968f\u673a\uff0c\u800c\u8f83\u4f4e\u7684\u6570\u503c\u4f1a\u4f7f\u5176\u66f4\u52a0\u96c6\u4e2d\u548c\u786e\u5b9a<br>\uff082\uff09\u9ed8\u8ba40.95\uff0c\u8303\u56f4 (0, 1.0]\uff0c\u4e0d\u80fd\u4e3a0<br>\uff083\uff09\u5efa\u8bae\u8be5\u53c2\u6570\u548ctop_p\u53ea\u8bbe\u7f6e1\u4e2a<br>\uff084\uff09\u5efa\u8baetop_p\u548ctemperature\u4e0d\u8981\u540c\u65f6\u66f4\u6539<\/td><\/tr><tr><td>top_p<\/td><td>float<\/td><td>\u5426<\/td><td>\u8bf4\u660e\uff1a<br>\uff081\uff09\u5f71\u54cd\u8f93\u51fa\u6587\u672c\u7684\u591a\u6837\u6027\uff0c\u53d6\u503c\u8d8a\u5927\uff0c\u751f\u6210\u6587\u672c\u7684\u591a\u6837\u6027\u8d8a\u5f3a<br>\uff082\uff09\u9ed8\u8ba40.8\uff0c\u53d6\u503c\u8303\u56f4 [0, 1.0]<br>\uff083\uff09\u5efa\u8bae\u8be5\u53c2\u6570\u548ctemperature\u53ea\u8bbe\u7f6e1\u4e2a<br>\uff084\uff09\u5efa\u8baetop_p\u548ctemperature\u4e0d\u8981\u540c\u65f6\u66f4\u6539<\/td><\/tr><tr><td>penalty_score<\/td><td>float<\/td><td>\u5426<\/td><td>\u901a\u8fc7\u5bf9\u5df2\u751f\u6210\u7684token\u589e\u52a0\u60e9\u7f5a\uff0c\u51cf\u5c11\u91cd\u590d\u751f\u6210\u7684\u73b0\u8c61\u3002\u8bf4\u660e\uff1a<br>\uff081\uff09\u503c\u8d8a\u5927\u8868\u793a\u60e9\u7f5a\u8d8a\u5927<br>\uff082\uff09\u9ed8\u8ba41.0\uff0c\u53d6\u503c\u8303\u56f4\uff1a[1.0, 2.0]<\/td><\/tr><tr><td>stream<\/td><td>bool<\/td><td>\u5426<\/td><td>\u662f\u5426\u4ee5\u6d41\u5f0f\u63a5\u53e3\u7684\u5f62\u5f0f\u8fd4\u56de\u6570\u636e\uff0c\u9ed8\u8ba4false<\/td><\/tr><tr><td>system<\/td><td>string<\/td><td>\u5426<\/td><td>\u6a21\u578b\u4eba\u8bbe\uff0c\u4e3b\u8981\u7528\u4e8e\u4eba\u8bbe\u8bbe\u5b9a\uff0c\u4f8b\u5982\uff0c\u4f60\u662fxxx\u516c\u53f8\u5236\u4f5c\u7684AI\u52a9\u624b\uff0c\u8bf4\u660e\uff1a<br>\uff081\uff09\u957f\u5ea6\u9650\u52361024\u4e2a\u5b57\u7b26<br>\uff082\uff09\u5982\u679c\u4f7f\u7528functions\u53c2\u6570\uff0c\u4e0d\u652f\u6301\u8bbe\u5b9a\u4eba\u8bbesystem<\/td><\/tr><tr><td>user_id<\/td><td>string<\/td><td>\u5426<\/td><td>\u8868\u793a\u6700\u7ec8\u7528\u6237\u7684\u552f\u4e00\u6807\u8bc6\u7b26\uff0c\u53ef\u4ee5\u76d1\u89c6\u548c\u68c0\u6d4b\u6ee5\u7528\u884c\u4e3a\uff0c\u9632\u6b62\u63a5\u53e3\u6076\u610f\u8c03\u7528<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>message\u8bf4\u660e<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u5fc5\u586b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>role<\/td><td>string<\/td><td>\u662f<\/td><td>\u5f53\u524d\u652f\u6301\u4ee5\u4e0b\uff1a<br>user: \u8868\u793a\u7528\u6237<br>assistant: \u8868\u793a\u5bf9\u8bdd\u52a9\u624b<br>function: \u8868\u793a\u51fd\u6570<\/td><\/tr><tr><td>content<\/td><td>string<\/td><td>\u662f<\/td><td>\u5bf9\u8bdd\u5185\u5bb9\uff0c\u5f53\u524dmessage\u5b58\u5728function_call\u65f6\u53ef\u4ee5\u4e3a\u7a7a\uff0c\u5176\u4ed6\u573a\u666f\u4e0d\u80fd\u4e3a\u7a7a<\/td><\/tr><tr><td>name<\/td><td>string<\/td><td>\u5426<\/td><td>message\u4f5c\u8005\uff1b\u5f53role=function\u65f6\uff0c\u5fc5\u586b\uff0c\u4e14\u662f\u54cd\u5e94\u5185\u5bb9\u4e2dfunction_call\u4e2d\u7684name<\/td><\/tr><tr><td>function_call<\/td><td>function_call<\/td><td>\u5426<\/td><td>\u51fd\u6570\u8c03\u7528\uff0cfunction call\u573a\u666f\u4e0b\u7b2c\u4e00\u8f6e\u5bf9\u8bdd\u7684\u8fd4\u56de\uff0c\u7b2c\u4e8c\u8f6e\u5bf9\u8bdd\u4f5c\u4e3a\u5386\u53f2\u4fe1\u606f\u5728message\u4e2d\u4f20\u5165<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>function\u8bf4\u660e<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u5fc5\u586b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>name<\/td><td>string<\/td><td>\u662f<\/td><td>\u51fd\u6570\u540d<\/td><\/tr><tr><td>description<\/td><td>string<\/td><td>\u662f<\/td><td>\u51fd\u6570\u63cf\u8ff0<\/td><\/tr><tr><td>parameters<\/td><td>object<\/td><td>\u662f<\/td><td>\u51fd\u6570\u8bf7\u6c42\u53c2\u6570\uff0c\u8bf4\u660e\uff1a<br>\uff081\uff09JSON Schema \u683c\u5f0f\uff0c\u53c2\u8003<a href=\"https:\/\/json-schema.org\/understanding-json-schema\/\">JSON Schema\u63cf\u8ff0<\/a><br>\uff082\uff09\u5982\u679c\u51fd\u6570\u6ca1\u6709\u8bf7\u6c42\u53c2\u6570\uff0cparameters\u503c\u683c\u5f0f\u5982\u4e0b\uff1a<br><code>{\"type\": \"object\",\"properties\": {}}<\/code><\/td><\/tr><tr><td>responses<\/td><td>object<\/td><td>\u5426<\/td><td>\u51fd\u6570\u54cd\u5e94\u53c2\u6570\uff0cJSON Schema \u683c\u5f0f\uff0c\u53c2\u8003<a href=\"https:\/\/json-schema.org\/understanding-json-schema\/\">JSON Schema\u63cf\u8ff0<\/a><\/td><\/tr><tr><td>examples<\/td><td>List(example)<\/td><td>\u5426<\/td><td>function\u8c03\u7528\u7684\u4e00\u4e9b\u5386\u53f2\u793a\u4f8b<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>example\u8bf4\u660e<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u5fc5\u586b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>role<\/td><td>string<\/td><td>\u662f<\/td><td>\u5f53\u524d\u652f\u6301\u4ee5\u4e0b\uff1a<br>user: \u8868\u793a\u7528\u6237<br>assistant: \u8868\u793a\u5bf9\u8bdd\u52a9\u624b<br>function: \u8868\u793a\u51fd\u6570<\/td><\/tr><tr><td>content<\/td><td>string<\/td><td>\u662f<\/td><td>\u5bf9\u8bdd\u5185\u5bb9\uff0c\u5f53\u524dmessage\u5b58\u5728function_call\u65f6\u53ef\u4ee5\u4e3a\u7a7a\uff0c\u5176\u4ed6\u573a\u666f\u4e0d\u80fd\u4e3a\u7a7a<\/td><\/tr><tr><td>name<\/td><td>string<\/td><td>\u5426<\/td><td>message\u4f5c\u8005\uff1b\u5f53role=function\u65f6\uff0c\u5fc5\u586b\uff0c\u4e14\u662f\u54cd\u5e94\u5185\u5bb9\u4e2dfunction_call\u4e2d\u7684name<\/td><\/tr><tr><td>function_call<\/td><td>function_call<\/td><td>\u5426<\/td><td>\u51fd\u6570\u8c03\u7528\uff0cfunction call\u573a\u666f\u4e0b\u7b2c\u4e00\u8f6e\u5bf9\u8bdd\u7684\u8fd4\u56de\uff0c\u7b2c\u4e8c\u8f6e\u5bf9\u8bdd\u4f5c\u4e3a\u5386\u53f2\u4fe1\u606f\u5728message\u4e2d\u4f20\u5165<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>function_call\u8bf4\u660e<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u5fc5\u586b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>name<\/td><td>string<\/td><td>\u662f<\/td><td>\u89e6\u53d1\u7684function\u540d<\/td><\/tr><tr><td>arguments<\/td><td>string<\/td><td>\u662f<\/td><td>\u8bf7\u6c42\u53c2\u6570<\/td><\/tr><tr><td>thoughts<\/td><td>string<\/td><td>\u5426<\/td><td>\u6a21\u578b\u601d\u8003\u8fc7\u7a0b<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u54cd\u5e94\u8bf4\u660e<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>id<\/td><td>string<\/td><td>\u672c\u8f6e\u5bf9\u8bdd\u7684id<\/td><\/tr><tr><td>object<\/td><td>string<\/td><td>\u56de\u5305\u7c7b\u578b<br>chat.completion\uff1a\u591a\u8f6e\u5bf9\u8bdd\u8fd4\u56de<\/td><\/tr><tr><td>created<\/td><td>int<\/td><td>\u65f6\u95f4\u6233<\/td><\/tr><tr><td>sentence_id<\/td><td>int<\/td><td>\u8868\u793a\u5f53\u524d\u5b50\u53e5\u7684\u5e8f\u53f7\u3002\u53ea\u6709\u5728\u6d41\u5f0f\u63a5\u53e3\u6a21\u5f0f\u4e0b\u4f1a\u8fd4\u56de\u8be5\u5b57\u6bb5<\/td><\/tr><tr><td>is_end<\/td><td>bool<\/td><td>\u8868\u793a\u5f53\u524d\u5b50\u53e5\u662f\u5426\u662f\u6700\u540e\u4e00\u53e5\u3002\u53ea\u6709\u5728\u6d41\u5f0f\u63a5\u53e3\u6a21\u5f0f\u4e0b\u4f1a\u8fd4\u56de\u8be5\u5b57\u6bb5<\/td><\/tr><tr><td>is_truncated<\/td><td>bool<\/td><td>\u5f53\u524d\u751f\u6210\u7684\u7ed3\u679c\u662f\u5426\u88ab\u622a\u65ad<\/td><\/tr><tr><td>result<\/td><td>string<\/td><td>\u5bf9\u8bdd\u8fd4\u56de\u7ed3\u679c<\/td><\/tr><tr><td>need_clear_history<\/td><td>bool<\/td><td>\u8868\u793a\u7528\u6237\u8f93\u5165\u662f\u5426\u5b58\u5728\u5b89\u5168\uff0c\u662f\u5426\u5173\u95ed\u5f53\u524d\u4f1a\u8bdd\uff0c\u6e05\u7406\u5386\u53f2\u4f1a\u8bdd\u4fe1\u606f<br>true\uff1a\u662f\uff0c\u8868\u793a\u7528\u6237\u8f93\u5165\u5b58\u5728\u5b89\u5168\u98ce\u9669\uff0c\u5efa\u8bae\u5173\u95ed\u5f53\u524d\u4f1a\u8bdd\uff0c\u6e05\u7406\u5386\u53f2\u4f1a\u8bdd\u4fe1\u606f<br>false\uff1a\u5426\uff0c\u8868\u793a\u7528\u6237\u8f93\u5165\u65e0\u5b89\u5168\u98ce\u9669<\/td><\/tr><tr><td>ban_round<\/td><td>int<\/td><td>\u5f53need_clear_history\u4e3atrue\u65f6\uff0c\u6b64\u5b57\u6bb5\u4f1a\u544a\u77e5\u7b2c\u51e0\u8f6e\u5bf9\u8bdd\u6709\u654f\u611f\u4fe1\u606f\uff0c\u5982\u679c\u662f\u5f53\u524d\u95ee\u9898\uff0cban_round=-1<\/td><\/tr><tr><td>usage<\/td><td>usage<\/td><td>token\u7edf\u8ba1\u4fe1\u606f\uff0ctoken\u6570 = \u6c49\u5b57\u6570+\u5355\u8bcd\u6570*1.3 \uff08\u4ec5\u4e3a\u4f30\u7b97\u903b\u8f91\uff09<\/td><\/tr><tr><td>function_call<\/td><td>function_call<\/td><td>\u7531\u6a21\u578b\u751f\u6210\u7684\u51fd\u6570\u8c03\u7528\uff0c\u5305\u542b\u51fd\u6570\u540d\u79f0\uff0c\u548c\u8c03\u7528\u53c2\u6570<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>usage\u8bf4\u660e<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>prompt_tokens<\/td><td>int<\/td><td>\u95ee\u9898tokens\u6570<\/td><\/tr><tr><td>completion_tokens<\/td><td>int<\/td><td>\u56de\u7b54tokens\u6570<\/td><\/tr><tr><td>total_tokens<\/td><td>int<\/td><td>tokens\u603b\u6570<\/td><\/tr><tr><td>plugins<\/td><td>List(plugin_usage)<\/td><td>plugin\u6d88\u8017\u7684tokens<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>plugin_usage\u8bf4\u660e<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>name<\/td><td>string<\/td><td>plugin\u540d\u79f0\uff0cchatFile\uff1achatfile\u63d2\u4ef6\u6d88\u8017\u7684tokens<\/td><\/tr><tr><td>parse_tokens<\/td><td>int<\/td><td>\u89e3\u6790\u6587\u6863tokens<\/td><\/tr><tr><td>abstract_tokens<\/td><td>int<\/td><td>\u6458\u8981\u6587\u6863tokens<\/td><\/tr><tr><td>search_tokens<\/td><td>int<\/td><td>\u68c0\u7d22\u6587\u6863tokens<\/td><\/tr><tr><td>total_tokens<\/td><td>int<\/td><td>\u603btokens<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>function_call\u8bf4\u660e<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u7c7b\u578b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>name<\/td><td>string<\/td><td>\u89e6\u53d1\u7684function\u540d<\/td><\/tr><tr><td>thoughts<\/td><td>string<\/td><td>\u6a21\u578b\u601d\u8003\u8fc7\u7a0b<\/td><\/tr><tr><td>arguments<\/td><td>string<\/td><td>\u8bf7\u6c42\u53c2\u6570<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>\u6ce8\u610f<\/strong>&nbsp;\uff1a\u540c\u6b65\u6a21\u5f0f\u548c\u6d41\u5f0f\u6a21\u5f0f\uff0c\u54cd\u5e94\u53c2\u6570\u8fd4\u56de\u4e0d\u540c\uff0c\u8be6\u7ec6\u5185\u5bb9\u53c2\u8003\u793a\u4f8b\u63cf\u8ff0\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u540c\u6b65\u6a21\u5f0f\u4e0b\uff0c\u54cd\u5e94\u53c2\u6570\u4e3a\u4ee5\u4e0a\u5b57\u6bb5\u7684\u5b8c\u6574json\u5305\u3002<\/li>\n\n\n\n<li>\u6d41\u5f0f\u6a21\u5f0f\u4e0b\uff0c\u5404\u5b57\u6bb5\u7684\u54cd\u5e94\u53c2\u6570\u4e3a data: {\u54cd\u5e94\u53c2\u6570}\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u793a\u4f8b<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u8bf7\u6c42\u793a\u4f8b\uff08\u5355\u8f6e\uff09<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\n```bash label=bash\n\n# \u6b65\u9aa4\u4e00\uff0c\u83b7\u53d6access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684API Key\u4e0eSecret Key\ncurl 'https:\/\/aip.baidubce.com\/oauth\/2.0\/token?grant_type=client_credentials&amp;client_id=&#91;API Key]&amp;client_secret=&#91;Secret Key]'\n\n# \u6b65\u9aa4\u4e8c\uff0c\u8c03\u7528\u672c\u6587API\uff0c\u4f7f\u7528\u6b65\u9aa4\u4e00\u83b7\u53d6\u7684access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684\u201d\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token\u201c\ncurl -X POST 'https:\/\/aip.baidubce.com\/rpc\/2.0\/ai_custom\/v1\/wenxinworkshop\/chat\/completions_pro?access_token=&#91;\u6b65\u9aa4\u4e00\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token]' -d '{\n   \"messages\": &#91;\n    {\"role\":\"user\",\"content\":\"\u4ecb\u7ecd\u4e00\u4e0b\u4f60\u81ea\u5df1\"}\n   ]\n}' | iconv -f utf-8 -t utf-8\n```\n\n```Python label=Python\nimport requests\nimport json\n\ndef get_access_token():\n    \"\"\"\n    \u4f7f\u7528 API Key\uff0cSecret Key \u83b7\u53d6access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684\u5e94\u7528API Key\u3001\u5e94\u7528Secret Key\n    \"\"\"\n        \n    url = \"https:\/\/aip.baidubce.com\/oauth\/2.0\/token?grant_type=client_credentials&amp;client_id=&#91;\u5e94\u7528API Key]&amp;client_secret=&#91;\u5e94\u7528Secret Key]\"\n    \n    payload = json.dumps(\"\")\n    headers = {\n        'Content-Type': 'application\/json',\n        'Accept': 'application\/json'\n    }\n    \n    response = requests.request(\"POST\", url, headers=headers, data=payload)\n    return response.json().get(\"access_token\")\n\ndef main():\n    url = \"https:\/\/aip.baidubce.com\/rpc\/2.0\/ai_custom\/v1\/wenxinworkshop\/chat\/completions_pro?access_token=\" + get_access_token()\n    \n    payload = json.dumps({\n        \"messages\": &#91;\n            {\n                \"role\": \"user\",\n                \"content\": \"\u4ecb\u7ecd\u4e00\u4e0b\u4f60\u81ea\u5df1\"\n            }\n        ]\n    })\n    headers = {\n        'Content-Type': 'application\/json'\n    }\n    \n    response = requests.request(\"POST\", url, headers=headers, data=payload)\n    \n    print(response.text)\n    \n\nif __name__ == '__main__':\n    main()\n\n```\n\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u54cd\u5e94\u793a\u4f8b\uff08\u5355\u8f6e\uff09<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>```JSON label=JSON\nHTTP\/1.1 200 OK\nDate: Thu, 23 Mar 2023 03:12:03 GMT\nContent-Type: application\/json;charset=utf-8\nStatement: AI-generated\n\n{\n  \"id\": \"as-bcmt5ct4iy\",\n  \"object\": \"chat.completion\",\n  \"created\": 1680167072,\n  \"result\": \"\u60a8\u597d\uff0c\u6211\u662f\u767e\u5ea6\u7814\u53d1\u7684\u77e5\u8bc6\u589e\u5f3a\u5927\u8bed\u8a00\u6a21\u578b\uff0c\u4e2d\u6587\u540d\u662f\u6587\u5fc3\u4e00\u8a00\uff0c\u6211\u80fd\u591f\u4e0e\u4eba\u5bf9\u8bdd\u4e92\u52a8\uff0c\u56de\u7b54\u95ee\u9898\uff0c\u534f\u52a9\u521b\u4f5c\uff0c\u9ad8\u6548\u4fbf\u6377\u5730\u5e2e\u52a9\u4eba\u4eec\u83b7\u53d6\u4fe1\u606f\u3001\u77e5\u8bc6\u548c\u7075\u611f\u3002\",\n  \"is_truncated\":false,\n  \"need_clear_history\": false,\n  \"usage\": {\n    \"prompt_tokens\": 7,\n    \"completion_tokens\": 67,\n    \"total_tokens\": 74\n  }\n}\n```\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u8bf7\u6c42\u793a\u4f8b\uff08\u591a\u8f6e\uff09<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\n```bash label=bash\n# \u6b65\u9aa4\u4e00\uff0c\u83b7\u53d6access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684API Key\u4e0eSecret Key\ncurl 'https:\/\/aip.baidubce.com\/oauth\/2.0\/token?grant_type=client_credentials&amp;client_id=&#91;API Key]&amp;client_secret=&#91;Secret Key]'\n\n# \u6b65\u9aa4\u4e8c\uff0c\u8c03\u7528\u672c\u6587API\uff0c\u4f7f\u7528\u6b65\u9aa4\u4e00\u83b7\u53d6\u7684access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684\u201d\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token\u201c\ncurl -X POST 'https:\/\/aip.baidubce.com\/rpc\/2.0\/ai_custom\/v1\/wenxinworkshop\/chat\/completions_pro?access_token=&#91;\u6b65\u9aa4\u4e00\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token]' -d '{\n  \"messages\": &#91;\n    {\"role\":\"user\",\"content\":\"\u8bf7\u4ecb\u7ecd\u4e00\u4e0b\u4f60\u81ea\u5df1\"},\n    {\"role\":\"assistant\",\"content\":\"\u6211\u662f\u767e\u5ea6\u516c\u53f8\u5f00\u53d1\u7684\u4eba\u5de5\u667a\u80fd\u8bed\u8a00\u6a21\u578b\uff0c\u6211\u7684\u4e2d\u6587\u540d\u662f\u6587\u5fc3\u4e00\u8a00\uff0c\u53ef\u4ee5\u534f\u52a9\u60a8\u5b8c\u6210\u8303\u56f4\u5e7f\u6cdb\u7684\u4efb\u52a1\u5e76\u63d0\u4f9b\u6709\u5173\u5404\u79cd\u4e3b\u9898\u7684\u4fe1\u606f\uff0c\u6bd4\u5982\u56de\u7b54\u95ee\u9898\uff0c\u63d0\u4f9b\u5b9a\u4e49\u548c\u89e3\u91ca\u53ca\u5efa\u8bae\u3002\u5982\u679c\u60a8\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u8bf7\u968f\u65f6\u5411\u6211\u63d0\u95ee\u3002\"},\n    {\"role\":\"user\",\"content\": \"\u6211\u5728\u4e0a\u6d77\uff0c\u5468\u672b\u53ef\u4ee5\u53bb\u54ea\u91cc\u73a9\uff1f\"},\n    {\"role\":\"assistant\",\"content\": \"\u4e0a\u6d77\u662f\u4e00\u4e2a\u5145\u6ee1\u6d3b\u529b\u548c\u6587\u5316\u6c1b\u56f4\u7684\u57ce\u5e02\uff0c\u6709\u5f88\u591a\u9002\u5408\u5468\u672b\u6e38\u73a9\u7684\u5730\u65b9\u3002\u4ee5\u4e0b\u662f\u51e0\u4e2a\u503c\u5f97\u63a8\u8350\u7684\u5730\u65b9\uff1a\\n\\n1. \u4e0a\u6d77\u79d1\u6280\u9986\uff1a\u4e0a\u6d77\u79d1\u6280\u9986\u662f\u4e2d\u56fd\u5927\u9646\u6700\u5927\u7684\u79d1\u6280\u9986\u4e4b\u4e00\uff0c\u6709\u8bb8\u591a\u4e92\u52a8\u5c55\u89c8\u548c\u79d1\u5b66\u5b9e\u9a8c\u5ba4\uff0c\u53ef\u4ee5\u8ba9\u60a8\u4e86\u89e3\u79d1\u6280\u7684\u53d1\u5c55\u5386\u53f2\u548c\u6700\u65b0\u6210\u679c\u3002\\n2. \u4e0a\u6d77\u535a\u7269\u9986\uff1a\u4e0a\u6d77\u535a\u7269\u9986\u662f\u4e00\u5ea7\u96c6\u827a\u672f\u3001\u5386\u53f2\u548c\u6587\u5316\u4e8e\u4e00\u4f53\u7684\u535a\u7269\u9986\uff0c\u6709\u8bb8\u591a\u7cbe\u7f8e\u7684\u827a\u672f\u54c1\u548c\u6587\u7269\uff0c\u53ef\u4ee5\u8ba9\u60a8\u6df1\u5165\u4e86\u89e3\u4e2d\u56fd\u548c\u4e16\u754c\u7684\u6587\u5316\u5386\u53f2\u3002\\n3. \u5916\u6ee9\uff1a\u5916\u6ee9\u662f\u4e0a\u6d77\u7684\u6807\u5fd7\u6027\u666f\u70b9\u4e4b\u4e00\uff0c\u6709\u8bb8\u591a\u9ad8\u697c\u5927\u53a6\u548c\u7e41\u534e\u7684\u5546\u4e1a\u8857\u533a\uff0c\u662f\u6b23\u8d4f\u9ec4\u6d66\u6c5f\u7f8e\u666f\u548c\u57ce\u5e02\u98ce\u8c8c\u7684\u597d\u53bb\u5904\u3002\\n4. \u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed\uff1a\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed\u662f\u4e16\u754c\u4e0a\u6700\u5927\u7684\u8fea\u58eb\u5c3c\u4e3b\u9898\u516c\u56ed\u4e4b\u4e00\uff0c\u6709\u8bb8\u591a\u7cbe\u5f69\u7684\u6e38\u4e50\u9879\u76ee\u548c\u6f14\u51fa\uff0c\u53ef\u4ee5\u8ba9\u60a8\u5c3d\u60c5\u4eab\u53d7\u5a31\u4e50\u548c\u6b22\u4e50\u3002\\n5. \u4e0a\u6d77\u91ce\u751f\u52a8\u7269\u56ed\uff1a\u4e0a\u6d77\u91ce\u751f\u52a8\u7269\u56ed\u662f\u4e00\u4e2a\u4ee5\u81ea\u7136\u4fdd\u62a4\u4e3a\u4e3b\u9898\u7684\u91ce\u751f\u52a8\u7269\u56ed\uff0c\u6709\u8bb8\u591a\u73cd\u7a00\u52a8\u7269\u548c\u690d\u7269\uff0c\u53ef\u4ee5\u8ba9\u60a8\u8fd1\u8ddd\u79bb\u63a5\u89e6\u5927\u81ea\u7136\u3002\\n\\n\u8fd9\u4e9b\u5730\u65b9\u90fd\u662f\u4e0a\u6d77\u5468\u672b\u6e38\u73a9\u7684\u597d\u53bb\u5904\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u5174\u8da3\u548c\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u884c\u7a0b\u3002\"},\n    {\"role\":\"user\",\"content\": \"\u4e0a\u6d77\u6709\u54ea\u4e9b\u7f8e\u98df\uff1f\"}\n  ]\n}'  | iconv -f utf-8 -t utf-8\n```\n\n```Python label=Python\nimport requests\nimport json\n\ndef get_access_token():\n    \"\"\"\n    \u4f7f\u7528 API Key\uff0cSecret Key \u83b7\u53d6access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684\u5e94\u7528API Key\u3001\u5e94\u7528Secret Key\n    \"\"\"\n        \n    url = \"https:\/\/aip.baidubce.com\/oauth\/2.0\/token?grant_type=client_credentials&amp;client_id=&#91;\u5e94\u7528API Key]&amp;client_secret=&#91;\u5e94\u7528Secret Key]\"\n    \n    payload = json.dumps(\"\")\n    headers = {\n        'Content-Type': 'application\/json',\n        'Accept': 'application\/json'\n    }\n    \n    response = requests.request(\"POST\", url, headers=headers, data=payload)\n    return response.json().get(\"access_token\")\n\n\ndef main():\n        \n    url = \"https:\/\/aip.baidubce.com\/rpc\/2.0\/ai_custom\/v1\/wenxinworkshop\/chat\/completions_pro?access_token=\" + get_access_token()\n    \n    payload = json.dumps({\n        \"messages\": &#91;\n            {\n                \"role\": \"user\",\n                \"content\": \"\u8bf7\u4ecb\u7ecd\u4e00\u4e0b\u4f60\u81ea\u5df1\"\n            },\n            {\n                \"role\": \"assistant\",\n                \"content\": \"\u6211\u662f\u767e\u5ea6\u516c\u53f8\u5f00\u53d1\u7684\u4eba\u5de5\u667a\u80fd\u8bed\u8a00\u6a21\u578b\uff0c\u6211\u7684\u4e2d\u6587\u540d\u662f\u6587\u5fc3\u4e00\u8a00\uff0c\u53ef\u4ee5\u534f\u52a9\u60a8\u5b8c\u6210\u8303\u56f4\u5e7f\u6cdb\u7684\u4efb\u52a1\u5e76\u63d0\u4f9b\u6709\u5173\u5404\u79cd\u4e3b\u9898\u7684\u4fe1\u606f\uff0c\u6bd4\u5982\u56de\u7b54\u95ee\u9898\uff0c\u63d0\u4f9b\u5b9a\u4e49\u548c\u89e3\u91ca\u53ca\u5efa\u8bae\u3002\u5982\u679c\u60a8\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u8bf7\u968f\u65f6\u5411\u6211\u63d0\u95ee\u3002\"\n            },\n            {\n                \"role\": \"user\",\n                \"content\": \"\u6211\u5728\u4e0a\u6d77\uff0c\u5468\u672b\u53ef\u4ee5\u53bb\u54ea\u91cc\u73a9\uff1f\"\n            },\n            {\n                \"role\": \"assistant\",\n                \"content\": \"\u4e0a\u6d77\u662f\u4e00\u4e2a\u5145\u6ee1\u6d3b\u529b\u548c\u6587\u5316\u6c1b\u56f4\u7684\u57ce\u5e02\uff0c\u6709\u5f88\u591a\u9002\u5408\u5468\u672b\u6e38\u73a9\u7684\u5730\u65b9\u3002\u4ee5\u4e0b\u662f\u51e0\u4e2a\u503c\u5f97\u63a8\u8350\u7684\u5730\u65b9\uff1a\\n\\n1. \u4e0a\u6d77\u79d1\u6280\u9986\uff1a\u4e0a\u6d77\u79d1\u6280\u9986\u662f\u4e2d\u56fd\u5927\u9646\u6700\u5927\u7684\u79d1\u6280\u9986\u4e4b\u4e00\uff0c\u6709\u8bb8\u591a\u4e92\u52a8\u5c55\u89c8\u548c\u79d1\u5b66\u5b9e\u9a8c\u5ba4\uff0c\u53ef\u4ee5\u8ba9\u60a8\u4e86\u89e3\u79d1\u6280\u7684\u53d1\u5c55\u5386\u53f2\u548c\u6700\u65b0\u6210\u679c\u3002\\n2. \u4e0a\u6d77\u535a\u7269\u9986\uff1a\u4e0a\u6d77\u535a\u7269\u9986\u662f\u4e00\u5ea7\u96c6\u827a\u672f\u3001\u5386\u53f2\u548c\u6587\u5316\u4e8e\u4e00\u4f53\u7684\u535a\u7269\u9986\uff0c\u6709\u8bb8\u591a\u7cbe\u7f8e\u7684\u827a\u672f\u54c1\u548c\u6587\u7269\uff0c\u53ef\u4ee5\u8ba9\u60a8\u6df1\u5165\u4e86\u89e3\u4e2d\u56fd\u548c\u4e16\u754c\u7684\u6587\u5316\u5386\u53f2\u3002\\n3. \u5916\u6ee9\uff1a\u5916\u6ee9\u662f\u4e0a\u6d77\u7684\u6807\u5fd7\u6027\u666f\u70b9\u4e4b\u4e00\uff0c\u6709\u8bb8\u591a\u9ad8\u697c\u5927\u53a6\u548c\u7e41\u534e\u7684\u5546\u4e1a\u8857\u533a\uff0c\u662f\u6b23\u8d4f\u9ec4\u6d66\u6c5f\u7f8e\u666f\u548c\u57ce\u5e02\u98ce\u8c8c\u7684\u597d\u53bb\u5904\u3002\\n4. \u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed\uff1a\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed\u662f\u4e16\u754c\u4e0a\u6700\u5927\u7684\u8fea\u58eb\u5c3c\u4e3b\u9898\u516c\u56ed\u4e4b\u4e00\uff0c\u6709\u8bb8\u591a\u7cbe\u5f69\u7684\u6e38\u4e50\u9879\u76ee\u548c\u6f14\u51fa\uff0c\u53ef\u4ee5\u8ba9\u60a8\u5c3d\u60c5\u4eab\u53d7\u5a31\u4e50\u548c\u6b22\u4e50\u3002\\n5. \u4e0a\u6d77\u91ce\u751f\u52a8\u7269\u56ed\uff1a\u4e0a\u6d77\u91ce\u751f\u52a8\u7269\u56ed\u662f\u4e00\u4e2a\u4ee5\u81ea\u7136\u4fdd\u62a4\u4e3a\u4e3b\u9898\u7684\u91ce\u751f\u52a8\u7269\u56ed\uff0c\u6709\u8bb8\u591a\u73cd\u7a00\u52a8\u7269\u548c\u690d\u7269\uff0c\u53ef\u4ee5\u8ba9\u60a8\u8fd1\u8ddd\u79bb\u63a5\u89e6\u5927\u81ea\u7136\u3002\\n\\n\u8fd9\u4e9b\u5730\u65b9\u90fd\u662f\u4e0a\u6d77\u5468\u672b\u6e38\u73a9\u7684\u597d\u53bb\u5904\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u5174\u8da3\u548c\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u884c\u7a0b\u3002\"\n            },\n            {\n                \"role\": \"user\",\n                \"content\": \"\u4e0a\u6d77\u6709\u54ea\u4e9b\u7f8e\u98df\uff1f\"\n            }\n        ]\n    })\n    headers = {\n        'Content-Type': 'application\/json'\n    }\n    \n    response = requests.request(\"POST\", url, headers=headers, data=payload)\n    \n    print(response.text)\n    \n\nif __name__ == '__main__':\n    main()\n\n\n```\n\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u54cd\u5e94\u793a\u4f8b\uff08\u591a\u8f6e\uff09<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>```JSON label=JSON\nHTTP\/1.1 200 OK\nDate: Mon, 12 Apr 2021 06:27:55 GMT\nContent-Type: application\/json;charset=utf-8\nStatement: AI-generated\n\n{\n  \"id\": \"as-1tbbc0x5af\",\n  \"object\": \"chat.completion\",\n  \"created\": 1680166551,\n  \"result\": \"2023\u5e744\u67082\u65e5\u4e0a\u6d77\u6c14\u6e2913~21\u2103\uff0c\u591a\u4e91\u8f6c\u9634\uff0c\u4e1c\u98ce3-4\u7ea7\uff0c\u7a7a\u6c14\u8d28\u91cf\u826f\uff0c\u7a7a\u6c14\u8d28\u91cf\u6307\u657055\u3002\\n\\n\\n\\n\u8fd17\u65e5\u5929\u6c14\u4fe1\u606f\uff1a\\n\\n2023-03-29\uff1a\u9634\u8f6c\u5c0f\u96e8\uff0c11~17\u2103\uff0c\u4e1c\u5317\u98ce&lt;3\u7ea7\uff0c\u7a7a\u6c14\u8d28\u91cf\u826f\u3002\\n\\n2023-03-30\uff1a\u5c0f\u96e8\u8f6c\u9634\uff0c10~14\u2103\uff0c\u4e1c\u98ce3-4\u7ea7\uff0c\u7a7a\u6c14\u8d28\u91cf\u826f\u3002\\n\\n2023-03-31\uff1a\u591a\u4e91\uff0c12~18\u2103\uff0c\u4e1c\u98ce3-4\u7ea7\uff0c\u7a7a\u6c14\u8d28\u91cf\u4f18\u3002\\n\\n2023-04-01\uff1a\u591a\u4e91\u8f6c\u6674\uff0c11~20\u2103\uff0c\u4e1c\u5357\u98ce3-4\u7ea7\uff0c\u7a7a\u6c14\u8d28\u91cf\u826f\u3002\\n\\n2023-04-02\uff1a\u591a\u4e91\u8f6c\u9634\uff0c13~21\u2103\uff0c\u4e1c\u98ce3-4\u7ea7\uff0c\u7a7a\u6c14\u8d28\u91cf\u826f\u3002\\n\\n2023-04-03\uff1a\u9634\u8f6c\u4e2d\u96e8\uff0c15~18\u2103\uff0c\u4e1c\u5357\u98ce4-5\u7ea7\uff0c\u7a7a\u6c14\u8d28\u91cf\u826f\u3002\\n\\n2023-04-04\uff1a\u4e2d\u96e8\u8f6c\u5c0f\u96e8\uff0c10~17\u2103\uff0c\u5357\u98ce5-6\u7ea7\uff0c\u7a7a\u6c14\u8d28\u91cf\u4f18\u3002\\n\\n2023-04-05\uff1a\u9634\uff0c9~14\u2103\uff0c\u897f\u5317\u98ce3-4\u7ea7\uff0c\u7a7a\u6c14\u8d28\u91cf\u4f18\u3002\",\n  \"is_truncated\":false,\n  \"need_clear_history\": false,\n  \"usage\": {\n    \"prompt_tokens\": 470,\n    \"completion_tokens\": 198,\n    \"total_tokens\": 668\n  }\n}\n```\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u8bf7\u6c42\u793a\u4f8b\uff08\u6d41\u5f0f\uff09<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\n```bash label=bash\n# \u6b65\u9aa4\u4e00\uff0c\u83b7\u53d6access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684API Key\u4e0eSecret Key\ncurl 'https:\/\/aip.baidubce.com\/oauth\/2.0\/token?grant_type=client_credentials&amp;client_id=&#91;API Key]&amp;client_secret=&#91;Secret Key]'\n\n# \u6b65\u9aa4\u4e8c\uff0c\u8c03\u7528\u672c\u6587API\uff0c\u4f7f\u7528\u6b65\u9aa4\u4e00\u83b7\u53d6\u7684access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684\u201d\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token\u201c\ncurl -X POST 'https:\/\/aip.baidubce.com\/rpc\/2.0\/ai_custom\/v1\/wenxinworkshop\/chat\/completions_pro?access_token=&#91;\u6b65\u9aa4\u4e00\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token]' -d '{\n  \"messages\": &#91;\n    {\"role\":\"user\", \"content\": \"\u7ed9\u6211\u63a8\u8350\u4e00\u4e9b\u81ea\u9a7e\u6e38\u8def\u7ebf\"}\n  ],\n  \"stream\": true\n}'\n```\n\n```bash label=Python\nimport requests\nimport json\n\ndef get_access_token():\n    \"\"\"\n    \u4f7f\u7528 API Key\uff0cSecret Key \u83b7\u53d6access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684\u5e94\u7528API Key\u3001\u5e94\u7528Secret Key\n    \"\"\"\n        \n    url = \"https:\/\/aip.baidubce.com\/oauth\/2.0\/token?grant_type=client_credentials&amp;client_id=&#91;\u5e94\u7528API Key]&amp;client_secret=&#91;\u5e94\u7528Secret Key]\"\n    \n    payload = json.dumps(\"\")\n    headers = {\n        'Content-Type': 'application\/json',\n        'Accept': 'application\/json'\n    }\n    \n    response = requests.request(\"POST\", url, headers=headers, data=payload)\n    return response.json().get(\"access_token\")\n\n\ndef main():\n        \n    url = \"https:\/\/aip.baidubce.com\/rpc\/2.0\/ai_custom\/v1\/wenxinworkshop\/chat\/completions_pro?access_token=\" + get_access_token()\n    \n    payload = json.dumps({\n        \"messages\": &#91;\n            {\n                \"role\": \"user\",\n                \"content\": \"\u7ed9\u6211\u63a8\u8350\u4e00\u4e9b\u81ea\u9a7e\u6e38\u8def\u7ebf\"\n            }\n        ],\n         \"stream\": True\n    })\n    headers = {\n        'Content-Type': 'application\/json'\n    }\n    \n    response = requests.request(\"POST\", url, headers=headers, data=payload, stream=True)\n    \n    for line in response.iter_lines():\n        print(line)\n    \n\nif __name__ == '__main__':\n    main()\n\n```\n\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u54cd\u5e94\u793a\u4f8b\uff08\u6d41\u5f0f\uff09<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP\/1.1 200 OK\nDate: Mon, 12 Apr 2021 06:27:55 GMT\nContent-Type: text\/event-stream;charset=utf-8\nCache-Control: no-cache\nStatement: AI-generated\n\ndata: {\"id\":\"as-ywwpgx4dt7\",\"object\":\"chat.completion\",\"created\":1680166793,\"sentence_id\":0,\"is_end\":false,is_truncated\":false,\"result\":\"\u4ee5\u4e0b\u662f\u4e00\u4e9b\u9002\u5408\u81ea\u9a7e\u6e38\u7684\u8def\u7ebf\u63a8\u8350\uff1a\\n\\n1.\",\"need_clear_history\":false,\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":16,\"total_tokens\":27}}\n\ndata: {\"id\":\"as-ywwpgx4dt7\",\"object\":\"chat.completion\",\"created\":1680166794,\"sentence_id\":1,\"is_end\":false,is_truncated\":false,\"result\":\" \u4e2d\u56fd\u5927\u9646\u6700\u7f8e\u7684\u666f\u89c2\u5927\u9053\uff1a\u5ddd\u85cf\u7ebf\uff0c\u4ece\u6210\u90fd\u51fa\u53d1\uff0c\u6cbf\u7740\u5ddd\u85cf\u516c\u8def\u4e00\u8def\u5411\u897f\uff0c\u7ecf\u8fc7\u7a3b\u57ce\u4e9a\u4e01\u3001\u7406\u5858\u3001\u5df4\u5858\u3001\u8292\u5eb7\u7b49\u7f8e\u666f\uff0c\u6700\u7ec8\u5230\u8fbe\u62c9\u8428\u3002\",\"need_clear_history\":false,\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":50,\"total_tokens\":77}}\n\ndata: {\"id\":\"as-ywwpgx4dt7\",\"object\":\"chat.completion\",\"created\":1680166795,\"sentence_id\":2,\"is_end\":false,\"is_truncated\":false,\"result\":\"\\n2. \u4e1d\u7ef8\u4e4b\u8def\uff1a\u8fd9\u662f\u4e00\u6761\u8d2f\u7a7f\u4e2d\u56fd\u4e1c\u897f\u90e8\u7684\u516c\u8def\uff0c\u4ece\u4e0a\u6d77\u51fa\u53d1\uff0c\u7ecf\u8fc7\u897f\u5b89\u3001\u5170\u5dde\u3001\u4e4c\u9c81\u6728\u9f50\u7b49\u57ce\u5e02\uff0c\u6700\u7ec8\u5230\u8fbe\u5580\u4ec0\u3002\",\"need_clear_history\":false,\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":43,\"total_tokens\":120}}\n\ndata: {\"id\":\"as-ywwpgx4dt7\",\"object\":\"chat.completion\",\"created\":1680166796,\"sentence_id\":3,\"is_end\":false,\"is_truncated\":false,\"result\":\"\u6cbf\u9014\u53ef\u4ee5\u6b23\u8d4f\u5230\u4e2d\u56fd\u5317\u65b9\u548c\u5357\u65b9\u7684\u4e0d\u540c\u666f\u8272\u3002\\n3. \u897f\u5317\u5927\u73af\u7ebf\uff1a\u4ece\u6210\u90fd\u51fa\u53d1\uff0c\u7ecf\u8fc7\u90fd\u6c5f\u5830\u3001\u9752\u57ce\u5c71\u3001\u4e39\u5df4\u3001\u5854\u516c\u8349\u539f\u3001\u65b0\u90fd\u6865\u7b49\u666f\u70b9\uff0c\u6700\u7ec8\u5230\u8fbe\u897f\u5b81\u3002\",\"need_clear_history\":false,\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":56,\"total_tokens\":176}}\n\ndata: {\"id\":\"as-ywwpgx4dt7\",\"object\":\"chat.completion\",\"created\":1680166799,\"sentence_id\":4,\"is_end\":false,\"is_truncated\":false,\"result\":\"\u8fd9\u6761\u8def\u7ebf\u53ef\u4ee5\u9886\u7565\u5230\u4e2d\u56fd\u897f\u5317\u5730\u533a\u7684\u58ee\u7f8e\u98ce\u5149\u3002\\n4. \u4e1c\u5317\u73af\u7ebf\uff1a\u4ece\u6c88\u9633\u51fa\u53d1\uff0c\u7ecf\u8fc7\u957f\u6625\u3001\u5409\u6797\u3001\u5ef6\u5409\u7b49\u57ce\u5e02\uff0c\u6700\u7ec8\u5230\u8fbe\u54c8\u5c14\u6ee8\u3002\",\"need_clear_history\":false,\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":48,\"total_tokens\":224}}\n\ndata: {\"id\":\"as-ywwpgx4dt7\",\"object\":\"chat.completion\",\"created\":1680166800,\"sentence_id\":5,\"is_end\":false,\"is_truncated\":false,\"result\":\"\u6cbf\u9014\u53ef\u4ee5\u6b23\u8d4f\u5230\u4e2d\u56fd\u4e1c\u5317\u5730\u533a\u7684\u5e7f\u9614\u8349\u539f\u548c\u68ee\u6797\u3002\\n5. \u897f\u5357\u73af\u7ebf\uff1a\u4ece\u6210\u90fd\u51fa\u53d1\uff0c\u7ecf\u8fc7\u96c5\u5b89\u3001\u5eb7\u5b9a\u3001\u7406\u5858\u3001\u7a3b\u57ce\u4e9a\u4e01\u7b49\u666f\u70b9\uff0c\u6700\u7ec8\u5230\u8fbe\u9999\u683c\u91cc\u62c9\u3002\",\"need_clear_history\":false,\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":54,\"total_tokens\":278}}\n\ndata: {\"id\":\"as-ywwpgx4dt7\",\"object\":\"chat.completion\",\"created\":1680166802,\"sentence_id\":6,\"is_end\":false,\"is_truncated\":false,\"result\":\"\u8fd9\u6761\u8def\u7ebf\u53ef\u4ee5\u9886\u7565\u5230\u4e2d\u56fd\u897f\u5357\u5730\u533a\u7684\u9ad8\u5c71\u5ce1\u8c37\u548c\u6c11\u65cf\u6587\u5316\u3002\\n6. \u6d77\u5357\u73af\u7ebf\uff1a\u4ece\u4e09\u4e9a\u51fa\u53d1\uff0c\u7ecf\u8fc7\u6d77\u53e3\u3001\u6587\u660c\u3001\u4e07\u5b81\u7b49\u57ce\u5e02\uff0c\u6700\u7ec8\u5230\u8fbe\u4e09\u4e9a\u3002\",\"need_clear_history\":false,\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":52,\"total_tokens\":330}}\n\ndata: {\"id\":\"as-ywwpgx4dt7\",\"object\":\"chat.completion\",\"created\":1680166803,\"sentence_id\":7,\"is_end\":false,\"is_truncated\":false,\"result\":\"\u8fd9\u6761\u8def\u7ebf\u53ef\u4ee5\u6b23\u8d4f\u5230\u4e2d\u56fd\u5357\u65b9\u7684\u6d77\u5cb8\u7ebf\u548c\u70ed\u5e26\u96e8\u6797\u3002\\n7. \u6ec7\u85cf\u7ebf\uff1a\u4ece\u6606\u660e\u51fa\u53d1\uff0c\u7ecf\u8fc7\u5927\u7406\u3001\u4e3d\u6c5f\u3001\u9999\u683c\u91cc\u62c9\u7b49\u666f\u70b9\uff0c\u6700\u7ec8\u5230\u8fbe\u897f\u85cf\u62c9\u8428\u3002\",\"need_clear_history\":false,\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":52,\"total_tokens\":382}}\n\ndata: {\"id\":\"as-ywwpgx4dt7\",\"object\":\"chat.completion\",\"created\":1680166804,\"sentence_id\":8,\"is_end\":true,\"is_truncated\":false,\"result\":\"\u8fd9\u6761\u8def\u7ebf\u53ef\u4ee5\u9886\u7565\u5230\u4e2d\u56fd\u897f\u5357\u5730\u533a\u548c\u897f\u85cf\u5730\u533a\u7684\u81ea\u7136\u98ce\u5149\u548c\u4eba\u6587\u666f\u89c2\u3002\",\"need_clear_history\":false,\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":30,\"total_tokens\":412}}\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">function call\u793a\u4f8b<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">\u7b2c\u4e00\u8f6e\u8bf7\u6c42<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\n```bash label=bash\n\n# \u6b65\u9aa4\u4e00\uff0c\u83b7\u53d6access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684API Key\u4e0eSecret Key\ncurl 'https:\/\/aip.baidubce.com\/oauth\/2.0\/token?grant_type=client_credentials&amp;client_id=&#91;API Key]&amp;client_secret=&#91;Secret Key]'\n\n# \u6b65\u9aa4\u4e8c\uff0c\u8c03\u7528\u672c\u6587API\uff0c\u4f7f\u7528\u6b65\u9aa4\u4e00\u83b7\u53d6\u7684access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684\u201d\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token\u201c\n\ncurl -X POST 'https:\/\/aip.baidubce.com\/rpc\/2.0\/ai_custom\/v1\/wenxinworkshop\/chat\/completions_pro?access_token=&#91;\u6b65\u9aa4\u4e00\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token]' -d '{\n        \"messages\": &#91;\n      {\"role\":\"user\",\"content\":\"\u4e0a\u6d77\u5e02\u4eca\u5929\u7684\u5929\u6c14\"}\n    ],\n   \"functions\": &#91;\n        {\n            \"name\": \"get_current_weather\",\n            \"description\": \"\u83b7\u5f97\u6307\u5b9a\u5730\u70b9\u7684\u5929\u6c14\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                \"location\": {\n                    \"type\": \"string\",\n                    \"description\": \"\u7701\uff0c\u5e02\u540d\uff0c\u4f8b\u5982\uff1a\u6cb3\u5317\u7701\uff0c\u77f3\u5bb6\u5e84\"\n                },\n                \"unit\": {\n                    \"type\": \"string\",\n                    \"enum\": &#91;\"\u6444\u6c0f\u5ea6\", \"\u534e\u6c0f\u5ea6\"]\n                }\n                },\n                \"required\": &#91;\"location\"]\n            }\n    },\n        {\n            \"name\": \"get_current_price\",\n            \"description\": \"\u83b7\u5f97\u6307\u5b9a\u516c\u53f8\u7684\u80a1\u4ef7\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                \"company\": {\n                    \"type\": \"string\",\n                    \"description\": \"\u516c\u53f8\u540d\uff0c\u4f8b\u5982\uff1a\u817e\u8baf\uff0c\u963f\u91cc\u5df4\u5df4\"\n                },\n                \"exchange\": {\n                    \"type\": \"string\",\n                    \"enum\": &#91;\"\u7eb3\u65af\u8fbe\u514b\", \"\u4e0a\u6d77\u8bc1\u5238\u4ea4\u6613\u6240\",\"\u9999\u6e2f\u8bc1\u5238\u4ea4\u6613\u6240\"]\n                }\n                },\n                \"required\": &#91;\"company\", \"exchange\"]\n            },\n            \"responses\": {\n                \"type\": \"object\",\n                \"properties\": {\n                \"price\": {\n                    \"type\": \"int\",\n                    \"description\": \"\u5f53\u65e5\u80a1\u7968\u4ef7\u683c\"\n                },\n                \"unit\": {\n                    \"type\": \"string\",\n                    \"enum\": &#91;\"\u4eba\u6c11\u5e01\", \"\u7f8e\u5143\",\"\u6e2f\u5e01\"],\n                    \"description\": \"\u80a1\u7968\u4ef7\u683c\u8d27\u5e01\u7c7b\u578b\"\n                },\n                \"change\": {\n                    \"type\": \"string\",\n                    \"description\": \"\u5f53\u65e5\u80a1\u7968\u4ef7\u683c\u53d8\u5316,\u5982\u4e0b\u8dcc3%\uff0c\u4e0a\u6da80.5%\"\n                }\n                }\n            },\n    \"examples\": &#91;\n      {\"role\":\"user\",\"content\":\"What is the weather like in Boston?\"},\n      {\"role\": \"assistant\", \"content\": null, \"function_call\": {\"name\": \"get_current_weather\", \"arguments\": \"{ \\\"location\\\": \\\"Boston\\\"}\"}},\n      {\"role\": \"function\", \"name\": \"get_current_weather\", \"content\": \"{\\\"temperature\\\": \\\"25\\\", \\\"unit\\\": \\\"centigrade\\\", \\\"description\\\": \\\"cloud\\\"}\"}\n    ]\n        }\n    ],\n    \"stream\":true\n}' | iconv -f utf-8 -t utf-8\n```\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u7b2c\u4e00\u8f6e\u54cd\u5e94<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP\/1.1 200 OK\nDate: Mon, 12 Apr 2021 06:27:55 GMT\nContent-Type: text\/event-stream;charset=utf-8\nCache-Control: no-cache\nStatement: AI-generated\n\ndata: {\"id\":\"as-rtpw9dcmef\",\"object\":\"chat.completion\",\"created\":1693449832,\"sentence_id\":0,\"is_end\":true,\"is_truncated\":false,\"result\":\"\",\"need_clear_history\":false,\"function_call\":{\"name\":\"get_current_weather\",\"thoughts\":\"\u7528\u6237\u63d0\u5230\u4e86\u5929\u6c14\uff0c\u9700\u8981\u8c03\u7528API\u6765\u83b7\u53d6\u5929\u6c14\u4fe1\u606f\u3002\",\"arguments\":\"{\\\"unit\\\":\\\"\u6444\u6c0f\u5ea6\\\",\\\"location\\\":\\\"\u4e0a\u6d77\u5e02\\\"}\"},\"is_safe\":0,\"usage\":{\"prompt_tokens\":8,\"completion_tokens\":46,\"total_tokens\":54}}\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u51fd\u6570\u8c03\u7528<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\n```bash label=bash\ncurl -X POST 'http:\/\/0.0.0.0:80\/get_current_weather' -d '{\n   \"unit\": \"\u6444\u6c0f\u5ea6\",\n   \"location\": \"\u4e0a\u6d77\u5e02\"\n}' | iconv -f utf-8 -t utf-8\n```\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u51fd\u6570\u54cd\u5e94<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP\/1.1 200 OK\n\n{\n    \"temperature\": \"25\", \n    \"unit\": \"\u6444\u6c0f\u5ea6\", \n    \"description\": \"\u6674\u6717\"\n}\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u7b2c\u4e8c\u8f6e\u8bf7\u6c42<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\n```bash label=bash\n\n# \u6b65\u9aa4\u4e00\uff0c\u83b7\u53d6access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684API Key\u4e0eSecret Key\ncurl 'https:\/\/aip.baidubce.com\/oauth\/2.0\/token?grant_type=client_credentials&amp;client_id=&#91;API Key]&amp;client_secret=&#91;Secret Key]'\n\n# \u6b65\u9aa4\u4e8c\uff0c\u8c03\u7528\u672c\u6587API\uff0c\u4f7f\u7528\u6b65\u9aa4\u4e00\u83b7\u53d6\u7684access_token\uff0c\u66ff\u6362\u4e0b\u5217\u793a\u4f8b\u4e2d\u7684\u201d\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token\u201c\n\ncurl -X POST 'https:\/\/aip.baidubce.com\/rpc\/2.0\/ai_custom\/v1\/wenxinworkshop\/chat\/completions_pro?access_token=&#91;\u6b65\u9aa4\u4e00\u8c03\u7528\u63a5\u53e3\u83b7\u53d6\u7684access_token]' -d '{\n    \"messages\": &#91;\n      {\"role\":\"user\",\"content\":\"\u4e0a\u6d77\u5e02\u4eca\u5929\u5929\u6c14\u5982\u4f55\uff1f\"},\n      {\"role\": \"assistant\", \"content\": null, \"function_call\": {\"name\": \"get_current_weather\", \"arguments\": \"{ \\\"location\\\": \\\"\u4e0a\u6d77\u5e02\\\"}\"}},\n      {\"role\": \"function\", \"name\": \"get_current_weather\", \"content\": \"{\\\"temperature\\\": \\\"25\\\", \\\"unit\\\": \\\"\u6444\u6c0f\u5ea6\\\", \\\"description\\\": \\\"\u6674\u6717\\\"}\"}],\n   \"functions\": &#91;\n        {\n            \"name\": \"get_current_weather\",\n            \"description\": \"\u83b7\u5f97\u6307\u5b9a\u5730\u70b9\u7684\u5929\u6c14\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                \"location\": {\n                    \"type\": \"string\",\n                    \"description\": \"\u7701\uff0c\u5e02\u540d\uff0c\u4f8b\u5982\uff1a\u6cb3\u5317\u7701\uff0c\u77f3\u5bb6\u5e84\"\n                },\n                \"unit\": {\n                    \"type\": \"string\",\n                    \"enum\": &#91;\"\u6444\u6c0f\u5ea6\", \"\u534e\u6c0f\u5ea6\"]\n                }\n                },\n                \"required\": &#91;\"location\"]\n            }\n\t},\n        {\n            \"name\": \"get_current_price\",\n            \"description\": \"\u83b7\u5f97\u6307\u5b9a\u516c\u53f8\u7684\u80a1\u4ef7\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                \"company\": {\n                    \"type\": \"string\",\n                    \"description\": \"\u516c\u53f8\u540d\uff0c\u4f8b\u5982\uff1a\u817e\u8baf\uff0c\u963f\u91cc\u5df4\u5df4\"\n                },\n                \"exchange\": {\n                    \"type\": \"string\",\n                    \"enum\": &#91;\"\u7eb3\u65af\u8fbe\u514b\", \"\u4e0a\u6d77\u8bc1\u5238\u4ea4\u6613\u6240\",\"\u9999\u6e2f\u8bc1\u5238\u4ea4\u6613\u6240\"]\n                }\n                },\n                \"required\": &#91;\"company\", \"exchange\"]\n            },\n            \"responses\": {\n                \"type\": \"object\",\n                \"properties\": {\n                \"price\": {\n                    \"type\": \"int\",\n                    \"description\": \"\u5f53\u65e5\u80a1\u7968\u4ef7\u683c\"\n                },\n                \"unit\": {\n                    \"type\": \"string\",\n                    \"enum\": &#91;\"\u4eba\u6c11\u5e01\", \"\u7f8e\u5143\",\"\u6e2f\u5e01\"],\n                    \"description\": \"\u80a1\u7968\u4ef7\u683c\u8d27\u5e01\u7c7b\u578b\"\n                },\n                \"change\": {\n                    \"type\": \"string\",\n                    \"description\": \"\u5f53\u65e5\u80a1\u7968\u4ef7\u683c\u53d8\u5316,\u5982\u4e0b\u8dcc3%\uff0c\u4e0a\u6da80.5%\"\n                }\n                }\n            }\n        }\n    ],\n\"stream\":true\n}' | iconv -f utf-8 -t utf-8\n```\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u7b2c\u4e8c\u8f6e\u54cd\u5e94<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP\/1.1 200 OK\nDate: Mon, 12 Apr 2021 06:27:55 GMT\nContent-Type: text\/event-stream;charset=utf-8\nCache-Control: no-cache\nStatement: AI-generated\n\ndata: {\"id\":\"as-kf6e9thk0f\",\"object\":\"chat.completion\",\"created\":1693450180,\"sentence_id\":0,\"is_end\":false,\"is_truncated\":false,\"result\":\"\u4e0a\u6d77\u5e02\u4eca\u5929\u5929\u6c14\u662f\uff1a\",\"need_clear_history\":false,\"is_safe\":0,\"usage\":{\"prompt_tokens\":26,\"completion_tokens\":8,\"total_tokens\":34}}\n\ndata: {\"id\":\"as-kf6e9thk0f\",\"object\":\"chat.completion\",\"created\":1693450180,\"sentence_id\":1,\"is_end\":false,\"is_truncated\":false,\"result\":\"\u6c14\u6e2925\u6444\u6c0f\u5ea6\uff0c\u6674\u6717\u3002\",\"need_clear_history\":false,\"is_safe\":0,\"usage\":{\"prompt_tokens\":26,\"completion_tokens\":8,\"total_tokens\":42}}\n\ndata: {\"id\":\"as-kf6e9thk0f\",\"object\":\"chat.completion\",\"created\":1693450180,\"sentence_id\":2,\"is_end\":true,\"is_truncated\":false,\"result\":\"\",\"need_clear_history\":false,\"is_safe\":0,\"usage\":{\"prompt_tokens\":26,\"completion_tokens\":0,\"total_tokens\":42}}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u9519\u8bef\u7801<\/h3>\n\n\n\n<p>\u5982\u679c\u8bf7\u6c42\u9519\u8bef\uff0c\u670d\u52a1\u5668\u8fd4\u56de\u7684JSON\u6587\u672c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>error_code<\/td><td>\u9519\u8bef\u7801<\/td><\/tr><tr><td>error_msg<\/td><td>\u9519\u8bef\u63cf\u8ff0\u4fe1\u606f\uff0c\u5e2e\u52a9\u7406\u89e3\u548c\u89e3\u51b3\u53d1\u751f\u7684\u9519\u8bef<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u4f8b\u5982Access Token\u5931\u6548\u8fd4\u56de\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"error_code\": 110,\n  \"error_msg\": \"Access token invalid or no longer valid\"\n}\n<\/code><\/pre>\n\n\n\n<p>\u9700\u8981\u91cd\u65b0\u83b7\u53d6\u65b0\u7684Access Token\u518d\u6b21\u8bf7\u6c42\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u9519\u8bef\u7801<\/th><th>\u9519\u8bef\u4fe1\u606f<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>Unknown error<\/td><td>\u670d\u52a1\u5668\u5185\u90e8\u9519\u8bef\uff0c\u8bf7\u518d\u6b21\u8bf7\u6c42\uff0c\u5982\u679c\u6301\u7eed\u51fa\u73b0\u6b64\u7c7b\u9519\u8bef\uff0c\u8bf7\u5728\u767e\u5ea6\u4e91\u63a7\u5236\u53f0\u5185<a href=\"https:\/\/ticket.bce.baidu.com\/#\/ticket\/create?useticket=1&amp;productId=279\">\u63d0\u4ea4\u5de5\u5355<\/a>\u53cd\u9988<\/td><\/tr><tr><td>2<\/td><td>Service temporarily unavailable<\/td><td>\u670d\u52a1\u6682\u4e0d\u53ef\u7528\uff0c\u8bf7\u518d\u6b21\u8bf7\u6c42\uff0c\u5982\u679c\u6301\u7eed\u51fa\u73b0\u6b64\u7c7b\u9519\u8bef\uff0c\u8bf7\u5728\u767e\u5ea6\u4e91\u63a7\u5236\u53f0\u5185<a href=\"https:\/\/ticket.bce.baidu.com\/#\/ticket\/create?useticket=1&amp;productId=279&amp;questionId=1549\">\u63d0\u4ea4\u5de5\u5355<\/a>\u53cd\u9988<\/td><\/tr><tr><td>3<\/td><td>Unsupported openapi method<\/td><td>\u8c03\u7528\u7684API\u4e0d\u5b58\u5728\uff0c\u8bf7\u68c0\u67e5\u8bf7\u6c42URL\u540e\u91cd\u65b0\u5c1d\u8bd5\uff0c\u4e00\u822c\u4e3aURL\u4e2d\u6709\u975e\u82f1\u6587\u5b57\u7b26\uff0c\u5982&#8221;-&#8220;\uff0c\u53ef\u624b\u52a8\u8f93\u5165\u91cd\u8bd5<\/td><\/tr><tr><td>4<\/td><td>Open api request limit reached<\/td><td>\u96c6\u7fa4\u8d85\u9650\u989d\uff0c\u8bf7\u518d\u6b21\u8bf7\u6c42\uff0c\u5982\u679c\u6301\u7eed\u51fa\u73b0\u6b64\u7c7b\u9519\u8bef\uff0c\u8bf7\u5728\u767e\u5ea6\u4e91\u63a7\u5236\u53f0\u5185<a href=\"https:\/\/ticket.bce.baidu.com\/#\/ticket\/create?useticket=1&amp;productId=279&amp;questionId=1549\">\u63d0\u4ea4\u5de5\u5355<\/a>\u53cd\u9988<\/td><\/tr><tr><td>6<\/td><td>No permission to access data<\/td><td>\u65e0\u63a5\u53e3\u8c03\u7528\u6743\u9650\uff0c\u521b\u5efa\u5e94\u7528\u65f6\u672a\u52fe\u9009\u76f8\u5173\u5343\u5e06\u63a5\u53e3\uff0c\u8bf7\u767b\u5f55\u767e\u5ea6\u4e91\u63a7\u5236\u53f0\uff0c\u627e\u5230\u5bf9\u5e94\u7684\u5e94\u7528\uff0c\u7f16\u8f91\u5e94\u7528\uff0c\u52fe\u9009\u4e0a\u76f8\u5173\u63a5\u53e3\u540e\u91cd\u65b0\u8c03\u7528\uff0c\u4e5f\u53ef\u4f7f\u7528<a href=\"https:\/\/console.bce.baidu.com\/tools\/#\/aiInterfacePermissions\">\u6743\u9650\u989d\u5ea6\u8bca\u65ad\u5de5\u5177<\/a>\u5b8c\u6210\u81ea\u52a9\u8bca\u65ad<\/td><\/tr><tr><td>13<\/td><td>Get service token failed<\/td><td>\u83b7\u53d6token\u5931\u8d25<\/td><\/tr><tr><td>14<\/td><td>IAM Certification failed<\/td><td>IAM\u9274\u6743\u5931\u8d25\uff0c\u5efa\u8bae\u7528\u6237\u53c2\u7167\u6587\u6863\u81ea\u67e5\u751f\u6210sign\u7684\u65b9\u5f0f\u662f\u5426\u6b63\u786e\uff0c\u6216\u6362\u7528\u63a7\u5236\u53f0\u4e2dak sk\u7684\u65b9\u5f0f\u8c03\u7528<\/td><\/tr><tr><td>15<\/td><td>app not exists or create failed<\/td><td>\u5e94\u7528\u4e0d\u5b58\u5728\u6216\u8005\u521b\u5efa\u5931\u8d25<\/td><\/tr><tr><td>17<\/td><td>Open api daily request limit reached<\/td><td>API\u672a\u5f00\u901a\u4ed8\u8d39\uff0c\u6216\u8005\u5f53\u524d\u8d26\u6237\u5df2\u6b20\u8d39\uff0c\u5bfc\u81f4\u8bf7\u6c42\u5931\u8d25\u3002\u6bcf\u5929\u8bf7\u6c42\u91cf\u8d85\u9650\u989d\uff0c\u5df2\u4e0a\u7ebf\u8ba1\u8d39\u7684\u63a5\u53e3\uff0c\u8bf7\u76f4\u63a5\u5728\u63a7\u5236\u53f0\u5f00\u901a\u8ba1\u8d39\uff0c\u8c03\u7528\u91cf\u4e0d\u53d7\u9650\u5236\uff0c\u6309\u8c03\u7528\u91cf\u9636\u68af\u8ba1\u8d39\uff1b\u672a\u4e0a\u7ebf\u8ba1\u8d39\u7684\u63a5\u53e3\uff0c\u8bf7\u5728\u767e\u5ea6\u4e91\u63a7\u5236\u53f0\u5185<a href=\"https:\/\/ticket.bce.baidu.com\/?_=1683861660309#\/ticket\/create?productId=279&amp;questionId=1548\">\u63d0\u4ea4\u5de5\u5355<\/a>\u53cd\u9988<\/td><\/tr><tr><td>18<\/td><td>Open api qps request limit reached<\/td><td>QPS\u8d85\u9650\u989d\uff0c\u5df2\u4e0a\u7ebf\u8ba1\u8d39\u7684\u63a5\u53e3\uff0c\u8bf7\u76f4\u63a5\u5728\u63a7\u5236\u53f0\u5f00\u901a\u8ba1\u8d39\uff0c\u8c03\u7528\u91cf\u4e0d\u53d7\u9650\u5236\uff0c\u6309\u8c03\u7528\u91cf\u9636\u68af\u8ba1\u8d39\uff1b\u672a\u4e0a\u7ebf\u8ba1\u8d39\u7684\u63a5\u53e3\uff0c\u8bf7\u5728\u767e\u5ea6\u4e91\u63a7\u5236\u53f0\u5185<a href=\"https:\/\/ticket.bce.baidu.com\/#\/ticket\/create?useticket=1&amp;productId=279&amp;questionId=1548\">\u63d0\u4ea4\u5de5\u5355<\/a>\u53cd\u9988<\/td><\/tr><tr><td>19<\/td><td>Open api total request limit reached<\/td><td>\u8bf7\u6c42\u603b\u91cf\u8d85\u9650\u989d\uff0c\u5df2\u4e0a\u7ebf\u8ba1\u8d39\u7684\u63a5\u53e3\uff0c\u8bf7\u76f4\u63a5\u5728\u63a7\u5236\u53f0\u5f00\u901a\u8ba1\u8d39\uff0c\u8c03\u7528\u91cf\u4e0d\u53d7\u9650\u5236\uff0c\u6309\u8c03\u7528\u91cf\u9636\u68af\u8ba1\u8d39\uff1b\u672a\u4e0a\u7ebf\u8ba1\u8d39\u7684\u63a5\u53e3\uff0c\u8bf7\u5728\u767e\u5ea6\u4e91\u63a7\u5236\u53f0\u5185<a href=\"https:\/\/ticket.bce.baidu.com\/#\/ticket\/create?useticket=1&amp;productId=279&amp;questionId=1548\">\u63d0\u4ea4\u5de5\u5355<\/a>\u53cd\u9988<\/td><\/tr><tr><td>100<\/td><td>Invalid parameter<\/td><td>\u65e0\u6548\u7684access_token\u53c2\u6570\uff0ctoken\u62c9\u53d6\u5931\u8d25\uff0c\u60a8\u53ef\u4ee5\u53c2\u8003\u201c<a href=\"https:\/\/cloud.baidu.com\/doc\/WENXINWORKSHOP\/s\/Ilkkrb0i5\">Access Token\u83b7\u53d6<\/a>\u201d\u6587\u6863\u91cd\u65b0\u83b7\u53d6<\/td><\/tr><tr><td>110<\/td><td>Access token invalid or no longer valid<\/td><td>access_token\u65e0\u6548<\/td><\/tr><tr><td>111<\/td><td>Access token expired<\/td><td>access token\u8fc7\u671f<\/td><\/tr><tr><td>336000<\/td><td>Internal error<\/td><td>\u670d\u52a1\u5185\u90e8\u9519\u8bef<\/td><\/tr><tr><td>336001<\/td><td>Invalid Argument<\/td><td>\u5165\u53c2\u683c\u5f0f\u6709\u8bef\uff0c\u6bd4\u5982\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570<\/td><\/tr><tr><td>336002<\/td><td>Invalid JSON<\/td><td>\u5165\u53c2body\u4e0d\u662f\u6807\u51c6\u7684JSON\u683c\u5f0f<\/td><\/tr><tr><td>336003<\/td><td>{\u53c2\u6570\u6821\u9a8c\u4e0d\u5408\u6cd5\u7684\u5177\u4f53\u539f\u56e0}\u8bf4\u660e\uff1a\u53c2\u6570\u4e0d\u540c\uff0c\u8fd4\u56de\u9519\u8bef\u4fe1\u606f\u4e0d\u540c<\/td><td>\u53c2\u6570\u6821\u9a8c\u4e0d\u5408\u6cd5\uff0cerror_msg\u4e2d\u4f1a\u7ed9\u51fa\u5177\u4f53\u539f\u56e0<\/td><\/tr><tr><td>336004<\/td><td>{\u6743\u9650\u63a7\u5236\u51fa\u9519\u7684\u5177\u4f53\u539f\u56e0}<\/td><td>\u6743\u9650\u63a7\u5236\u51fa\u9519<\/td><\/tr><tr><td>336005<\/td><td>API name not exist<\/td><td>\u5b9a\u5236\u5316\u6a21\u578b\u670d\u52a1apiname\u4e0d\u5b58\u5728<\/td><\/tr><tr><td>336100<\/td><td>\u4eba\u5de5\u667a\u80fd\u662f\u4e00\u9879\u9769\u547d\u6027\u7684\u6280\u672f\u3002\u4e0e\u6211\u4e92\u52a8\u7684\u4eba\u8fc7\u591a\uff0c\u8bf7\u60a8\u7a0d\u540e\u91cd\u65b0\u5411\u6211\u63d0\u95ee\u3002<\/td><td>\u4eba\u5de5\u667a\u80fd\u662f\u4e00\u9879\u9769\u547d\u6027\u7684\u6280\u672f\u3002\u4e0e\u6211\u4e92\u52a8\u7684\u4eba\u8fc7\u591a\uff0c\u8bf7\u60a8\u7a0d\u540e\u91cd\u65b0\u5411\u6211\u63d0\u95ee<\/td><\/tr><tr><td>336101<\/td><td>Invalid HTTP Method<\/td><td>\u975e\u6cd5\u7684HTTP Method\uff0c \u5f53\u524d\u4ec5\u652f\u6301POST\u8bf7\u6c42<\/td><\/tr><tr><td>336104<\/td><td>system is invalid<\/td><td>system\u5185\u5bb9\u4e0d\u5408\u6cd5<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>ERNIE-Bot-4\u662f\u767e\u5ea6\u81ea\u884c\u7814\u53d1\u7684\u5927\u8bed\u8a00\u6a21\u578b\uff0c\u8986\u76d6\u6d77\u91cf\u4e2d\u6587\u6570\u636e\uff0c\u5177\u6709\u66f4\u5f3a\u7684\u5bf9\u8bdd\u95ee\u7b54\u3001\u5185\u5bb9\u521b\u4f5c\u751f\u6210\u7b49\u80fd\u529b\u3002\u672c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[185,183,184],"class_list":["post-996","post","type-post","status-publish","format-standard","hentry","category-website-construction","tag-api","tag-ernie-bot-4"],"_links":{"self":[{"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/posts\/996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/comments?post=996"}],"version-history":[{"count":1,"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/posts\/996\/revisions"}],"predecessor-version":[{"id":997,"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/posts\/996\/revisions\/997"}],"wp:attachment":[{"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/media?parent=996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/categories?post=996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gaoxigang.com\/index.php\/wp-json\/wp\/v2\/tags?post=996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}