Text Generation
Safetensors
GGUF
English
qwen3
function-calling
tool-calling
codex
local-llm
4gb-vram
llama-cpp
code-assistant
api-tools
openai-alternative
qwen
instruct
conversational
custom_code
8-bit precision
Instructions to use Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex", filename="Qwen3-4B-Function-Calling-Pro.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex # Run inference directly in the terminal: llama cli -hf Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex # Run inference directly in the terminal: llama cli -hf Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex # Run inference directly in the terminal: ./llama-cli -hf Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex # Run inference directly in the terminal: ./build/bin/llama-cli -hf Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex
Use Docker
docker model run hf.co/Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex
- LM Studio
- Jan
- vLLM
How to use Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex
- Ollama
How to use Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex with Ollama:
ollama run hf.co/Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex
- Unsloth Studio
How to use Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex to start chatting
- Atomic Chat new
- Docker Model Runner
How to use Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex with Docker Model Runner:
docker model run hf.co/Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex
- Lemonade
How to use Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Manojb/Qwen3-4b-toolcall-gguf-llamacpp-codex
Run and chat with the model
lemonade run user.Qwen3-4b-toolcall-gguf-llamacpp-codex-{{QUANT_TAG}}List all available models
lemonade list
| #!/usr/bin/env python3 | |
| """ | |
| Complete example of using Qwen3-4B-toolcalling model for function calling | |
| """ | |
| import json | |
| import re | |
| from llama_cpp import Llama | |
| class Qwen3ToolCalling: | |
| def __init__(self, model_path): | |
| """Initialize the Qwen3 tool calling model""" | |
| self.llm = Llama( | |
| model_path=model_path, | |
| n_ctx=2048, | |
| n_threads=8, | |
| n_batch=512, | |
| temperature=0.7, | |
| top_p=0.8, | |
| repeat_penalty=1.1, | |
| verbose=False, | |
| ) | |
| def extract_tool_calls(self, text): | |
| """Extract tool calls from model response""" | |
| tool_calls = [] | |
| # Look for JSON-like structures in the response | |
| json_pattern = r'\[.*?\]' | |
| matches = re.findall(json_pattern, text) | |
| for match in matches: | |
| try: | |
| parsed = json.loads(match) | |
| if isinstance(parsed, list): | |
| for item in parsed: | |
| if isinstance(item, dict) and 'name' in item: | |
| tool_calls.append(item) | |
| except json.JSONDecodeError: | |
| continue | |
| return tool_calls | |
| def chat(self, message, system_message=None): | |
| """Chat with the model and extract tool calls""" | |
| # Build the prompt | |
| prompt_parts = [] | |
| if system_message: | |
| prompt_parts.append(f"<|im_start|>system\n{system_message}<|im_end|>") | |
| prompt_parts.append(f"<|im_start|>user\n{message}<|im_end|>") | |
| prompt_parts.append("<|im_start|>assistant\n") | |
| formatted_prompt = "\n".join(prompt_parts) | |
| # Generate response | |
| response = self.llm( | |
| formatted_prompt, | |
| max_tokens=512, | |
| stop=["<|im_end|>", "<|im_start|>"], | |
| temperature=0.7 | |
| ) | |
| response_text = response['choices'][0]['text'] | |
| tool_calls = self.extract_tool_calls(response_text) | |
| return { | |
| 'response': response_text, | |
| 'tool_calls': tool_calls | |
| } | |
| def main(): | |
| """Main function to demonstrate tool calling""" | |
| # Initialize the model | |
| model_path = "/home/user/work/Qwen3-4B-toolcalling-gguf-codex/Qwen3-4B-Function-Calling-Pro.gguf" | |
| qwen = Qwen3ToolCalling(model_path) | |
| print("๐ Qwen3-4B Tool Calling Demo") | |
| print("=" * 50) | |
| # Test cases | |
| test_cases = [ | |
| "What's the weather like in London?", | |
| "Find me a hotel in Paris for next week", | |
| "Calculate 25 + 17", | |
| "Book a flight from New York to Tokyo", | |
| "Get the latest news about AI" | |
| ] | |
| for i, message in enumerate(test_cases, 1): | |
| print(f"\n๐ Test {i}: {message}") | |
| print("-" * 40) | |
| result = qwen.chat(message) | |
| print(f"Response: {result['response']}") | |
| if result['tool_calls']: | |
| print(f"\n๐ง Tool Calls ({len(result['tool_calls'])}):") | |
| for j, tool_call in enumerate(result['tool_calls'], 1): | |
| print(f" {j}. {tool_call['name']}") | |
| print(f" Arguments: {tool_call.get('arguments', {})}") | |
| else: | |
| print("\nโ No tool calls detected") | |
| if __name__ == "__main__": | |
| main() | |