Views
No views yet


| Model | # Total Params | Context Length | Category | Download Model | Download GGUF files |
|---|---|---|---|---|---|
| Llama-xLAM-2-70b-fc-r | 70B | 128k | Multi-turn Conversation, Function-calling | 🤗 Link | NA |
| Llama-xLAM-2-8b-fc-r | 8B | 128k | Multi-turn Conversation, Function-calling | 🤗 Link | 🤗 Link |
| xLAM-2-32b-fc-r | 32B | 32k (max 128k)* | Multi-turn Conversation, Function-calling | 🤗 Link | NA |
| xLAM-2-3b-fc-r | 3B | 32k (max 128k)* | Multi-turn Conversation, Function-calling | 🤗 Link | 🤗 Link |
| xLAM-2-1b-fc-r | 1B | 32k (max 128k)* | Multi-turn Conversation, Function-calling | 🤗 Link | 🤗 Link |
-fc suffix indicates that the models are fine-tuned for function calling tasks, while the -r suffix signifies a research release.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4tokenizer = AutoTokenizer.from_pretrained("Salesforce/Llama-xLAM-2-3b-fc-r")
5model = AutoModelForCausalLM.from_pretrained("Salesforce/Llama-xLAM-2-3b-fc-r", torch_dtype=torch.bfloat16, device_map="auto")
6
7# Example conversation with a tool call
8messages = [
9 {"role": "user", "content": "Hi, how are you?"},
10 {"role": "assistant", "content": "Thanks. I am doing well. How can I help you?"},
11 {"role": "user", "content": "What's the weather like in London?"},
12]
13
14tools = [
15 {
16 "name": "get_weather",
17 "description": "Get the current weather for a location",
18 "parameters": {
19 "type": "object",
20 "properties": {
21 "location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"},
22 "unit": {"type": "string", "enum": ["celsius", "fahrenheit"], "description": "The unit of temperature to return"}
23 },
24 "required": ["location"]
25 }
26 }
27]
28
29print("====== prompt after applying chat template ======")
30print(tokenizer.apply_chat_template(messages, tools=tools, add_generation_prompt=True, tokenize=False))
31
32inputs = tokenizer.apply_chat_template(messages, tools=tools, add_generation_prompt=True, return_dict=True, return_tensors="pt")
33input_ids_len = inputs["input_ids"].shape[-1] # Get the length of the input tokens
34inputs = {k: v.to(model.device) for k, v in inputs.items()}
35print("====== model response ======")
36outputs = model.generate(**inputs, max_new_tokens=256)
37generated_tokens = outputs[:, input_ids_len:] # Slice the output to get only the newly generated tokens
38print(tokenizer.decode(generated_tokens[0], skip_special_tokens=True))vllm>=0.6.5 since earlier versions will cause degraded performance for Qwen-based models.pip install "vllm>=0.6.5"wget https://huggingface.co/Salesforce/xLAM-2-1b-fc-r/raw/main/xlam_tool_call_parser.py1vllm serve Salesforce/xLAM-2-1b-fc-r \
2 --enable-auto-tool-choice \
3 --tool-parser-plugin ./xlam_tool_call_parser.py \
4 --tool-call-parser xlam \
5 --tensor-parallel-size 1--tool-parser-plugin correctly points to your local copy of the file. The xLAM series models all utilize the same tool call parser, so you only need to download it once for all models.1import openai
2import json
3
4# Configure the client to use your local vLLM endpoint
5client = openai.OpenAI(
6 base_url="http://localhost:8000/v1", # Default vLLM server URL
7 api_key="empty" # Can be any string
8)
9
10# Define a tool/function
11tools = [
12 {
13 "type": "function",
14 "function": {
15 "name": "get_weather",
16 "description": "Get the current weather for a location",
17 "parameters": {
18 "type": "object",
19 "properties": {
20 "location": {
21 "type": "string",
22 "description": "The city and state, e.g. San Francisco, CA"
23 },
24 "unit": {
25 "type": "string",
26 "enum": ["celsius", "fahrenheit"],
27 "description": "The unit of temperature to return"
28 }
29 },
30 "required": ["location"]
31 }
32 }
33 }
34]
35
36# Create a chat completion
37response = client.chat.completions.create(
38 model="Salesforce/xLAM-2-1b-fc-r", # Model name doesn't matter, vLLM uses the served model
39 messages=[
40 {"role": "system", "content": "You are a helpful assistant that can use tools."},
41 {"role": "user", "content": "What's the weather like in San Francisco?"}
42 ],
43 tools=tools,
44 tool_choice="auto"
45)
46
47# Print the response
48print("Assistant's response:")
49print(json.dumps(response.model_dump(), indent=2))


1@article{prabhakar2025apigen,
2 title={APIGen-MT: Agentic PIpeline for Multi-Turn Data Generation via Simulated Agent-Human Interplay},
3 author={Prabhakar, Akshara and Liu, Zuxin and Zhu, Ming and Zhang, Jianguo and Awalgaonkar, Tulika and Wang, Shiyu and Liu, Zhiwei and Chen, Haolin and Hoang, Thai and others},
4 journal={arXiv preprint arXiv:2504.03601},
5 year={2025}
6}1@article{zhang2025actionstudio,
2 title={ActionStudio: A Lightweight Framework for Data and Training of Action Models},
3 author={Zhang, Jianguo and Hoang, Thai and Zhu, Ming and Liu, Zuxin and Wang, Shiyu and Awalgaonkar, Tulika and Prabhakar, Akshara and Chen, Haolin and Yao, Weiran and Liu, Zhiwei and others},
4 journal={arXiv preprint arXiv:2503.22673},
5 year={2025}
6}1@article{zhang2024xlam,
2 title={xLAM: A Family of Large Action Models to Empower AI Agent Systems},
3 author={Zhang, Jianguo and Lan, Tian and Zhu, Ming and Liu, Zuxin and Hoang, Thai and Kokane, Shirley and Yao, Weiran and Tan, Juntao and Prabhakar, Akshara and Chen, Haolin and others},
4 journal={arXiv preprint arXiv:2409.03215},
5 year={2024}
6}
71@article{liu2024apigen,
2 title={Apigen: Automated pipeline for generating verifiable and diverse function-calling datasets},
3 author={Liu, Zuxin and Hoang, Thai and Zhang, Jianguo and Zhu, Ming and Lan, Tian and Tan, Juntao and Yao, Weiran and Liu, Zhiwei and Feng, Yihao and RN, Rithesh and others},
4 journal={Advances in Neural Information Processing Systems},
5 volume={37},
6 pages={54463--54482},
7 year={2024}
8}1@article{zhang2024agentohana,
2 title={AgentOhana: Design Unified Data and Training Pipeline for Effective Agent Learning},
3 author={Zhang, Jianguo and Lan, Tian and Murthy, Rithesh and Liu, Zhiwei and Yao, Weiran and Tan, Juntao and Hoang, Thai and Yang, Liangwei and Feng, Yihao and Liu, Zuxin and others},
4 journal={arXiv preprint arXiv:2402.15506},
5 year={2024}
6}