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 | |
| """ | |
| Codex Integration Example for Qwen3-4B Tool Calling | |
| This script demonstrates how to use the model with Codex | |
| """ | |
| import requests | |
| import json | |
| import time | |
| from typing import List, Dict, Any, Optional | |
| class CodexClient: | |
| """Client for interacting with Codex-compatible server""" | |
| def __init__(self, base_url: str = "http://localhost:8000"): | |
| self.base_url = base_url | |
| self.session = requests.Session() | |
| self.model_name = "Qwen3-4B-Function-Calling-Pro" | |
| def chat_completion(self, messages: List[Dict[str, str]], tools: Optional[List[Dict]] = None, | |
| temperature: float = 0.7, max_tokens: int = 512) -> Dict[str, Any]: | |
| """Send chat completion request to Codex server""" | |
| payload = { | |
| "model": self.model_name, | |
| "messages": messages, | |
| "temperature": temperature, | |
| "max_tokens": max_tokens, | |
| "stop": ["<|im_end|>", "<|im_start|>", "<tool_call>", "</tool_call>"] | |
| } | |
| if tools: | |
| payload["tools"] = tools | |
| try: | |
| response = self.session.post( | |
| f"{self.base_url}/v1/chat/completions", | |
| json=payload, | |
| headers={"Content-Type": "application/json"}, | |
| timeout=60 | |
| ) | |
| response.raise_for_status() | |
| return response.json() | |
| except requests.exceptions.RequestException as e: | |
| print(f"Error making request: {e}") | |
| return {"error": str(e)} | |
| def extract_tool_calls(self, response: Dict[str, Any]) -> List[Dict[str, Any]]: | |
| """Extract tool calls from Codex response""" | |
| tool_calls = [] | |
| if "choices" in response and len(response["choices"]) > 0: | |
| message = response["choices"][0]["message"] | |
| if "tool_calls" in message: | |
| tool_calls = message["tool_calls"] | |
| return tool_calls | |
| def is_server_running(self) -> bool: | |
| """Check if the Codex server is running""" | |
| try: | |
| response = self.session.get(f"{self.base_url}/health", timeout=5) | |
| return response.status_code == 200 | |
| except: | |
| return False | |
| def demo_codex_integration(): | |
| """Demonstrate Codex integration""" | |
| print("π Codex Integration Demo") | |
| print("=" * 50) | |
| # Initialize client | |
| codex = CodexClient() | |
| # Check if server is running | |
| if not codex.is_server_running(): | |
| print("β Codex server is not running!") | |
| print("π‘ Start the server with: ./run_model.sh server") | |
| return | |
| print("β Connected to Codex server") | |
| # Define tools for Codex | |
| tools = [ | |
| { | |
| "type": "function", | |
| "function": { | |
| "name": "get_weather", | |
| "description": "Get current weather for a location", | |
| "parameters": { | |
| "type": "object", | |
| "properties": { | |
| "location": { | |
| "type": "string", | |
| "description": "City name or location" | |
| } | |
| }, | |
| "required": ["location"] | |
| } | |
| } | |
| }, | |
| { | |
| "type": "function", | |
| "function": { | |
| "name": "search_hotels", | |
| "description": "Search for hotels in a city", | |
| "parameters": { | |
| "type": "object", | |
| "properties": { | |
| "city": { | |
| "type": "string", | |
| "description": "City name" | |
| }, | |
| "check_in": { | |
| "type": "string", | |
| "description": "Check-in date (YYYY-MM-DD)" | |
| }, | |
| "check_out": { | |
| "type": "string", | |
| "description": "Check-out date (YYYY-MM-DD)" | |
| } | |
| }, | |
| "required": ["city"] | |
| } | |
| } | |
| }, | |
| { | |
| "type": "function", | |
| "function": { | |
| "name": "calculate", | |
| "description": "Perform mathematical calculations", | |
| "parameters": { | |
| "type": "object", | |
| "properties": { | |
| "expression": { | |
| "type": "string", | |
| "description": "Mathematical expression to evaluate" | |
| } | |
| }, | |
| "required": ["expression"] | |
| } | |
| } | |
| } | |
| ] | |
| # Test cases | |
| test_cases = [ | |
| "What's the weather like in London?", | |
| "Find me a hotel in Paris for next week", | |
| "Calculate 25 + 17", | |
| "Get weather for New York and find hotels there" | |
| ] | |
| for i, message in enumerate(test_cases, 1): | |
| print(f"\nπ Test {i}: {message}") | |
| print("-" * 40) | |
| # Send request | |
| messages = [{"role": "user", "content": message}] | |
| response = codex.chat_completion(messages, tools=tools) | |
| if "error" in response: | |
| print(f"β Error: {response['error']}") | |
| continue | |
| # Extract response | |
| if "choices" in response and len(response["choices"]) > 0: | |
| assistant_message = response["choices"][0]["message"] | |
| print(f"Response: {assistant_message.get('content', 'No content')}") | |
| # Check for tool calls | |
| tool_calls = codex.extract_tool_calls(response) | |
| if tool_calls: | |
| print(f"\nπ§ Tool Calls ({len(tool_calls)}):") | |
| for j, tool_call in enumerate(tool_calls, 1): | |
| print(f" {j}. {tool_call['function']['name']}") | |
| print(f" Arguments: {tool_call['function'].get('arguments', {})}") | |
| else: | |
| print("\nβ No tool calls detected") | |
| else: | |
| print("β No response received") | |
| def interactive_codex_chat(): | |
| """Interactive chat with Codex server""" | |
| print("π¬ Interactive Codex Chat") | |
| print("=" * 50) | |
| codex = CodexClient() | |
| if not codex.is_server_running(): | |
| print("β Codex server is not running!") | |
| print("π‘ Start the server with: ./run_model.sh server") | |
| return | |
| print("β Connected to Codex server") | |
| print("Type 'quit' to exit") | |
| print("-" * 50) | |
| while True: | |
| try: | |
| user_input = input("\nYou: ").strip() | |
| if user_input.lower() in ['quit', 'exit', 'q']: | |
| break | |
| if not user_input: | |
| continue | |
| # Send request | |
| messages = [{"role": "user", "content": user_input}] | |
| response = codex.chat_completion(messages) | |
| if "error" in response: | |
| print(f"β Error: {response['error']}") | |
| continue | |
| # Display response | |
| if "choices" in response and len(response["choices"]) > 0: | |
| assistant_message = response["choices"][0]["message"] | |
| print(f"\nAssistant: {assistant_message.get('content', 'No content')}") | |
| # Check for tool calls | |
| tool_calls = codex.extract_tool_calls(response) | |
| if tool_calls: | |
| print(f"\nπ§ Tool Calls ({len(tool_calls)}):") | |
| for i, tool_call in enumerate(tool_calls, 1): | |
| print(f" {i}. {tool_call['function']['name']}") | |
| print(f" Arguments: {tool_call['function'].get('arguments', {})}") | |
| except KeyboardInterrupt: | |
| print("\n\nGoodbye! π") | |
| break | |
| except Exception as e: | |
| print(f"Error: {e}") | |
| if __name__ == "__main__": | |
| import sys | |
| if len(sys.argv) > 1 and sys.argv[1] == "demo": | |
| demo_codex_integration() | |
| else: | |
| interactive_codex_chat() | |