Documentation Index
Fetch the complete documentation index at: https://docs.veri.studio/llms.txt
Use this file to discover all available pages before exploring further.
This example is for teams that need model responses to follow a strict schema. Start with supervised examples, then add a reward function that checks parseability, required keys, and tool selection.
Dataset Shape
Use JSONL records with an instruction and the expected structured response:
{"prompt":"Book a meeting with Maya tomorrow afternoon.","response":"{\"tool\":\"create_calendar_event\",\"arguments\":{\"attendee\":\"Maya\",\"date\":\"tomorrow\",\"time_range\":\"afternoon\"}}"}
Reward Function
Reward responses that parse as JSON, include the right tool name, and provide all required arguments.
import json
def reward(prompt, completion, reference=None):
try:
parsed = json.loads(completion)
except json.JSONDecodeError:
return 0.0
required = {"tool", "arguments"}
if not required.issubset(parsed):
return 0.2
return 1.0 if parsed["tool"] == "create_calendar_event" else 0.5
Launch
Create a training job with the dataset and reward function IDs from your Veri dashboard.
curl -X POST https://api.veri.studio/v1/training_jobs \
-H "Authorization: Bearer $VERI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"base_model": "Qwen/Qwen3-4B",
"dataset_id": "ds_function_calls",
"reward_function_id": "rf_json_tools",
"output_name": "function-calling-assistant",
"gpu": { "gpu_type": "A100-80GB", "gpu_count": 1 }
}'
Keep the first run small. Once schema validity is stable, add more tool types and harder prompts.