---
license: cc-by-4.0
---
[🏠Homepage] | [📄 Paper] | [📚 Dataset]
## Model Summary
This repo provides the GGUF format for the xLAM-1B-FC-r model. Here's a link to original model [xLAM-1B-FC-r](https://huggingface.co/agentstudio-family/xLAM-1B-FC-r)
This model is designed for function composition and tool utilization tasks, providing fast, accurate, and structured responses based on the input queries and available tools.
We use [llama.cpp](https://github.com/ggerganov/llama.cpp) framework to convert models to GGUF. GGUF model files offer significant advantages in terms of interoperability, efficiency, scalability, flexibility, and ease of use. They are particularly valuable in applications requiring efficient model deployment, sharing, and optimization across diverse platforms and hardware environments.
## Model Overview
The `xLAM-1B-FC-r` model is a fine-tuned version of [deepseek-ai/deepseek-coder-1.3b-instruct](https://huggingface.co/deepseek-ai/deepseek-coder-1.3b-instruct), optimized for tasks that require composing functions and utilizing tools to answer queries. For more details, check our [paper](https://arxiv.org/abs/2406.18518).
## How to download GGUF files
1. **Install Hugging Face CLI:**
```
pip install huggingface-hub>=0.17.1
```
2. **Login to Hugging Face:**
```
huggingface-cli login
```
3. **Download the GGUF model:**
```
huggingface-cli download agentstudio-family/xLAM-1b-fc-gguf-r xLAM-1B-FC-r.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
```
## Prompt template
```
You are an AI assistant for function calling.For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer
### Instruction:
[BEGIN OF TASK INSTRUCTION]
{task_instruction}
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE TOOLS]
{xlam_format_tools}
[END OF AVAILABLE TOOLS]
[BEGIN OF FORMAT INSTRUCTION]
{format_instruction}
[END OF FORMAT INSTRUCTION]
[BEGIN OF QUERY]
{query}
[END OF QUERY]
### Response:
```
For more information, refer to [prompt-documentation](https://huggingface.co/agentstudio-family/xLAM-1B-FC-r#basic-usage-with-huggingface)
## Usage
### Command Line
1. Install llama.cpp framework from the source [here](https://github.com/ggerganov/llama.cpp)
2. Run the inference task as below, to configure generation related paramter, refer to [llama.cpp](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
```
./llama-cli -m [PATH-TO-LOCAL-GGUF] -p "[PROMPT]"
```
3. Example
```
./llama-cli -m xLAM-1B-FC-r.Q8_0.gguf -p "You are an AI assistant for function calling.For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer\n### Instruction:\n[BEGIN OF TASK INSTRUCTION]\nYou are an expert in composing functions. You are given a question and a set of possible functions.\nBased on the question, you will need to make one or more function/tool calls to achieve the purpose.\nIf none of the functions can be used, point it out and refuse to answer.\nIf the given question lacks the parameters required by the function, also point it out.\n[END OF TASK INSTRUCTION]\n\n[BEGIN OF AVAILABLE TOOLS]\n{\"name\": \"get_weather\", \"description\": \"Get the current weather for a location\", \"parameters\": {\"location\": {\"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\"}, \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"], \"description\": \"The unit of temperature to return\"}}}\n[END OF AVAILABLE TOOLS]\n\n[BEGIN OF FORMAT INSTRUCTION]\nThe output MUST strictly adhere to the following JSON format, and NO other text MUST be included.\nThe example format is as follows. Please make sure the parameter type is correct. If no function call is needed, please make tool_calls an empty list '[]'\n```\n{\n \"tool_calls\": [\n {\"name\": \"func_name1\", \"arguments\": {\"argument1\": \"value1\", \"argument2\": \"value2\"}},\n ... (more tool calls as required)\n ]\n}\n```\n[END OF FORMAT INSTRUCTION]\n\n[BEGIN OF QUERY]\nWhat's the weather forecast for Tokyo?\n[END OF QUERY]\n\n\n### Response:"
```
### Python framwork
1. Install [llama-cpp-python](https://github.com/abetlen/llama-cpp-python)
```
pip install llama-cpp-python
```
2. Refer to [llama-cpp-API](https://github.com/abetlen/llama-cpp-python?tab=readme-ov-file#high-level-api), here's a example below
```python
from llama_cpp import Llama
llm = Llama(
model_path="[PATH-TO-MODEL]"
)
output = llm(
"You are an AI assistant for function calling.For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer\n### Instruction:\n[BEGIN OF TASK INSTRUCTION]\nYou are an expert in composing functions. You are given a question and a set of possible functions.\nBased on the question, you will need to make one or more function/tool calls to achieve the purpose.\nIf none of the functions can be used, point it out and refuse to answer.\nIf the given question lacks the parameters required by the function, also point it out.\n[END OF TASK INSTRUCTION]\n\n[BEGIN OF AVAILABLE TOOLS]\n{\"name\": \"get_weather\", \"description\": \"Get the current weather for a location\", \"parameters\": {\"location\": {\"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\"}, \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"], \"description\": \"The unit of temperature to return\"}}}\n[END OF AVAILABLE TOOLS]\n\n[BEGIN OF FORMAT INSTRUCTION]\nThe output MUST strictly adhere to the following JSON format, and NO other text MUST be included.\nThe example format is as follows. Please make sure the parameter type is correct. If no function call is needed, please make tool_calls an empty list '[]'\n```\n{\n \"tool_calls\": [\n {\"name\": \"func_name1\", \"arguments\": {\"argument1\": \"value1\", \"argument2\": \"value2\"}},\n ... (more tool calls as required)\n ]\n}\n```\n[END OF FORMAT INSTRUCTION]\n\n[BEGIN OF QUERY]\nWhat's the weather forecast for Tokyo?\n[END OF QUERY]\n\n\n### Response:",
echo=True # Echo the prompt back in the output
) # Generate a completion, can also call create_completion
print(output)
```