Skip to content

Commit 6a245a6

Browse files
jameszyaoSimsonW
authored andcommitted
docs: update chat completion example docs
1 parent 4e88723 commit 6a245a6

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

examples/inference/chat_completion.ipynb

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,26 @@
240240
},
241241
{
242242
"cell_type": "code",
243-
"execution_count": null,
244-
"outputs": [],
243+
"execution_count": 31,
244+
"outputs": [
245+
{
246+
"name": "stdout",
247+
"output_type": "stream",
248+
"text": [
249+
"1 2 3 4 5 6 7 8 9 10\n",
250+
"11 12 13 14 15 16 17 18 19 20\n",
251+
"21 22 23 24 25 26 27 28 29 30\n",
252+
"31 32 33 34 35 36 37 38 39 40\n",
253+
"41 42 43 44 45 46 47 48 49 50\n",
254+
"51 52 53 54 55 56 57 58 59 60\n",
255+
"61 62 63 64 65 66 67 68 69 70\n",
256+
"71 72 73 74 75 76 77 78 79 80\n",
257+
"81 82 83 84 85 86 87 88 89 90\n",
258+
"91 92 93 94 95 96 97 98 99 100\n",
259+
"Finished with reason: stop\n"
260+
]
261+
}
262+
],
245263
"source": [
246264
"# generate in stream mode\n",
247265
"chat_completion_result = taskingai.inference.chat_completion(\n",
@@ -257,12 +275,26 @@
257275
" print(item.delta, end=\"\", flush=True)\n",
258276
" \n",
259277
" elif isinstance(item, ChatCompletion):\n",
260-
" print(f\"\\nFinished with reason: {item.finish_reason}\")"
278+
" print(f\"\\n\\nFinished with reason: {item.finish_reason}\")"
261279
],
262280
"metadata": {
263-
"collapsed": false
281+
"collapsed": false,
282+
"ExecuteTime": {
283+
"end_time": "2023-12-12T06:29:54.749165Z",
284+
"start_time": "2023-12-12T06:29:47.420237Z"
285+
}
264286
},
265287
"id": "4f3290f87635152a"
288+
},
289+
{
290+
"cell_type": "code",
291+
"execution_count": null,
292+
"outputs": [],
293+
"source": [],
294+
"metadata": {
295+
"collapsed": false
296+
},
297+
"id": "e98109211cacfbb1"
266298
}
267299
],
268300
"metadata": {

0 commit comments

Comments
 (0)