Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nuveraxgroup/openai-fine-tune-gpt-schema
OpenAI fine-tune GPTs JSON Schema validator
https://github.com/nuveraxgroup/openai-fine-tune-gpt-schema
finetune json json-schema jsonlines openai
Last synced: 3 months ago
JSON representation
OpenAI fine-tune GPTs JSON Schema validator
- Host: GitHub
- URL: https://github.com/nuveraxgroup/openai-fine-tune-gpt-schema
- Owner: nuveraxgroup
- Created: 2024-08-04T15:54:17.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-12T04:32:40.000Z (5 months ago)
- Last Synced: 2024-09-26T19:05:11.624Z (3 months ago)
- Topics: finetune, json, json-schema, jsonlines, openai
- Language: TypeScript
- Homepage: https://codesandbox.io/p/sandbox/openai-fine-tune-gpt-schema-xqmxws
- Size: 112 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OpenAI Fine-tune GPT JSON Schema
The file [gpt-3.5-4o.schema.json](gpt-3.5-4o.schema.json) allows us to validate JSON Lines object described on the next
[documentation](https://cookbook.openai.com/examples/chat_finetuning_data_prep) for fine-tunning using JSON Schema validators.## How to implement validation using Node.js
Install Ajv library
```shell
npm install ajv
```Run validation
```typescript
import Ajv from "ajv";const ajv = new Ajv();
const sampleData = {
messages: [
{ role: 'system', content: 'Marv is a factual...' },
{ role: 'user', content: 'Whats the...' },
{ role: 'assistant', content: 'Paris, as if...' }
]
};const gpt305And4oSchema = { /* Get schema from the repository or download locally */ }
const isDataValid = ajv.validate(
gpt305And4oSchema,
sampleData
);if (isDataValid) {
console.log( "Valid fine-tune sample for gpt3.5 or 4o-mini" );
} else {
console.error("Something is missing in your fine-tune sample:", ajv.errors);
}
```