tool=[ { "type": "function", "function": { "name": "get_current_temperature", "description": "Get current temperature at a location.", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The location to get the temperature for, in the format \"City, State, Country\"." }, "unit": { "type": "string", "enum": [ "celsius", "fahrenheit" ], "description": "The unit to return the temperature in. Defaults to \"celsius\"." } }, "required": [ "location" ] } } }, { "type": "function", "function": { "name": "get_temperature_date", "description": "Get temperature at a location and date.", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The location to get the temperature for, in the format \"City, State, Country\"." }, "date": { "type": "string", "description": "The date to get the temperature for, in the format \"Year-Month-Day\"." }, "unit": { "type": "string", "enum": [ "celsius", "fahrenheit" ], "description": "The unit to return the temperature in. Defaults to \"celsius\"." } }, "required": [ "location", "date" ] } } }]chat = [ {"role": "user", "content": "อุณหภูมิที่กรุงเทพเป็นเท่าไร"}] text = tokenizer.apply_chat_template( chat, tokenize=False, add_generation_prompt=True, tools=tool, enable_thinking=False # Switches between thinking and non-thinking modes. Default is True.).strip()model_inputs = tokenizer([text], return_tensors="pt").to(model.device) # conduct text completiongenerated_ids = model.generate( **model_inputs, max_new_tokens=4096)index=0output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() # thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=False).strip("\n")content = tokenizer.decode(output_ids[index:], skip_special_tokens=False).strip("\n") # print("thinking content:", thinking_content)print("content:", content)