kristiannordby/function_call_sql
Viewer โข Updated โข 1.04k โข 29
How to use enji-hex/Qwen3-1.7b-SQL-GGUF with llama.cpp:
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
docker model run hf.co/enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
How to use enji-hex/Qwen3-1.7b-SQL-GGUF with Ollama:
ollama run hf.co/enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
How to use enji-hex/Qwen3-1.7b-SQL-GGUF with Pi:
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
# Install Pi:
npm install -g @earendil-works/pi-coding-agent
# Add to ~/.pi/agent/models.json:
{
"providers": {
"llama-cpp": {
"baseUrl": "http://localhost:9931/v1",
"api": "openai-completions",
"apiKey": "none",
"models": [
{
"id": "enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M"
}
]
}
}
}# Start Pi in your project directory: pi
How to use enji-hex/Qwen3-1.7b-SQL-GGUF with Docker Model Runner:
docker model run hf.co/enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
How to use enji-hex/Qwen3-1.7b-SQL-GGUF with Lemonade:
# Download Lemonade from https://lemonade-server.ai/ lemonade pull enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
lemonade run user.Qwen3-1.7b-SQL-GGUF-Q4_K_M
lemonade list
How to use enji-hex/Qwen3-1.7b-SQL-GGUF with Hermes Agent:
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
hermes
How to use enji-hex/Qwen3-1.7b-SQL-GGUF with OpenClaw:
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "enji-hex/Qwen3-1.7b-SQL-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
openclaw agent --local --agent main --message "Hello from Hugging Face"
Fine-tuned Qwen/Qwen3-1.7B (QLoRA r=16, 3 epochs via Unsloth) for generating raw SQLite queries from database schemas.
check.py)
| Model | Syntax Valid (sqlglot) |
Execution Match (SQLite) |
|---|---|---|
Qwen3-1.7B-Q4_K_M (Base) |
0/5 | 0/5 |
Qwen3-1.7B-Q4_K_M (Base with thinking filter) |
3/5 | 3/5 |
Qwen3-1.7B-SQL.Q4_K_M (Fine-tuned) |
5/5 | 4/5 |
llama-cpp-python)
from llama_cpp import Llama
llm = Llama(model_path="Qwen3-1.7B-SQL.Q4_K_M.gguf", n_ctx=4096, n_gpu_layers=-1)
resp = llm.create_chat_completion(
messages=[
{"role": "system", "content": "You are a SQL assistant.\nOutput only valid SQLite.\n\n<SCHEMA>"},
{"role": "user", "content": "Select all columns for users older than 30."},
],
temperature=0.0,
)
print(resp["choices"][0]["message"]["content"])
4-bit