[go: nahoru, domu]

Skip to content

Commit

Permalink
chore: change task function to be async in notebook (#3845)
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHYang committed Jul 4, 2024
1 parent 8aed7ba commit a939569
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tutorials/experiments/llama-index/guideline_eval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@
"llm = OpenAI(model=\"gpt-3.5-turbo\")\n",
"\n",
"\n",
"def task(input):\n",
" return llm.complete(input[\"document\"] + \"\\n\\n\" + input[\"messages\"][-1][\"content\"]).text"
"async def task(input):\n",
" return (await llm.acomplete(input[\"document\"] + \"\\n\\n\" + input[\"messages\"][-1][\"content\"])).text"
]
},
{
Expand All @@ -218,7 +218,7 @@
"outputs": [],
"source": [
"example = dataset[0]\n",
"task_output = task(example.input)\n",
"task_output = await task(example.input)\n",
"print(shorten(json.dumps(task_output), width=80))"
]
},
Expand Down

0 comments on commit a939569

Please sign in to comment.