Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapt notebook to new openai python API syntax #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions gpt_llm_trainer_v2,_with_GPT_3_5_Fine_Tuning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@
" \"content\": example\n",
" })\n",
"\n",
" response = openai.ChatCompletion.create(\n",
" response = openai.chat.completions.create(\n",
" model=\"gpt-4\",\n",
" messages=messages,\n",
" temperature=temperature,\n",
" max_tokens=1000,\n",
" )\n",
"\n",
" return response.choices[0].message['content']\n",
" return response.choices[0].message.content\n",
"\n",
"# Generate examples\n",
"prev_examples = []\n",
Expand Down Expand Up @@ -153,7 +153,7 @@
"source": [
"def generate_system_message(prompt):\n",
"\n",
" response = openai.ChatCompletion.create(\n",
" response = openai.chat.completions.create(\n",
" model=\"gpt-4\",\n",
" messages=[\n",
" {\n",
Expand All @@ -169,7 +169,7 @@
" max_tokens=500,\n",
" )\n",
"\n",
" return response.choices[0].message['content']\n",
" return response.choices[0].message.content\n",
"\n",
"system_message = generate_system_message(prompt)\n",
"\n",
Expand Down Expand Up @@ -348,7 +348,7 @@
{
"cell_type": "code",
"source": [
"response = openai.ChatCompletion.create(\n",
"response = openai.chat.completions.create(\n",
" model=model_name,\n",
" messages=[\n",
" {\n",
Expand All @@ -362,7 +362,7 @@
" ],\n",
")\n",
"\n",
"response.choices[0].message['content']"
"response.choices[0].message.content"
],
"metadata": {
"id": "uxbrmzc5dMuC"
Expand All @@ -387,4 +387,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}