Views
No views yet
get_steps() - Retrieve today's step countget_daily_step_goal() - Get the user's daily step goalget_goal_progress() - Calculate progress toward step goalget_sleeping_minutes() - Get sleep durationget_active_minutes() - Get active minutes countget_heart_rate() - Get current heart rateget_body_battery_level() - Get body battery level (energy/fatigue indicator)1LoraConfig(
2 r=32,
3 lora_alpha=64,
4 lora_dropout=0.05,
5 target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
6 task_type="CAUSAL_LM"
7)xla_fsdp_grad_ckptpip install transformers peft torch1import peft # This import will enable automatic loading from adapters
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4# Load model
5model = AutoModelForCausalLM.from_pretrained("tengomucho/functiongemma-fitness-coach")
6
7# Load tokenizer
8tokenizer = AutoTokenizer.from_pretrained("google/functiongemma-270m-it")1import json
2
3# Define your fitness functions
4tools = [
5 {
6 "type": "function",
7 "function": {
8 "name": "get_steps",
9 "description": "Get the number of steps taken today",
10 "parameters": {"type": "object", "properties": {}}
11 }
12 },
13 {
14 "type": "function",
15 "function": {
16 "name": "get_heart_rate",
17 "description": "Get the current heart rate",
18 "parameters": {"type": "object", "properties": {}}
19 }
20 }
21 # ... add other functions
22]
23
24# Create conversation
25messages = [
26 {
27 "role": "developer",
28 "content": "You are a fitness coach assistant that helps users track their health and fitness data."
29 },
30 {
31 "role": "user",
32 "content": "How many steps have I taken today?"
33 }
34]
35
36# Format input
37input_text = tokenizer.apply_chat_template(
38 messages,
39 tools=tools,
40 tokenize=False,
41 add_generation_prompt=True
42)
43
44# Generate
45inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
46outputs = model.generate(**inputs, max_new_tokens=128)
47response = tokenizer.decode(outputs[0], skip_special_tokens=True)
48
49print(response)
50# Expected output: {"name": "get_steps", "arguments": {}}