Text Generation
Transformers
Safetensors
English
Hindi
gemma3_text
function-calling
tool-use
gemma
functiongemma
on-device
phone-assistant
hinglish
conversational
text-generation-inference
Instructions to use ankit-pn/functiongemma-270m-phone-assistant with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ankit-pn/functiongemma-270m-phone-assistant with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ankit-pn/functiongemma-270m-phone-assistant") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ankit-pn/functiongemma-270m-phone-assistant") model = AutoModelForCausalLM.from_pretrained("ankit-pn/functiongemma-270m-phone-assistant", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ankit-pn/functiongemma-270m-phone-assistant with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ankit-pn/functiongemma-270m-phone-assistant" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ankit-pn/functiongemma-270m-phone-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ankit-pn/functiongemma-270m-phone-assistant
- SGLang
How to use ankit-pn/functiongemma-270m-phone-assistant with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ankit-pn/functiongemma-270m-phone-assistant" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ankit-pn/functiongemma-270m-phone-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ankit-pn/functiongemma-270m-phone-assistant" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ankit-pn/functiongemma-270m-phone-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ankit-pn/functiongemma-270m-phone-assistant with Docker Model Runner:
docker model run hf.co/ankit-pn/functiongemma-270m-phone-assistant
Download tools.json from ankit-pn/functiongemma-270m-phone-assistant: direct link, hf CLI and curl.
- Browser
- Download file 8.51 kB
-
https://huggingface.co/ankit-pn/functiongemma-270m-phone-assistant/resolve/main/tools.json
- Command line
-
hf download hf://ankit-pn/functiongemma-270m-phone-assistant/tools.json
-
curl -L -o tools.json https://huggingface.co/ankit-pn/functiongemma-270m-phone-assistant/resolve/main/tools.json
8.51 kB
| [ | |
| {"type": "function", "function": { | |
| "name": "set_alarm", | |
| "description": "Sets an alarm on the phone for a clock time. Use for wake-up alarms or any alarm at a specific time.", | |
| "parameters": {"type": "object", "properties": { | |
| "time": {"type": "string", "description": "Alarm time in 24-hour HH:MM format, e.g. 06:30 or 18:00"}, | |
| "label": {"type": "string", "description": "Optional name for the alarm, e.g. gym"}, | |
| "repeat": {"type": "string", "enum": ["daily", "weekdays", "weekends"], "description": "Optional repeat schedule"} | |
| }, "required": ["time"]}}}, | |
| {"type": "function", "function": { | |
| "name": "cancel_alarm", | |
| "description": "Cancels, deletes or turns off alarms. Without a time it cancels all alarms.", | |
| "parameters": {"type": "object", "properties": { | |
| "time": {"type": "string", "description": "Time of the alarm to cancel in 24-hour HH:MM format. Omit to cancel all alarms."} | |
| }, "required": []}}}, | |
| {"type": "function", "function": { | |
| "name": "set_timer", | |
| "description": "Starts a countdown timer for a duration.", | |
| "parameters": {"type": "object", "properties": { | |
| "duration_seconds": {"type": "integer", "description": "Timer duration in seconds, e.g. 300 for 5 minutes"}, | |
| "label": {"type": "string", "description": "Optional name for the timer, e.g. pasta"} | |
| }, "required": ["duration_seconds"]}}}, | |
| {"type": "function", "function": { | |
| "name": "get_current_datetime", | |
| "description": "Returns the current local date, day of the week and time. Use when the user asks what time, day or date it is right now.", | |
| "parameters": {"type": "object", "properties": {}, "required": []}}}, | |
| {"type": "function", "function": { | |
| "name": "toggle_flashlight", | |
| "description": "Turns the phone flashlight (torch) on or off.", | |
| "parameters": {"type": "object", "properties": { | |
| "state": {"type": "string", "enum": ["on", "off"], "description": "Desired flashlight state"} | |
| }, "required": ["state"]}}}, | |
| {"type": "function", "function": { | |
| "name": "set_volume", | |
| "description": "Changes the phone media volume. Provide either an exact level or an action.", | |
| "parameters": {"type": "object", "properties": { | |
| "level": {"type": "integer", "description": "Exact volume level from 0 to 100"}, | |
| "action": {"type": "string", "enum": ["up", "down", "mute", "unmute"], "description": "Relative change or mute/unmute"} | |
| }, "required": []}}}, | |
| {"type": "function", "function": { | |
| "name": "set_brightness", | |
| "description": "Changes the screen brightness. Provide either an exact level or an action.", | |
| "parameters": {"type": "object", "properties": { | |
| "level": {"type": "integer", "description": "Exact brightness level from 0 to 100"}, | |
| "action": {"type": "string", "enum": ["up", "down"], "description": "Make the screen brighter (up) or dimmer (down)"} | |
| }, "required": []}}}, | |
| {"type": "function", "function": { | |
| "name": "toggle_wifi", | |
| "description": "Turns Wi-Fi on or off.", | |
| "parameters": {"type": "object", "properties": { | |
| "state": {"type": "string", "enum": ["on", "off"], "description": "Desired Wi-Fi state"} | |
| }, "required": ["state"]}}}, | |
| {"type": "function", "function": { | |
| "name": "toggle_bluetooth", | |
| "description": "Turns Bluetooth on or off.", | |
| "parameters": {"type": "object", "properties": { | |
| "state": {"type": "string", "enum": ["on", "off"], "description": "Desired Bluetooth state"} | |
| }, "required": ["state"]}}}, | |
| {"type": "function", "function": { | |
| "name": "get_weather", | |
| "description": "Gets the weather or forecast: temperature, rain, hot or cold, humidity. Location defaults to the user's current location.", | |
| "parameters": {"type": "object", "properties": { | |
| "location": {"type": "string", "description": "City or place name. Omit for the user's current location."}, | |
| "date": {"type": "string", "description": "Day of the forecast as the user said it, e.g. tomorrow, saturday. Omit for today/now."} | |
| }, "required": []}}}, | |
| {"type": "function", "function": { | |
| "name": "create_calendar_event", | |
| "description": "Creates a calendar event, meeting or appointment.", | |
| "parameters": {"type": "object", "properties": { | |
| "title": {"type": "string", "description": "Short event title"}, | |
| "date": {"type": "string", "description": "Event date as the user said it, e.g. tomorrow, next monday, 5 october"}, | |
| "time": {"type": "string", "description": "Start time in 24-hour HH:MM format"}, | |
| "duration_minutes": {"type": "integer", "description": "Optional event length in minutes"} | |
| }, "required": ["title", "date"]}}}, | |
| {"type": "function", "function": { | |
| "name": "set_reminder", | |
| "description": "Creates a reminder to do something at a time, on a date, or after a delay.", | |
| "parameters": {"type": "object", "properties": { | |
| "text": {"type": "string", "description": "What to remind the user about"}, | |
| "date": {"type": "string", "description": "Date as the user said it, e.g. tomorrow, friday. Omit if not given."}, | |
| "time": {"type": "string", "description": "Clock time in 24-hour HH:MM format. Omit if not given."}, | |
| "delay_minutes": {"type": "integer", "description": "Remind after this many minutes from now, for requests like 'in 20 minutes'"} | |
| }, "required": ["text"]}}}, | |
| {"type": "function", "function": { | |
| "name": "send_message", | |
| "description": "Sends a text message to a contact.", | |
| "parameters": {"type": "object", "properties": { | |
| "recipient": {"type": "string", "description": "Contact name as the user said it, e.g. mom, Rahul"}, | |
| "message": {"type": "string", "description": "The message body to send"}, | |
| "app": {"type": "string", "enum": ["sms", "whatsapp", "telegram"], "description": "Messaging app, only if the user names one"} | |
| }, "required": ["recipient", "message"]}}}, | |
| {"type": "function", "function": { | |
| "name": "make_call", | |
| "description": "Places a phone call or video call to a contact or number.", | |
| "parameters": {"type": "object", "properties": { | |
| "contact": {"type": "string", "description": "Contact name or phone number"}, | |
| "video": {"type": "boolean", "description": "true for a video call. Omit for a normal voice call."} | |
| }, "required": ["contact"]}}}, | |
| {"type": "function", "function": { | |
| "name": "open_app", | |
| "description": "Opens or launches an app on the phone.", | |
| "parameters": {"type": "object", "properties": { | |
| "app_name": {"type": "string", "description": "Name of the app, e.g. Instagram, Camera, Settings"} | |
| }, "required": ["app_name"]}}}, | |
| {"type": "function", "function": { | |
| "name": "play_music", | |
| "description": "Starts playing music: a song, artist, album, genre, playlist or mood.", | |
| "parameters": {"type": "object", "properties": { | |
| "query": {"type": "string", "description": "What to play, e.g. Arijit Singh, lofi, Bohemian Rhapsody. Omit for any music."} | |
| }, "required": []}}}, | |
| {"type": "function", "function": { | |
| "name": "media_control", | |
| "description": "Controls the media that is currently playing: pause, resume, skip to next, go to previous, or stop.", | |
| "parameters": {"type": "object", "properties": { | |
| "action": {"type": "string", "enum": ["pause", "resume", "next", "previous", "stop"], "description": "Playback action"} | |
| }, "required": ["action"]}}}, | |
| {"type": "function", "function": { | |
| "name": "navigate_to", | |
| "description": "Starts map navigation or directions to a destination.", | |
| "parameters": {"type": "object", "properties": { | |
| "destination": {"type": "string", "description": "Place or address to go to"}, | |
| "mode": {"type": "string", "enum": ["driving", "walking", "transit", "cycling"], "description": "Travel mode, only if the user says it"} | |
| }, "required": ["destination"]}}}, | |
| {"type": "function", "function": { | |
| "name": "web_search", | |
| "description": "Searches the web for information: facts, news, scores, prices, definitions, recipes, how-to questions, time in other cities.", | |
| "parameters": {"type": "object", "properties": { | |
| "query": {"type": "string", "description": "Concise search query"} | |
| }, "required": ["query"]}}}, | |
| {"type": "function", "function": { | |
| "name": "take_note", | |
| "description": "Saves a note with the given content.", | |
| "parameters": {"type": "object", "properties": { | |
| "content": {"type": "string", "description": "Text of the note"} | |
| }, "required": ["content"]}}} | |
| ] | |