This tool is published to GitHub pages by this link
A React-based tool for constructing fine-tuning datasets with list and grid forms, featuring the ability to download and upload data as JSONL files compatible with OpenAI's fine-tuning API. This project leverages the react-declarative library to create dynamic, interactive forms for defining user inputs, preferred outputs, non-preferred outputs, and chat history, complete with tool definitions and calls.
- Dynamic Form Interface: Create and edit dataset entries using a combination of list and grid layouts.
- Input Definition: Specify user input messages with configurable tools and parameters.
- Output Configuration: Define preferred and non-preferred outputs with content and associated tools.
- Tool Management: Add up to five tools per input/output with customizable arguments (name, type, description, enum, required status).
- Tool Name Autocomplete: When selecting tools, the UI provides autocomplete for tool names, pulling from defined input tools to streamline selection.
- Tool Enum Autocomplete: For arguments with enum values, the form offers autocomplete for predefined options, enhancing accuracy and speed.
- History with Tools: Include multi-turn conversational context with tool calls in history messages (currently supporting
tool1per message). - Data Persistence: Save changes to local storage and retrieve them by ID.
- JSONL Support: Import/export datasets as JSONL files with automatic generation of unique
tool_call_ids per OpenAI spec. - Material-UI Integration: Styled with Material-UI components for a modern, responsive UI.
- Breadcrumbs Navigation: Easy navigation with save, back, and draft actions.
- Validation: Robust checks for tool calls, message order, and history tool consistency.
- Performance Optimized: Uses Maps for O(1) lookups in validation and UI callbacks.
- Node.js (v16 or higher recommended)
- npm or yarn
- Basic familiarity with React and TypeScript
-
Clone the Repository:
git clone https://github.com/<your-username>/<your-repo-name>.git cd <your-repo-name>
-
Install Dependencies: Using npm:
npm install
Or using yarn:
yarn install
-
Run the Application:
npm start
Or with yarn:
yarn start
The app will be available at
http://localhost:3000.
-
Access a Dataset Entry:
- Create a new entry by using
+ Createbutton on a datagrid page - Navigate to an entry using datagrid
- Create a new entry by using
-
Edit Fields:
- Chat History: Add up to five messages with roles (user, assistant, system, tool) and content. Assistant messages can include a tool call (tool1).
- User Input: Enter message content and define up to five tools with parameters.
- Preferred Output: Specify response content and up to five tool calls with autocomplete for tool names and enum values.
- Non-Preferred Output: Define an alternative response.
-
Save Changes:
- Click "Save" in the breadcrumbs to persist to local storage, or "Save as Draft" to store temporarily.
- Use "Back" to return to the main page, with a confirmation if unsaved changes exist.
-
Export as JSONL:
- Press three dots on a gridview form and use
Export to jsonl
- Press three dots on a gridview form and use
-
Import JSONL:
- Press three dots on a gridview form and use
Import from jsonl
- Press three dots on a gridview form and use
-
Fine-Tune with OpenAI:
- Export your dataset and upload it:
openai api fine_tunes.create -t "path/to/your_dataset.jsonl" -m "base_model_name"
- Export your dataset and upload it:
src/OneView.tsx: Main component with form logic and UI.src/config/history.ts: Routing configuration.src/config/storage.ts: Storage logic for dataset persistence.src/config/draft.ts: Draft state management.src/validation/: Validation functions (validateToolCalls,validateMessageOrder,validateMessageTools).fields:TypedFieldarray defining the form structure.
@mui/icons-material: Material-UI icons.@mui/material: Material-UI components.lodash-es: Utility functions (e.g.,getfor safe property access).react-declarative: Declarative form-building library.
IStorageItem: Fine-tuning example withinput,preferred_output,non_preferred_output, andhistory.IToolDefinition: Tool spec with name, description, and up to five arguments.ITool: Tool call with name and up to five key-value arguments.IHistoryMessage: History message with role, content, and one tool call (tool1).
- Tool History: Supports tool calls in history, exported with unique
tool_call_ids. - Tool Name Autocomplete: In
createToolOutput, theitemListfor tool names dynamically lists available tools from input definitions, enabling quick selection with autocomplete. - Tool Enum Autocomplete: In
createToolOutputArgument, enum-based arguments provide a dropdown with autocomplete, sourced from tool definitions, improving data entry efficiency.
- Full JSONL UI: Add export/import buttons to
<Breadcrumbs2 />or<One />components. - Enhanced Validation: Expand validation rules.
- Backend: Replace local storage with an API.
- Multi-Tool History: Extend
IHistoryMessageto support multiple tools.
- Fork the repository.
- Create a branch (
git checkout -b feature/<feature-name>). - Commit changes (
git commit -m "Add <feature-name>"). - Push (
git push origin feature/<feature-name>). - Open a pull request.
MIT License - see LICENSE for details.
