Prototype: votes, saves, and profiles aren't stored on this hosted preview yet. No real accounts, and no emails or texts. Privacy

Recipes / Tool-calling & booking agents

Teach a model to call functions with xLAM data (HF Cookbook)

A model such as Qwen2-7B-Instruct fine-tuned with QLoRA on 60,000 function-calling examples, so it returns clean tool calls.

  • Gated
  • Custom license

Source: HF Cookbook ↗ · by Behrooz Azarkhalili · last updated Jan 9, 2026

What a local business could build with it

The backbone of a booking or order agent: the model decides to call 'check_availability' or 'create_appointment' with the right fields. You still build and permission the tools.

Booking is merged into tool-calling: no source we found trains a booking agent as such, and a booking agent is a model that calls scheduling tools correctly.

How to run it

Commands are copied from the source, unchanged except where a notebook cell is cut at 40 lines (marked in the code). Placeholders like <you> are the source's own. Credit goes to the authors named on each block.

Install (as written in the notebook)

# Install required packages for function calling fine-tuning # !uv pip install --upgrade bitsandbytes peft trl python-dotenv

From HF Cookbook, function_calling_fine_tuning_llms_on_xlam ↗

Set up training

# Universal fine-tuning pipeline - works with any model! print(f"🚀 Starting fine-tuning pipeline for {model_config.model_name}") # Step 1: Setup tokenizer print(f"\n📝 Setting up tokenizer...") tokenizer = setup_tokenizer(model_config) # Step 2: Load and process dataset print(f"\n📊 Loading and processing xLAM dataset...") dataset = load_and_process_xlam_dataset(tokenizer, sample_size=None) # Set sample_size for testing # Step 3: Preview dataset sample print(f"\n👀 Dataset sample preview:") preview_dataset_sample(dataset, index=0) # Step 4: Create QLoRA model print(f"\n🏗️ Creating QLoRA model...") model = create_qlora_model( model_config, tokenizer, compute_dtype, attn_implementation ) # Step 5: Execute training print(f"\n🎯 Starting training...") trainer = train_qlora_model( dataset=dataset, model=model, training_config=training_config, compute_dtype=compute_dtype ) print(f"\n🎉 Fine-tuning completed for {model_config.model_name.split('/')[-1]}!") print(f"📁 Model saved to: {training_config.output_dir}") print(f"🔍 To test the model, run the inference cells below")

From HF Cookbook, function_calling_fine_tuning_llms_on_xlam ↗

Train

def train_qlora_model(dataset: Dataset, model: AutoModelForCausalLM, training_config: TrainingConfig, compute_dtype: torch.dtype) -> SFTTrainer: """ Execute QLoRA fine-tuning with comprehensive configuration and monitoring. Args: dataset (Dataset): Processed training dataset model (AutoModelForCausalLM): QLoRA-configured model training_config (TrainingConfig): Training hyperparameters compute_dtype (torch.dtype): Computation data type Returns: SFTTrainer: Trained model trainer Training Features: - Supervised fine-tuning with SFTTrainer - Memory-optimized settings for consumer GPUs - Comprehensive logging and checkpointing - Automatic mixed precision training """ print("🚀 Starting QLoRA fine-tuning...") # Create LoRA configuration peft_config = create_lora_config(training_config) # Configure training arguments training_arguments = SFTConfig( output_dir=training_config.output_dir, optim="adamw_8bit", # 8-bit optimizer for memory efficiency per_device_train_batch_size=training_config.batch_size, gradient_accumulation_steps=training_config.gradient_accumulation_steps, log_level="info", # Detailed logging save_steps=training_config.save_steps, logging_steps=training_config.logging_steps, learning_rate=training_config.learning_rate, fp16=compute_dtype == torch.float16, # Use FP16 if not using bfloat16 bf16=compute_dtype == torch.bfloat16, # Use bfloat16 if supported max_steps=training_config.max_steps, # … (cell continues in the source notebook)

From HF Cookbook, function_calling_fine_tuning_llms_on_xlam ↗

Licenses

License flags to read before commercial use:

  • Model: Custom license: read it before commercial use. Qwen2-7B: Apache-2.0. Other listed models carry their own licenses (e.g. Llama 3)
  • Dataset: Gated: accept the terms on Hugging Face first. CC BY 4.0, gated: accept terms on Hugging Face
PartLicense, as the source or Hub states it
CodeApache-2.0 (huggingface/cookbook)
Base modelQwen2-7B: Apache-2.0. Other listed models carry their own licenses (e.g. Llama 3)
DatasetCC BY 4.0, gated: accept terms on Hugging Face

Checked against the Hugging Face API and each repo on December 4, 2026. A grouping like “$10M revenue cap” is our shorthand, not legal advice.