Synthetic data
Bootstrap a training set with a model. Describe the task and get several diverse, correctly-formatted JSONL examples you'd review and expand. Synthetic data won't beat real data, but it gets a dataset off the ground.
Showcase — Synthetic data
Bootstrap a training set with a model. Describe the task and get several diverse, correctly-formatted JSONL examples you'd review and expand. Synthetic data won't beat real data, but it gets a dataset off the ground.
Run
bash bootstrap-secrets.sh # reads ../../../../.env, writes secrets/
docker compose up --build # default: PROVIDER=openai
Open http://localhost:3000. Gemini: PROVIDER=gemini docker compose up --build.
What's where
backend/ai_openai.py/backend/ai_gemini.py— generate JSONL examples for a task spec.frontend/app/page.tsx— task description in, JSONL examples out.
Stop
docker compose down
Run locally
Download the project as a ZIP and run it with Docker. Brings up a FastAPI backend + Next.js frontend on localhost:3000.
unzip synthetic-data.zip
cd synthetic-data
bash bootstrap-secrets.sh # one-time: pulls API keys into ./secrets
docker compose up --build # default provider: openai
# or: PROVIDER=gemini docker compose up --build
Type some input, pick a provider, and run the same code shown in Source against the live API. Sign-in required.
The same modules the Run button hits. The whole project (frontend, Dockerfile, compose) is in the ZIP under README.
backend/ai_openai.py
"""Showcase 3 (OpenAI): generate training data with a model.
The chicken-and-egg of fine-tuning: you need hundreds of examples and you have a
handful. A capable model can bootstrap them. Describe the task and get several
diverse, correctly-formatted JSONL training examples you'd review and then
expand. Synthetic data won't beat real data, but it gets a dataset off the ground.
"""
from openai import OpenAI
_client = OpenAI()
_MODEL = "gpt-5.4-nano"
_PROMPT = (
"Generate 5 diverse fine-tuning examples for the task the user describes. "
"Output JSONL, one object per line, each: "
'{"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}. '
"Vary the inputs realistically. Output ONLY the JSONL, no prose."
)
def run(spec: str) -> str:
s = spec.strip()
if not s:
return "Describe the task you want training data for (e.g. 'classify support tickets by urgency')."
response = _client.responses.create(model=_MODEL, instructions=_PROMPT, input=[{"role": "user", "content": s}])
return response.output_text
backend/ai_gemini.py
"""Showcase 3 (Gemini): generate training data with a model.
Same synthetic-example generation, on Gemini.
"""
import os
from google import genai
from google.genai import types
_client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
_MODEL = "gemini-3.1-flash-lite"
_PROMPT = (
"Generate 5 diverse fine-tuning examples for the task the user describes. "
"Output JSONL, one object per line, each: "
'{"text_input": "...", "output": "..."}. '
"Vary the inputs realistically. Output ONLY the JSONL, no prose."
)
def run(spec: str) -> str:
s = spec.strip()
if not s:
return "Describe the task you want training data for (e.g. 'classify support tickets by urgency')."
response = _client.models.generate_content(
model=_MODEL,
contents=[types.Content(role="user", parts=[types.Part(text=s)])],
config=types.GenerateContentConfig(system_instruction=_PROMPT),
)
return response.text or ""
Project files
.gitignoreREADME.es.mdREADME.mdbackend/Dockerfilebackend/ai_gemini.pybackend/ai_openai.pybackend/main.pybackend/requirements.txtbootstrap-secrets.shdocker-compose.ymlfrontend/Dockerfilefrontend/app/layout.tsxfrontend/app/page.tsxfrontend/next.config.tsfrontend/package.jsonfrontend/tsconfig.json