{"id":26823939,"url":"https://github.com/romantech/openai-fine-tuning","last_synced_at":"2025-10-19T12:23:24.312Z","repository":{"id":191048628,"uuid":"683760156","full_name":"romantech/openai-fine-tuning","owner":"romantech","description":"OpenAI Fine-tuning for JSON Output","archived":false,"fork":false,"pushed_at":"2023-09-03T06:48:43.000Z","size":37,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-15T15:32:25.937Z","etag":null,"topics":["fine-tuning","nodejs","openai"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/romantech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-27T16:07:22.000Z","updated_at":"2024-04-08T01:11:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"73394d4f-88d4-4e11-b58a-e83ff5864e48","html_url":"https://github.com/romantech/openai-fine-tuning","commit_stats":null,"previous_names":["romantech/open-fine-tuning-node","romantech/open-ai-fine-tuning"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romantech%2Fopenai-fine-tuning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romantech%2Fopenai-fine-tuning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romantech%2Fopenai-fine-tuning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romantech%2Fopenai-fine-tuning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romantech","download_url":"https://codeload.github.com/romantech/openai-fine-tuning/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246296578,"owners_count":20754635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fine-tuning","nodejs","openai"],"created_at":"2025-03-30T09:17:13.159Z","updated_at":"2025-10-19T12:23:24.250Z","avatar_url":"https://github.com/romantech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAI Fine-tuning for JSON Output\n\n## Introduction\n\nThis project, written in JavaScript (Node.js), fine-tunes OpenAI's primary models to produce JSON-formatted output. It aims to enhance both cost-efficiency and data consistency for applications that utilize the OpenAI API. Portions of the codebase are inspired by the Python [open-finetuning](https://github.com/horosin/open-finetuning).\n\n\n## Prerequisites\n- Node.js 16 LTS or later\n- OpenAI Node v4\n\n## Usage\n\n### Step 1: Set OpenAI API Key Environment Variable\nDefine your OpenAI API key by setting an environment variable named `API_KEY`.\n```bash\nexport API_KEY=your-openai-api-key\n```\n\n### Step 2: Generate Sample Training Data\n- Execute `npm run prepare`.\n- Use a prompt capable of generating the desired output.\n- For optimal sample quality, it is recommended to use GPT-4.\n- OpenAI requires a minimum of `50` samples.\n- The sample data will be stored in `src/data/training-examples.json`.\n\n### Step 3: Generate System Message Formatting Data\n- Execute `npm run transform`.\n- Use a more straightforward prompt than the previous step.\n- The results will be saved in `src/data/training-data.jsonl`.\n\n### Step 4: Proceed with Fine-tuning\n- Execute `npm run finetune`.\n- Upon completion, the fine-tuned model ID will be displayed on the console.\n\n### Step 5: Test the Fine-tuned Model\n- Execute `npm run model`.\n- Test the model using a simplified version of the original prompt.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromantech%2Fopenai-fine-tuning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromantech%2Fopenai-fine-tuning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromantech%2Fopenai-fine-tuning/lists"}