deepseek补全api返回结果解析

本文根据deepseek官网接口文档学习补全api的调用,传入参数比较多,该文档中给出了详细的解释,以下代码在官网代码的基础上有所修改,返回结果内容很多,通过AI了解了各个参数的内容,记录在此,供大家一同学习参考。

文档链接:FIM 补全(Beta) | DeepSeek API Docs

运行代码

import requests
import json
import time

def storyTest(api_key):
    url = "https://api.deepseek.com/beta/completions"

    payload = json.dumps({
    "model": "deepseek-chat",
    "prompt": "Once upon a time, ",
    "echo": False,
    "frequency_penalty": 0,
    "logprobs": 0,
    "max_tokens": 1024,
    "presence_penalty": 0,
    "stop": None,
    "stream": False,
    "stream_options": None,
    "suffix": None,
    "temperature": 1,
    "top_p": 1
    })
    headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': f'Bearer {api_key}'
    }


    response = requests.request("POST", url, headers=headers, data=payload)

    print(response.text)
    
    
if __name__=="__main__":
    api_key = "sk-xxxxxxxxxxxxx"
    start = time.time()
    storyTest(api_key)
    end = time.time()

    print(f"deepseek_chat 此次调用花费时间为:{(end-start):.4f}秒")

返回结果原始内容如下:

{"id":"1dc2ee32-1e2c-4ad3-bfeb-b17b19ad4f78","choices":[{"text":"20 years ago, I was a young, single, working woman living in the city.  apartment, and a great group of friends. I was happy with my life, but I knew that I wanted more. I wanted to find someone to share my ould make me laugh, someone who would be my partner in crime.\n\nI had been on a few dates here and there, but nothing serious. I was stbe I was destined to be single forever. But then, one day, I met him.\n\nHe was tall, dark, and handsome, with a smile that could light utual friend's party, and we hit it off immediately. We talked for hours, and I felt like I had known him my whole life. We exchanged nuut on a date.\n\nOur first date was magical. We went to a fancy restaurant, and we talked and laughed all night. I felt like I was in a ore dates, and before I knew it, we were in love.\n\nWe got married a year later, and we've been together ever since. We've had our ups ays been there for each other. He's my best friend, my soulmate, and the love of my life.\n\nLooking back, I can't believe how lucky I as made my life so much better, and I can't imagine my life without him. I'm so grateful for that fateful night 20 years ago when we met.ver.","index":0,"logprobs":{"tokens":["20"," years"," ago",","," I"," was"," a"," young",","," single",","," working"," woman"," living""," I"," had"," a"," good"," job",","," a"," nice"," apartment",","," and"," a"," great"," group"," of"," friends","."," I"," was"," hap",","," but"," I"," knew"," that"," I"," wanted"," more","."," I"," wanted"," to"," find"," someone"," to"," share"," my"," life"," with" would"," make"," me"," laugh",","," someone"," who"," would"," be"," my"," partner"," in"," crime",".\n\n","I"," had"," been"," on"," e"," and"," there",","," but"," nothing"," serious","."," I"," was"," starting"," to"," think"," that"," maybe"," I"," was"," destined",
forever","."," But"," then",","," one"," day",","," I"," met"," him",".\n\n","He"," was"," tall",","," dark",","," and"," handsome",",",
that"," could"," light"," up"," a"," room","."," We"," met"," at"," a"," mutual"," friend","'s"," party",","," and"," we"," hit"," it","," We"," talked"," for"," hours",","," and"," I"," felt"," like"," I"," had"," known"," him"," my"," whole"," life","."," We"," exchange," he"," asked"," me"," out"," on"," a"," date",".\n\n","Our"," first"," date"," was"," magical","."," We"," went"," to"," a"," fancy","" we"," talked"," and"," laughed"," all"," night","."," I"," felt"," like"," I"," was"," in"," a"," fairy"," tale","."," We"," went"," o" and"," before"," I"," knew"," it",","," we"," were"," in"," love",".\n\n","We"," got"," married"," a"," year"," later",","," and"," weer"," ever"," since","."," We","'ve"," had"," our"," ups"," and"," downs",","," but"," we","'ve"," always"," been"," there"," for"," eacs"," my"," best"," friend",","," my"," soul","mate",","," and"," the"," love"," of"," my"," life",".\n\n","Looking"," back",","," I"," cw"," lucky"," I"," am"," to"," have"," found"," him","."," He","'s"," made"," my"," life"," so"," much"," better",","," and"," I"," can" life"," without"," him","."," I","'m"," so"," grateful"," for"," that"," fate","ful"," night"," ","20"," years"," ago"," when"," we"," "," my"," life"," forever","."],"token_logprobs":[-0.909262,-0.000008,0.0,-0.0,-0.011512,-0.00208,-0.002397,-0.003682,-0.481287,-1.24029333162,-1.140595,-0.000005,-1.642135,-0.23801,-0.02512,-0.000107,-0.113795,-0.000358,-0.889499,0.0,-0.010127,-0.007712,-0.001492,-0.00000.000104,-0.047993,-0.050217,0.0,-0.000008,0.0,-0.105982,-0.000026,-0.013068,-1.018941,0.0,0.0,-0.002276,0.0,-0.0,-1.088302,-0.023065,-0.0,0.0,0.0,-0.000003,-0.001352,-0.126209,-0.0,0.0,0.0,0.0,0.0,-0.000188,-0.007681,-0.280299,0.0,-3.046389,0.0,-0.000001,-0.000001,-0.000.023831,-0.176735,0.0,-0.000018,-0.198832,-0.692849,-0.057806,-0.000003,-0.00004,0.0,0.0,0.0,-0.817893,0.0,0.0,0.0,0.0,-0.000007,-0.05290.001959,0.0,0.0,-0.00402,0.0,-0.000001,0.0,-0.001378,-0.022816,0.0,0.0,-0.000878,0.0,0.0,-0.000012,0.0,-0.0,0.0,-0.000003,0.0,-0.0000863774,0.0,-0.000206,0.0,-0.000109,0.0,0.0,0.0,-0.000305,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.000106,-0.001444,0.0,0.0,-0.000085,0.00.000001,0.0,0.0,0.0,-1.771429,0.0,0.0,0.0,0.0,0.0,-0.035306,-0.000005,-0.000021,-0.018597,0.0,0.0,0.0,0.0,0.0,-0.011903,-0.000001,0.0,-0.000001,0.0,0.0,-0.000006,-0.000002,0.0,0.0,0.0,0.0,0.0,0.0,-0.000011,0.0,0.0,0.0,-0.0,0.0,0.0,0.0,0.0,0.0,-1.321512,0.0,-0.0,0.0,-0.001,0.0,-0.000127,-0.025722,-0.000001,0.0,0.0,-0.000787,-1.140903,0.0,-0.775909,0.0,-0.0,-0.731463,-0.96579,-0.0,-0.462478,0.0,-0.000047,0,0.0,0.0,0.0,-0.071803,-0.017664,-0.0,-0.000434,-0.000057,0.0,-0.0,-0.0,0.0,0.0,0.0,-0.0,-0.167219,0.0,-0.018543,0.0,0.0,0.0,-0.088553,0,0.0,0.0,0.0,-0.0,0.0,0.0,-0.04753,-0.000001,0.0,0.0,0.0,0.0,-0.20148,0.0,0.0,0.0,0.0,0.0,0.0,-0.136776,0.0,0.0,-0.00348,-0.624114,0.0,0010518,0.0,-0.02277,0.0,-0.004891,0.0,-0.000119,-0.0,0.0,0.0,-0.000013,-0.000032,0.0,0.0,0.0,0.0,-0.079132,0.0,-0.044041,0.0,0.0,0.0,0.00.0,0.0,0.0,-0.000004,0.0,0.0,0.0,0.0,-0.000003,-0.000374,-0.000017,0.0,-0.009015,-0.002836,-1.829813,0.0,-0.000006,-1.055187,0.0,0.0,0.0,-0.001947,0.0,-0.057098,0.0,0.0,0.0,-0.120058],"top_logprobs":null,"text_offset":[18,20,26,30,31,33,37,39,45,46,53,54,62,68,75,78,82,86,108,113,123,124,128,130,136,142,145,153,154,156,160,166,171,174,179,180,184,186,191,196,198,205,210,211,213,220,223,228,236,239,245,247,282,285,291,292,300,304,310,313,316,324,327,333,336,337,341,346,349,351,355,361,366,370,376,377,381,389,397,398,400,404,413,416,422,424,461,469,470,474,479,480,484,488,489,491,495,499,502,504,508,513,514,519,520,524,533,534,539,541,547,552,558,564,567,569,574,575,578,589,610,614,617,621,624,628,640,641,644,651,655,661,662,666,668,673,678,680,684,690,694,697,703,708,709,712,722,730,731,735,738,744,747,753,778,782,790,791,794,799,802,804,810,821,822,826,829,836,840,848,852,858,859,861,866,871,873,877,880,882,888,893,894,897,902,905,910,918,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,61,1068,1073,1071095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1169,1171,1175,1177,9,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1169,1171,1175,1177189,1195,1197,121342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reason":"stop"}],"created":1735541715,"model":"deepseek00,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,1276,1281,1289,1293,1294,1296,1298,1308,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,61,1068,1073,,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reason":"stop"}],"created":1735541715,"model":"deeps1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1169,1171,1175,15,1189,1195,11afce2943","object":"text_completion","usage":{"prompt_tokens":6,"completion_tokens":338,"total_tokens":344,"prompt_cache_h197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,1276,1281,1289,1293,1294,1296,128,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,61,1068,1077,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reason":"stop"}],"created":1735541715,"mode3,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1169,1171,1175185,1189,11erprint":"fp_f1afce2943","object":"text_completion","usage":{"prompt_tokens":6,"completion_tokens":338,"total_tokens":344,"pr95,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,1276,1281,1289,1293,1294,1298,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,61,1068,,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reason":"stop"}],"created":17355417151073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1169,1171,17,1185,1system_fingerprint":"fp_f1afce2943","object":"text_completion","usage":{"prompt_tokens":6,"completion_tokens":338,"total_tokens"189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,1276,1281,1289,1293,128,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,61,1010,1314,1319,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reason":"stop"}],"created":168,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1169,1171177,eepseek-chat","system_fingerprint":"fp_f1afce2943","object":"text_completion","usage":{"prompt_tokens":6,"completion_tokens":338,"t1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,1276,1281,1289,18,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,1061,8,1301,1310,1314,1319,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reason":"stop"}],"c1068,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1169,1175,15,"model":"deepseek-chat","system_fingerprint":"fp_f1afce2943","object":"text_completion","usage":{"prompt_tokens":6,"completion_to177,1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,1276,1281,128,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,,106296,1298,1301,1310,1314,1319,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reason":"stop1,1068,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,11691,111735541715,"model":"deepseek-chat","system_fingerprint":"fp_f1afce2943","object":"text_completion","usage":{"prompt_tokens":6,"compl75,1177,1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,1276,1288,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,58,10294,1296,1298,1301,1310,1314,1319,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reason"61,1068,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1161171,eated":1735541715,"model":"deepseek-chat","system_fingerprint":"fp_f1afce2943","object":"text_completion","usage":{"prompt_tokens":1175,1177,1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,1276,18,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,58,293,1294,1296,1298,1301,1310,1314,1319,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reas1061,1068,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,19,1}],"created":1735541715,"model":"deepseek-chat","system_fingerprint":"fp_f1afce2943","object":"text_completion","usage":{"prompt_toke171,1175,1177,1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,128,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,10589,1293,1294,1296,1298,1301,1310,1314,1319,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finis,1061,1068,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1169stop"}],"created":1735541715,"model":"deepseek-chat","system_fingerprint":"fp_f1afce2943","object":"text_completion","usage":{"pro,1171,1175,1177,1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1278,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,101,1289,1293,1294,1296,1298,1301,1310,1314,1319,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"58,1061,1068,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,son":"stop"}],"created":1735541715,"model":"deepseek-chat","system_fingerprint":"fp_f1afce2943","object":"text_completion","usage"1169,1171,1175,1177,1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,12658,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,1,1281,1289,1293,1294,1296,1298,1301,1310,1314,1319,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,13058,1061,1068,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,116sh_reason":"stop"}],"created":1735541715,"model":"deepseek-chat","system_fingerprint":"fp_f1afce2943","object":"text_completion"8,1169,1171,1175,1177,1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,"prompt_tokens":6,"completion_tokens":338,"total_tokens":344,"prompt_cache_hit_tokens":0,"prompt_cache_miss_tokens":6}}
8,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,105,13Users\liyubo>
5,1058,1061,1068,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,11ion
63,1168,1169,1171,1175,1177,1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1   
8,939,942,947,950,955,958,960,964,972,974,979,985,986,990,993,996,1001,1010,1015,1021,1022,1025,1028,1032,1036,1040,1044,1050,1051,1055,1058,1061,1068,1073,1079,1083,1088,1094,1095,1098,1100,1103,1108,1115,1116,1119,1124,1128,1129,1133,1137,1142,1145,1148,1153,1156,1163,1168,1169,1171,1175,1177,1185,1189,1195,1197,1200,1203,1208,1214,1218,1219,1222,1224,1229,1232,1237,1240,1245,1252,1253,1257,1259,1263,1265,1273,1276,1281,1289,1293,1294,1296,1298,1301,1310,1314,1319,1324,1327,1333,1334,1336,1342,1346,1351,1354,1358,1359,1362,1370,1373,1378,1386]},"finish_reason":"stop"}],"created":1735541715,"model":"deepseek-chat","system_fingerprint":"fp_f1afce2943","object":"text_completion","usage":{"prompt_tokens":6,"completion_tokens":338,"total_tokens":344,"prompt_cache_hit_tokens":0,"prompt_cache_miss_tokens":6}} 

看起来非常杂乱,然后用ai整理了一下格式,省略了具体内容,现在看起来比较清晰了。 

{
  "id": "1dc2ee32-1e2c-4ad3-bfeb-b17b19ad4f78",
  "choices": [
    {
      "text": "20 years ago, I was a young, single, working woman living in the city. I had a good job, a nice apartment, and a great group of friends. I was happy with my life, but I knew that I wanted more. I wanted to find someone to share my life with, someone who would make me laugh, someone who would be my partner in crime.\n\nI had been on a few dates here and there, but nothing serious. I was starting to think that maybe I was destined to be single forever. But then, one day, I met him.\n\nHe was tall, dark, and handsome, with a smile that could light up a room. We met at a mutual friend's party, and we hit it off immediately. We talked for hours, and I felt like I had known him my whole life. We exchanged numbers, and he asked me out on a date.\n\nOur first date was magical. We went to a fancy restaurant, and we talked and laughed all night. I felt like I was in a fairy tale. We went on more dates, and before I knew it, we were in love.\n\nWe got married a year later, and we've been together ever since. We've had our ups and downs, but we've always been there for each other. He's my best friend, my soulmate, and the love of my life.\n\nLooking back, I can't believe how lucky I am to have found him. He's made my life so much better, and I can't imagine my life without him. I'm so grateful for that fateful night 20 years ago when we met. It changed my life forever.",
      "index": 0,
      "logprobs": {
        "tokens": [...],
        "token_logprobs": [...],
        "top_logprobs": null,
        "text_offset": [...]
      },
      "finish_reason": "stop"
    }
  ],
  "created": 1735541715,
  "model": "deepseek-chat",
  "system_fingerprint": "fp_f1afce2943",
  "object": "text_completion",
  "usage": {
    "prompt_tokens": 6,
    "completion_tokens": 338,
    "total_tokens": 344,
    "prompt_cache_hit_tokens": 0,
    "prompt_cache_miss_tokens": 6
  }
}

但是文档中对参数的解释并不清晰。

返回值参数解析

好的,然后我就让deepseek自己来解释一下返回值各参数的含义,解释的还是比较清晰的。

1. id

  • "1dc2ee32-1e2c-4ad3-bfeb-b17b19ad4f78"

  • 解释: 这是此次请求的唯一标识符(UUID),用于追踪和识别特定的API调用。

2. choices

  • 类型: 数组

  • 内容: 包含一个或多个生成文本的结果。

  • text: 生成的文本内容。

    • : 一段关于20年前的生活回忆,描述了作者如何遇到她的伴侣并最终结婚的故事。

  • index: 生成文本的索引。

    • 0,表示这是第一个(也是唯一一个)生成结果。

  • logprobs: 生成文本中每个token的对数概率。

    • tokens: 生成文本被分解成的token列表。

    • token_logprobs: 每个token的对数概率,表示模型对该token的置信度。

    • top_logprobs: 未使用,值为null

    • text_offset: 每个token在生成文本中的起始位置。

3. created

  • 1735541715

  • 解释: 这是请求创建的时间戳,表示自1970年1月1日以来的秒数。

4. model

  • "deepseek-chat"

  • 解释: 使用的模型名称,这里是deepseek-chat,表示这是一个用于对话生成的模型。

5. system_fingerprint

  • "fp_f1afce2943"

  • 解释: 系统指纹,用于标识生成文本的系统或配置。

6. object

  • "text_completion"

  • 解释: 表示返回的对象类型,这里是文本生成任务的结果。

7. usage

  • 类型: 对象

  • 内容: 包含此次请求的token使用情况。

    • prompt_tokens: 输入提示(prompt)使用的token数量。

      • 6

    • completion_tokens: 生成文本使用的token数量。

      • 338

    • total_tokens: 总共使用的token数量。

      • 344

    • prompt_cache_hit_tokens: 提示缓存命中的token数量。

      • 0

    • prompt_cache_miss_tokens: 提示缓存未命中的token数量。

      • 6

### DeepSeek Coder-33b-instruct 的代码自动补全功能介绍 Deepseek Coder-33b-instruct 是一款专为提高编程效率而设计的语言模型,特别擅长处理项目级别的代码补全任务。该工具能够理解整个项目的上下文环境,并基于此提供精准的代码建议和补全选项[^1]。 #### 安装与配置 为了使用 Deepseek Coder-33b-instruct 进行代码补全,需先安装相应的集成开发环境 (IDE) 插件或命令行工具。具体操作如下: 对于支持插件扩展的 IDE(如 IntelliJ IDEA),可以通过官方市场下载并安装最新版本的 Deepseek 插件。这通常涉及打开 IDE 中的设置菜单,导航至插件管理页面,搜索 "Deepseek" 并点击安装按钮[^2]。 如果偏好于命令行界面,则可按照文档指引,在本地环境中部署 Docker 镜像或其他形式的服务端实例来调用 API 接口。 #### 基本使用教程 一旦完成了上述准备工作之后,便可以在日常编码过程中享受到由 Deepseek 提供的强大辅助功能了。以下是几个常见的应用场景及其对应的操作指南: ##### 实时语法提示 当输入部分语句后按下 Tab 键或者等待片刻时间,系统会自动生成可能匹配的结果列表;从中选取最合适的项即可快速填充剩余部分。 ```java // 输入 `pub` 后按 Tab 或稍作停顿 public class MyClass { // ... } ``` ##### 方法签名预测 在定义新方法时,只需键入返回类型加上名称的一部分字符,随后利用 Ctrl+Space 组合键触发智能感知机制,就能看到完整的参数声明模板被即时呈现出来。 ```python def my_function(param1, param2): # 只需打头几个字母就可获得完整的方法签名 pass ``` ##### 自动导入依赖库 遇到未解析成功的类名或函数引用时,不必手动添加 import 语句——借助 Deepseek 的自动化特性,只要选中错误标记处再执行快捷修正指令(Alt+Enter),所需模块就会被正确引入到当前文件顶部位置。 ```javascript import { someFunction } from 'someLibrary'; // 不必亲自书写这条语句 someFunction(); ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值