메뉴 닫기

openclaw + gemma4 모델 tool calling 사용

안녕하세요 이번글에서는 openclaw를 사용할때 서버의 명령어나 openclaw tool기능을 쓸때 GPT,Gemmini , Claude는 상관없지만 자체 localLLm 을 사용할때는 주의해야 할점이 있습니다.

각 LLM 모델마다 tool call 기능을 활성화 해주어야 tool 명령어를 쓸때 사용이 가능합니다 . 예를 들어 내서버에 vdb1디스크 /root/backup 에 마운트 해줘라는 명령어를 내린다면 tool 기능이 없으면 사용할 수 없습니다.

서비스로 vllm을 컨트롤할 경우를 예를들어 진행해보겠습니다.

# cat /etc/systemd/system/vllm-gemma4.service
[Unit]
Description=vLLM Gemma4 26B Server
After=network.target[Service]
Type=simple
User=root
WorkingDirectory=/home/
Environment=”PATH=/root/miniconda3/envs/vllm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”
Environment=”HF_HOME=/root/.cache/huggingface”
ExecStart=/root/miniconda3/envs/vllm/bin/vllm serve gemma-4-26B-A4B-it-AWQ-4bit \
–tensor-parallel-size 2 \
–max-model-len 32768 \
–gpu-memory-utilization 0.90 \
–host 0.0.0.0 \
–port 8000 \
–disable-custom-all-reduce \
–served-model-name gemma4-26b \
–enable-auto-tool-choice \
  –tool-call-parser gemma4 \
–mm-processor-kwargs ‘{“max_dynamic_patch”: 4}’
StandardOutput=append:/home/vllm.log
StandardError=append:/home/vllm.log
Restart=on-failure
RestartSec=10[Install]
WantedBy=multi-user.target

 –tool-call-parser 옵션에 gemma4  를 언급해주면됩니다.. 

매우간단하지만 vLLM시작할때 필수로 지정해야합니다.

우선은 opencalw에서 안되던 tool calling은 이렇게 지정해서 시작하니 잘됩니다.

서비스를 재시작하고 아래curl 명령어로 잘되는지 확인해보겠습니다.


# curl -s -X POST http://192.168.1.5:8000/v1/chat/completions \
-H “Content-Type: application/json” \
-d ‘{
“model”: “gemma4-26b”,
“messages”: [{“role”: “user”, “content”: “What is the weather in Seoul?”}],
“tools”: [{
“type”: “function”,
“function”: {
“name”: “get_weather”,
“description”: “Get weather”,
“parameters”: {
“type”: “object”,
“properties”: {
“location”: {“type”: “string”}
}
}
}
}]
}’ | python3 -m json.tool

“tool_calls”: [ { “id”: “chatcmpl-tool-999f10c5bdf10aa2”, “type”: “function”, “function”: { “name”: “get_weather”, “arguments”: “{\”location\”: \”Seoul\”}” }

확인됩니다.

oepnclw 설치 하기 

openclaw

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다