Views
No views yet
gemma-3-270m-it-function-tuned-202510212042system_prompt_format.txt file, which defines the exact prompt structure the model was trained on.{tool_descriptions} placeholder should be replaced with the list of tools available for a given task.1You are a function calling AI model. Given a user query, the following tools are available:
2{tool_descriptions}
3Respond with only the JSON object for the correct tool call.google/gemma-3-270m-it0%broadfield-dev/gemma-3-refined-tool-data-1761067929instructionoutputsystem_prompt_format.txt file and inject your tool definitions into the {tool_descriptions} placeholder.
Example:1from transformers import AutoTokenizer, AutoModelForCausalLM
2from huggingface_hub import hf_hub_download
3import json
4
5repo_id = "broadfield-dev/gemma-3-270m-it-function-tuned-202510212042"
6tokenizer = AutoTokenizer.from_pretrained(repo_id)
7model = AutoModelForCausalLM.from_pretrained(repo_id)
8
9# Load the prompt template from the Hub
10prompt_template_path = hf_hub_download(repo_id=repo_id, filename="system_prompt_format.txt")
11with open(prompt_template_path, 'r') as f:
12 prompt_template = f.read()
13
14# Define your tools and format them as a string
15my_tools_string = "- Tool: \`search\`\n - Description: Searches the web.\n - Arguments: {"query": {"type": "string"}}"
16system_prompt = prompt_template.format(tool_descriptions=my_tools_string)
17
18instruction = "What is the weather in New York?"
19chat = [
20 {"role": "system", "content": system_prompt},
21 {"role": "user", "content": instruction},
22]
23
24prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
25inputs = tokenizer(prompt, return_tensors="pt")
26outputs = model.generate(**inputs, max_new_tokens=100)
27print(tokenizer.decode(outputs[inputs.input_ids.shape[-1]:], skip_special_tokens=True))