tools_schema = """[ { "type": "function", "function": { "name": "query_database", "description": "Execute a structured SQL query against the production telemetry database.", "parameters": { "type": "object", "properties": { "table": {"type": "string", "description": "Target database table"}, "filter": {"type": "string", "description": "SQL WHERE clause filter"} }, "required": ["table", "filter"] } } }]""" messages = [ {"role": "system", "content": f"You are an agent with access to external tools. Available tools:\n{tools_schema}"}, {"role": "user", "content": "Check all failed authentication events in the audit_logs table from the last 2 hours."}] prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)inputs = tokenizer(prompt, return_tensors="pt").to(model.device) with torch.no_grad(): outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.1) print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))# Expected Output: <tool_call> {"name": "query_database", "arguments": {"table": "audit_logs", "filter": "status = 'FAILED' AND timestamp >= NOW() - INTERVAL 2 HOUR"}} </tool_call>