from transformers import AutoModelForCausalLM, AutoTokenizer model_id = "./Qwen3.6-35B-A3B-Abliterated-Heretic-AWQ-4bit" model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype="auto", device_map="auto", trust_remote_code=True,)tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) # Define toolstools = [ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather for a location", "parameters": { "type": "object", "properties": { "location": {"type": "string", "description": "City name or coordinates"} }, "required": ["location"] } } }] messages = [ {"role": "system", "content": "You are a helpful assistant with weather lookup capabilities."}, {"role": "user", "content": "What's the weather in Tokyo?"}] text = tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True, tools=tools,) inputs = tokenizer(text, return_tensors="pt").to(model.device)outputs = model.generate(**inputs, max_new_tokens=512)result = tokenizer.decode(outputs[0], skip_special_tokens=True)print(result)# The model may output a tool call in XML format:# <function=get_weather>