{"id":404,"date":"2026-01-13T14:46:40","date_gmt":"2026-01-13T06:46:40","guid":{"rendered":"http:\/\/ai.taichi-maker.com\/?page_id=404"},"modified":"2026-01-13T14:47:10","modified_gmt":"2026-01-13T06:47:10","slug":"logit_bias","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\/logit_bias\/","title":{"rendered":"OpenAI API\u517c\u5bb9\u683c\u5f0f\u8bf7\u6c42\u53c2\u6570 \u2013 logit_bias"},"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> \/ logit_bias<\/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>logit_bias<\/code>\u53c2\u6570\uff0c\u7528\u4e8e\u5728\u6a21\u578b\u751f\u6210\u8fc7\u7a0b\u4e2d\u5bf9\u7279\u5b9atoken\u7684logit\u503c\u8fdb\u884c\u504f\u7f6e\u8c03\u6574\u3002\u8fd9\u4e2a\u53c2\u6570\u5141\u8bb8\u5f00\u53d1\u8005\u5bf9\u6a21\u578b\u7684\u8f93\u51fa\u8fdb\u884c\u7cbe\u7ec6\u63a7\u5236\uff0c\u4f7f\u6a21\u578b\u66f4\u503e\u5411\u4e8e\u6216\u66f4\u907f\u514d\u751f\u6210\u7279\u5b9a\u7684\u5185\u5bb9\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>logit_bias<\/code>\u662fAPI\u8bf7\u6c42\u4e2d\u7684<strong>\u53ef\u9009\u53c2\u6570<\/strong>\u3002\u82e5\u4e0d\u63d0\u4f9b<code>logit_bias<\/code>\u53c2\u6570\uff0c\u6a21\u578b\u4f1a\u6309\u7167\u5176\u9884\u8bad\u7ec3\u7684\u65b9\u5f0f\u751f\u6210\u6587\u672c\uff0c\u4f9d\u636e\u8bad\u7ec3\u6570\u636e\u4e2d\u5b66\u4e60\u5230\u7684\u6a21\u5f0f\u548c\u6982\u7387\u5206\u5e03\u6765\u9884\u6d4b\u4e0b\u4e00\u4e2a\u6700\u53ef\u80fd\u7684\u8bcd\u5143\uff08token\uff09\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>\u5728\u6587\u672c\u751f\u6210\u8fc7\u7a0b\u4e2d\uff0c\u6a21\u578b\u4f1a\u4e3a\u6bcf\u4e2a\u53ef\u80fd\u7684\u8bcd\u5143\uff08token\uff09\u8ba1\u7b97\u4e00\u4e2a logit \u503c\uff0c\u5b83\u4ee3\u8868\u672a\u5f52\u4e00\u5316\u7684\u5bf9\u6570\u6982\u7387\u3002logit_bias\u53c2\u6570\u7684\u4f5c\u7528\u662f\u8ba9\u4f60\u80fd\u591f\u5728\u8fd9\u4e9b logit \u503c\u4e0a\u53e0\u52a0\u4e00\u4e2a\u504f\u7f6e\u503c\uff0c\u8fdb\u800c\u5bf9\u8be5\u8bcd\u5143\u88ab\u9009\u4e2d\u7684\u6982\u7387\u4ea7\u751f\u5f71\u54cd\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6b63\u503c\u504f\u7f6e<\/strong>\uff1a\u5f53\u8d4b\u4e88\u4e00\u4e2a\u6b63\u503c\u504f\u7f6e\u65f6\uff0c\u4f1a\u63d0\u5347\u8be5\u8bcd\u5143\u88ab\u6a21\u578b\u9009\u4e2d\u7684\u6982\u7387\u3002\u8fd9\u610f\u5473\u7740\u5728\u751f\u6210\u6587\u672c\u65f6\uff0c\u76f8\u6bd4\u4e8e\u672a\u6dfb\u52a0\u504f\u7f6e\u7684\u60c5\u51b5\uff0c\u5e26\u6709\u6b63\u503c\u504f\u7f6e\u7684\u8bcd\u5143\u6709\u66f4\u9ad8\u7684\u53ef\u80fd\u6027\u88ab\u7eb3\u5165\u5230\u751f\u6210\u7ed3\u679c\u4e2d\u3002<\/li>\n\n\n\n<li><strong>\u8d1f\u503c\u504f\u7f6e<\/strong>\uff1a\u82e5\u504f\u7f6e\u503c\u4e3a\u8d1f\uff0c\u90a3\u4e48\u8be5\u8bcd\u5143\u88ab\u9009\u4e2d\u7684\u6982\u7387\u4f1a\u964d\u4f4e\u3002\u5373\u6a21\u578b\u5728\u751f\u6210\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u76f8\u5bf9\u51cf\u5c11\u9009\u62e9\u8be5\u8bcd\u5143\u7684\u503e\u5411\u3002<\/li>\n\n\n\n<li><strong>\u504f\u7f6e\u503c\u4e3a-100<\/strong>\uff1a\u8bbe\u7f6e\u50cf -100 \u8fd9\u6837\u7684\u6781\u5927\u8d1f\u503c\u504f\u7f6e\uff0c\u4f1a\u6781\u5927\u7a0b\u5ea6\u5730\u964d\u4f4e\u67d0\u4e2a\u8bcd\u5143\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u5c3d\u7ba1\u4ece\u5b9e\u9645\u6548\u679c\u4e0a\u770b\uff0c\u8fd9\u4e2a\u8bcd\u5143\u51e0\u4e4e\u4e0d\u53ef\u80fd\u51fa\u73b0\u5728\u751f\u6210\u7ed3\u679c\u4e2d\uff0c\u4f46\u7531\u4e8e\u6a21\u578b\u8ba1\u7b97\u7684\u968f\u673a\u6027\u4ee5\u53ca\u6d6e\u70b9\u6570\u7cbe\u5ea6\u7b49\u56e0\u7d20\uff0c\u4e25\u683c\u6765\u8bb2\u5e76\u4e0d\u80fd\u5b8c\u5168\u675c\u7edd\u5b83\u88ab\u9009\u4e2d\u7684\u53ef\u80fd\u6027\u3002<\/li>\n\n\n\n<li><strong>\u504f\u7f6e\u503c\u4e3a100<\/strong>\uff1a\u5f53\u504f\u7f6e\u503c\u8bbe\u4e3a\u50cf 100 \u8fd9\u6837\u7684\u6781\u5927\u6b63\u503c\u65f6\uff0c\u4f1a\u663e\u8457\u63d0\u9ad8\u8be5\u8bcd\u5143\u88ab\u9009\u4e2d\u7684\u6982\u7387\u3002\u4e0d\u8fc7\uff0c\u6a21\u578b\u751f\u6210\u6587\u672c\u662f\u4e00\u4e2a\u7efc\u5408\u8003\u8651\u4f17\u591a\u56e0\u7d20\u7684\u6982\u7387\u8fc7\u7a0b\uff0c\u5373\u4f7f\u67d0\u4e2a\u8bcd\u5143\u6709\u8f83\u5927\u7684\u6b63\u504f\u7f6e\uff0c\u4e5f\u4e0d\u80fd\u786e\u4fdd\u5b83\u4e00\u5b9a\u4f1a\u88ab\u9009\u4e2d\uff0c\u5728\u7279\u5b9a\u7684\u4e0a\u4e0b\u6587\u73af\u5883\u4e0b\uff0c\u5176\u4ed6\u8bcd\u5143\u4ecd\u6709\u53ef\u80fd\u51ed\u501f\u81ea\u8eab\u6743\u91cd\u53ca\u76f8\u5173\u56e0\u7d20\u88ab\u6a21\u578b\u9009\u4e2d\u3002<\/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>logit_bias<\/code>\u662f\u4e00\u4e2a\u5bf9\u8c61\uff0c\u952e\u662ftoken\u7684ID\uff0c\u503c\u662f\u504f\u7f6e\u503c\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u952e<\/strong>\uff1atoken\u7684\u6574\u6570ID\uff0c\u53ef\u4ee5\u901a\u8fc7tokenizer\u5de5\u5177\u83b7\u53d6<\/li>\n\n\n\n<li><strong>\u503c<\/strong>\uff1a-100\u5230100\u4e4b\u95f4\u7684\u6570\u5b57<\/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>logit_bias<\/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\": \"\u8bf7\u5199\u4e00\u6bb5\u5173\u4e8e\u6625\u5929\u7684\u63cf\u8ff0\u3002\"\n    }\n  &#93;,\n  \"logit_bias\": {\n    \"1234\": -10,\n    \"5678\": 5\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\">\u8bf7\u5199\u4e00\u6bb5\u5173\u4e8e\u6625\u5929\u7684\u63cf\u8ff0\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 cbp-line-highlight\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #8FBCBB\">logit_bias<\/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\">1234<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">-10<\/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\">5678<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">5<\/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>\"logit_bias\": {\"1234\": -10, \"5678\": 5}<\/code> \u8bbe\u7f6e\u4e86\u4e24\u4e2atoken\u7684\u504f\u7f6e<\/li>\n\n\n\n<li>\u8bcd\u5143 ID \u4e3a <code>1234<\/code> \u7684\u8bcd\u5143\uff0c\u7531\u4e8e\u504f\u7f6e\u503c\u8bbe\u5b9a\u4e3a <code>-10<\/code>\uff0c\u5176\u5728\u6a21\u578b\u751f\u6210\u6587\u672c\u8fc7\u7a0b\u4e2d\u7684\u751f\u6210\u6982\u7387\u4f1a\u88ab\u964d\u4f4e\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u76f8\u8f83\u4e8e\u6b63\u5e38\u60c5\u51b5\u4e0b\u8be5\u8bcd\u5143\u88ab\u6a21\u578b\u9009\u4e2d\u53c2\u4e0e\u6587\u672c\u751f\u6210\u7684\u53ef\u80fd\u6027\uff0c\u8bbe\u7f6e\u6b64\u504f\u7f6e\u540e\uff0c\u5b83\u88ab\u9009\u4e2d\u7684\u51e0\u7387\u53d8\u5c0f\u3002<\/li>\n\n\n\n<li>\u8bcd\u5143 ID \u4e3a <code>5678<\/code> \u7684\u8bcd\u5143\uff0c\u504f\u7f6e\u503c\u88ab\u8bbe\u5b9a\u4e3a <code>5<\/code>\uff0c\u8fd9\u5c06\u4f7f\u5f97\u8be5\u8bcd\u5143\u5728\u6a21\u578b\u751f\u6210\u6587\u672c\u65f6\u7684\u751f\u6210\u6982\u7387\u5f97\u5230\u589e\u52a0\u3002\u5373\u76f8\u6bd4\u65e0\u6b64\u504f\u7f6e\u65f6\uff0c\u6a21\u578b\u5728\u751f\u6210\u8fc7\u7a0b\u4e2d\u9009\u62e9\u8fd9\u4e2a\u8bcd\u5143\u878d\u5165\u6587\u672c\u7684\u53ef\u80fd\u6027\u589e\u5927\u3002<\/li>\n\n\n\n<li>logit_bias\u4e0e\u5176\u4ed6\u53c2\u6570\u5904\u4e8e\u540c\u4e00\u5c42\u7ea7\uff0c\u662f\u53ef\u9009\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\">\u4f7f\u7528\u5efa\u8bae<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u8c28\u614e\u4f7f\u7528\u504f\u7f6e\u503c<\/strong>\uff1a\u504f\u7f6e\u503c\u8fc7\u5927\uff08\u63a5\u8fd1\u00b1100\uff09\u4f1a\u5f3a\u70c8\u5f71\u54cd\u6a21\u578b\u884c\u4e3a\uff0c\u53ef\u80fd\u5bfc\u81f4\u8f93\u51fa\u4e0d\u81ea\u7136\u3002\u5efa\u8bae\u4ece\u5c0f\u503c\u5f00\u59cb\u6d4b\u8bd5\uff0c\u9010\u6b65\u8c03\u6574<\/li>\n\n\n\n<li><strong>\u4e86\u89e3token ID<\/strong>\uff1a\u5728\u4f7f\u7528logit_bias\u4e4b\u524d\uff0c\u9700\u8981\u77e5\u9053\u76ee\u6807token\u7684ID\u3002\u53ef\u4ee5\u4f7f\u7528tokenizer\u5de5\u5177\u5c06\u6587\u672c\u8f6c\u6362\u4e3atoken ID<\/li>\n\n\n\n<li><strong>\u6d4b\u8bd5\u4e0d\u540c\u504f\u7f6e\u503c<\/strong>\uff1a\u4e0d\u540c\u7684\u504f\u7f6e\u503c\u5bf9\u8f93\u51fa\u7684\u5f71\u54cd\u7a0b\u5ea6\u4e0d\u540c\uff0c\u5efa\u8bae\u8fdb\u884c\u591a\u6b21\u6d4b\u8bd5\u627e\u5230\u6700\u4f73\u503c<\/li>\n\n\n\n<li><strong>\u8003\u8651\u4e0a\u4e0b\u6587\u5f71\u54cd<\/strong>\uff1alogit_bias\u7684\u6548\u679c\u4f1a\u53d7\u5230\u4e0a\u4e0b\u6587\u548c\u5176\u4ed6\u53c2\u6570\uff08\u5982temperature\uff09\u7684\u5f71\u54cd\uff0c\u9700\u8981\u7efc\u5408\u8003\u8651<\/li>\n\n\n\n<li><strong>\u907f\u514d\u8fc7\u5ea6\u63a7\u5236<\/strong>\uff1a\u8fc7\u5ea6\u4f7f\u7528logit_bias\u53ef\u80fd\u5bfc\u81f4\u8f93\u51fa\u8d28\u91cf\u4e0b\u964d\u6216\u5931\u53bb\u6a21\u578b\u7684\u521b\u9020\u6027\u3002\u53ea\u5728\u5fc5\u8981\u65f6\u4f7f\u7528<\/li>\n\n\n\n<li><strong>\u76d1\u63a7\u8f93\u51fa\u8d28\u91cf<\/strong>\uff1a\u4f7f\u7528logit_bias\u540e\uff0c\u4ed4\u7ec6\u68c0\u67e5\u8f93\u51fa\u8d28\u91cf\uff0c\u786e\u4fdd\u6ca1\u6709\u5f15\u5165\u610f\u5916\u7684\u884c\u4e3a\u6216\u504f\u5dee<\/li>\n\n\n\n<li><strong>\u7ed3\u5408\u5176\u4ed6\u53c2\u6570<\/strong>\uff1alogit_bias\u53ef\u4ee5\u4e0etemperature\u3001top_p\u7b49\u53c2\u6570\u914d\u5408\u4f7f\u7528\uff0c\u5b9e\u73b0\u66f4\u7cbe\u7ec6\u7684\u63a7\u5236<\/li>\n\n\n\n<li><strong>\u8bb0\u5f55\u504f\u7f6e\u8bbe\u7f6e<\/strong>\uff1a\u8bb0\u5f55\u6709\u6548\u7684logit_bias\u8bbe\u7f6e\u548c\u5bf9\u5e94\u7684token ID\uff0c\u4fbf\u4e8e\u540e\u7eed\u590d\u7528\u548c\u8c03\u6574<\/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\u5982\u4f55\u83b7\u53d6token\u7684ID\uff1f<\/strong><br>\u7b54\uff1a\u53ef\u4ee5\u4f7f\u7528OpenAI\u63d0\u4f9b\u7684tokenizer\u5de5\u5177\u6216\u5e93\u6765\u83b7\u53d6\u6587\u672c\u5bf9\u5e94\u7684token ID\u3002\u4f8b\u5982\uff0c\u4f7f\u7528tiktoken\u5e93\u53ef\u4ee5\u5c06\u6587\u672c\u7f16\u7801\u4e3atoken ID\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4e0d\u540c\u6a21\u578b\u53ef\u80fd\u4f7f\u7528\u4e0d\u540c\u7684tokenizer\uff0c\u56e0\u6b64\u9700\u8981\u786e\u4fdd\u4f7f\u7528\u4e0e\u76ee\u6807\u6a21\u578b\u5339\u914d\u7684tokenizer\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1alogit_bias\u4e0etemperature\u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/strong><br>\u7b54\uff1alogit_bias\u548ctemperature\u90fd\u5f71\u54cd\u6a21\u578b\u8f93\u51fa\uff0c\u4f46\u4f5c\u7528\u65b9\u5f0f\u4e0d\u540c\u3002temperature\u662f\u5168\u5c40\u53c2\u6570\uff0c\u5f71\u54cd\u6240\u6709token\u7684\u9009\u62e9\u6982\u7387\u5206\u5e03\uff1blogit_bias\u662f\u5c40\u90e8\u53c2\u6570\uff0c\u53ea\u5f71\u54cd\u7279\u5b9atoken\u7684\u6982\u7387\u3002temperature\u63a7\u5236\u8f93\u51fa\u7684\u968f\u673a\u6027\u548c\u521b\u9020\u6027\uff0clogit_bias\u63a7\u5236\u7279\u5b9a\u5185\u5bb9\u7684\u751f\u6210\u503e\u5411\u3002\u4e24\u8005\u53ef\u4ee5\u914d\u5408\u4f7f\u7528\uff0c\u5b9e\u73b0\u66f4\u7cbe\u7ec6\u7684\u8f93\u51fa\u63a7\u5236\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1a\u4e3a\u4ec0\u4e48\u8bbe\u7f6elogit_bias\u540e\u8f93\u51fa\u6ca1\u6709\u660e\u663e\u53d8\u5316\uff1f<\/strong><br>\u7b54\uff1a\u53ef\u80fd\u7684\u539f\u56e0\u5305\u62ec\uff1a1\uff09\u504f\u7f6e\u503c\u592a\u5c0f\uff0c\u4e0d\u8db3\u4ee5\u4ea7\u751f\u660e\u663e\u5f71\u54cd\uff1b2\uff09\u4e0a\u4e0b\u6587\u5f3a\u70c8\u503e\u5411\u4e8e\u5176\u4ed6\u8f93\u51fa\uff0c\u62b5\u6d88\u4e86\u504f\u7f6e\u6548\u679c\uff1b3\uff09temperature\u8bbe\u7f6e\u8fc7\u9ad8\uff0c\u589e\u52a0\u4e86\u968f\u673a\u6027\uff1b4\uff09\u76ee\u6807token\u5728\u5f53\u524d\u4e0a\u4e0b\u6587\u4e2d\u672c\u6765\u5c31\u4e0d\u592a\u53ef\u80fd\u88ab\u9009\u4e2d\u3002\u5efa\u8bae\u5c1d\u8bd5\u589e\u5927\u504f\u7f6e\u503c\u3001\u964d\u4f4etemperature\u6216\u8c03\u6574\u4e0a\u4e0b\u6587\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1a\u53ef\u4ee5\u540c\u65f6\u8bbe\u7f6e\u591a\u4e2atoken\u7684\u504f\u7f6e\u5417\uff1f<\/strong><br>\u7b54\uff1a\u662f\u7684\uff0c\u53ef\u4ee5\u5728logit_bias\u5bf9\u8c61\u4e2d\u540c\u65f6\u8bbe\u7f6e\u591a\u4e2atoken\u7684\u504f\u7f6e\u3002\u6bcf\u4e2atoken\u90fd\u4f1a\u72ec\u7acb\u5730\u5e94\u7528\u5176\u504f\u7f6e\u503c\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u591a\u4e2a\u504f\u7f6e\u53ef\u80fd\u4f1a\u76f8\u4e92\u5f71\u54cd\uff0c\u6700\u7ec8\u8f93\u51fa\u662f\u6240\u6709\u504f\u7f6e\u548c\u6a21\u578b\u5185\u90e8\u6982\u7387\u5206\u5e03\u5171\u540c\u4f5c\u7528\u7684\u7ed3\u679c\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1alogit_bias\u7684\u6700\u5927\u503c\u548c\u6700\u5c0f\u503c\u662f\u591a\u5c11\uff1f<\/strong><br>\u7b54\uff1alogit_bias \u7684\u503c\u8303\u56f4\u901a\u5e38\u662f -100 \u5230 100 \u3002\u8d85\u51fa\u8fd9\u4e2a\u8303\u56f4\u7684\u503c\u53ef\u80fd\u4f1a\u88ab\u9650\u5236\u5728\u8fb9\u754c\u503c\u3002 -100 \u4f1a\u6781\u5927\u7a0b\u5ea6\u964d\u4f4e\u8be5 token \u88ab\u751f\u6210\u7684\u6982\u7387\uff0c100 \u4f1a\u6781\u5927\u7a0b\u5ea6\u63d0\u9ad8\u8be5 token \u88ab\u751f\u6210\u7684\u6982\u7387\uff0c\u4f46\u4e0d\u80fd\u7edd\u5bf9\u5730\u8ba4\u4e3a -100 \u5c31\u5b8c\u5168\u7981\u6b62\u751f\u6210\uff0c100 \u5c31\u5fc5\u7136\u4f1a\u751f\u6210\u3002\u5efa\u8bae\u5728\u8fd9\u4e2a\u8303\u56f4\u5185\u9009\u62e9\u5408\u9002\u7684\u503c\uff0c\u907f\u514d\u4f7f\u7528\u6781\u7aef\u503c\u5bfc\u81f4\u8f93\u51fa\u4e0d\u81ea\u7136\u3002<\/li>\n\n\n\n<li><strong>\u95ee\uff1alogit_bias\u4f1a\u5f71\u54cdAPI\u54cd\u5e94\u65f6\u95f4\u5417\uff1f<\/strong><br>\u7b54\uff1alogit_bias\u5bf9\u54cd\u5e94\u65f6\u95f4\u7684\u5f71\u54cd\u901a\u5e38\u5f88\u5c0f\uff0c\u56e0\u4e3a\u504f\u7f6e\u8ba1\u7b97\u662f\u5728\u6a21\u578b\u63a8\u7406\u8fc7\u7a0b\u4e2d\u8fdb\u884c\u7684\u3002\u4f46\u662f\uff0c\u5982\u679c\u8bbe\u7f6e\u4e86\u5927\u91cftoken\u7684\u504f\u7f6e\uff08\u4f8b\u5982\u6570\u767e\u4e2a\uff09\uff0c\u53ef\u80fd\u4f1a\u5bf9\u6027\u80fd\u4ea7\u751f\u8f7b\u5fae\u5f71\u54cd\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u8fd9\u79cd\u5f71\u54cd\u901a\u5e38\u53ef\u4ee5\u5ffd\u7565\u4e0d\u8ba1\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 \/ logi [&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-404","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/pages\/404","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=404"}],"version-history":[{"count":9,"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/pages\/404\/revisions"}],"predecessor-version":[{"id":413,"href":"http:\/\/ai.taichi-maker.com\/index.php\/wp-json\/wp\/v2\/pages\/404\/revisions\/413"}],"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=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}