def get_args_or_none(data): system_prompt = data.pop("system-prompt", "You are Gemma. Assist user with whatever they require, in a safe and moral manner.") inputs = data.pop("inputs", "") temperature = data.pop("temperature", None) if not temperature or temperature is None: temperature = data.pop("temp", 0.33) if temperature > 3 or temperature < 0: return { 0: False, "status": "error", "reason": "temperature", "reason": "invalid temperature ( 0.01 - 1.00 only allowed )" } top_p = data.pop("top-p", 0.85) if top_p > 3 or top_p < 0: return { 0: False, "status": "error", "reason": "top_p", "description": "invalid top percentage ( 0.01 - 1.00 only allowed )" } top_k = data.pop("top-k", 42) if top_k > 100 or top_k < 0: return { 0: False, "status": "error", "reason": "top_k", "description": "invalid top k ( 1 - 99 only allowed )" } return { 0: True, "inputs": inputs, "system_prompt": system_prompt, "temperature": temperature, "top_p": top_p, "top_k": top_k }