"""Directly paraphrase concrete training scenarios, keeping the original reference action.""" import argparse import concurrent.futures import json import random import re import time import urllib.request from pathlib import Path from tinyquery.data import compact,serialize from tinyquery.recipes import LANGUAGES def paraphrase(row,base,seed): task={'schema':row['context']['schema'],'backend':row['backend'],'reference_request':row['question'], 'reference_action':row['target']} prompt=('Write one natural user request in each of four styles that has exactly the reference meaning. ' 'Use conversational phrasing, not instructions about writing SQL. Keep every numeric bound, ' 'literal value, selected field, sorting and limit unchanged. Do not add a new condition. ' 'You may use ordinary English/Hindi words for obvious schema fields, but preserve database ' 'literal values exactly. Output JSON keys en, noisy_en, hi, hinglish with string values. ' 'hi must be Devanagari Hindi, hinglish Romanized Hindi, noisy_en imperfect English. Task: '+compact(task)) payload={'model':'Qwen/Qwen3.8-27B-FP8','messages':[{'role':'user','content':prompt}], 'max_tokens':500,'temperature':.7,'seed':seed,'response_format':{'type':'json_object'}, 'chat_template_kwargs':{'enable_thinking':False}} request=urllib.request.Request(base+'/chat/completions',data=compact(payload).encode(),headers={'Content-Type':'application/json'}) with urllib.request.urlopen(request,timeout=180) as response: result=json.load(response) parsed=json.loads(result['choices'][0]['message']['content']) accepted=[] for lang in LANGUAGES: question=parsed.get(lang) if not isinstance(question,str) or not 5