{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import json\n", "\n", "# Save formatted_data as JSONL\n", "with open(\"mydata.jsonl\", \"w\") as outfile:\n", " for entry in formatted_data:\n", " json.dump(entry, outfile)\n", " outfile.write(\"\\n\")\n", "\n", "# Now use it in the provided code\n", "import os\n", "import openai\n", "\n", "openai.api_key = '' ##add API key here\n", "openai.File.create(\n", " file=open(\"mydata.jsonl\", \"rb\"),\n", " purpose='fine-tune'\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "openai.FineTuningJob.create(training_file=\"file-XMpA2lwxpHwIdUYU8GehdT4C\", model=\"gpt-3.5-turbo\")\n", "#training file will need to be updated with the id from the upload once complete" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 }