Datos sintéticos
Arranca un set de entrenamiento con un modelo. Describe la tarea y recibe varios ejemplos JSONL diversos y correctamente formateados que revisarías y expandirías. Los datos sintéticos no le van a ganar a los datos reales, pero sí sacan un dataset del suelo.
Showcase — Datos sintéticos
Arranca un set de entrenamiento con un modelo. Describe la tarea y recibe varios ejemplos JSONL diversos y correctamente formateados que revisarías y expandirías. Los datos sintéticos no le van a ganar a los datos reales, pero sí sacan un dataset del suelo.
Córrelo
bash bootstrap-secrets.sh # reads ../../../../.env, writes secrets/
docker compose up --build # default: PROVIDER=openai
Abre http://localhost:3000. Gemini: PROVIDER=gemini docker compose up --build.
Qué hay aquí
backend/ai_openai.py/backend/ai_gemini.py— generan ejemplos JSONL para una spec de tarea.frontend/app/page.tsx— descripción de la tarea a la entrada, ejemplos JSONL a la salida.
Detenlo
docker compose down
Ejecútalo en tu máquina
Descarga el proyecto como ZIP y córrelo con Docker. Levanta un backend FastAPI y un frontend Next.js en 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
Escribe algo, elige un proveedor y ejecuta el mismo código de Código contra la API real. Requiere iniciar sesión.
Los mismos módulos que ejecuta el botón Run. El proyecto completo (frontend, Dockerfile, compose) está en el ZIP, pestaña 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 ""
Archivos del proyecto
.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